summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Module_ooo.mk1
-rw-r--r--Repository.mk6
-rw-r--r--accessibility/inc/accessibility/standard/vclxaccessiblelistboxlist.hxx112
-rwxr-xr-xaccessibility/prj/build.lst2
-rwxr-xr-xaccessibility/source/extended/AccessibleGridControlTable.cxx6
-rw-r--r--[-rwxr-xr-x]accessibility/source/extended/AccessibleGridControlTableBase.cxx5
-rw-r--r--accessibility/source/standard/vclxaccessiblebox.cxx1
-rw-r--r--automation/source/server/statemnt.cxx17
-rw-r--r--avmedia/prj/build.lst2
-rw-r--r--basctl/prj/build.lst2
-rw-r--r--basctl/source/basicide/baside2b.cxx6
-rw-r--r--basctl/source/basicide/moduldl2.cxx2
-rw-r--r--basctl/source/basicide/moduldlg.hxx2
-rw-r--r--basctl/source/basicide/objdlg.cxx4
-rw-r--r--basctl/source/basicide/objdlg.hrc2
-rw-r--r--basctl/source/basicide/objdlg.src6
-rw-r--r--basic/inc/basic/sbstar.hxx2
-rwxr-xr-xbasic/inc/basic/vbahelper.hxx86
-rw-r--r--basic/prj/build.lst2
-rw-r--r--basic/source/basmgr/makefile.mk3
-rwxr-xr-xbasic/source/basmgr/vbahelper.cxx212
-rw-r--r--basic/source/classes/sb.cxx193
-rwxr-xr-xbasic/source/classes/sbxmod.cxx103
-rw-r--r--basic/source/comp/scanner.cxx20
-rw-r--r--binaryurp/prj/build.lst3
-rw-r--r--binaryurp/prj/d.lst4
-rw-r--r--binaryurp/qa/makefile.mk77
-rw-r--r--binaryurp/qa/test-cache.cxx84
-rw-r--r--binaryurp/qa/test-unmarshal.cxx112
-rw-r--r--binaryurp/qa/version.map34
-rw-r--r--binaryurp/source/binaryany.cxx98
-rw-r--r--binaryurp/source/binaryany.hxx73
-rw-r--r--binaryurp/source/binaryurp.component (renamed from remotebridges/source/factory/bridgefac.component)4
-rw-r--r--binaryurp/source/bridge.cxx978
-rw-r--r--binaryurp/source/bridge.hxx287
-rw-r--r--binaryurp/source/bridgefactory.cxx232
-rwxr-xr-xbinaryurp/source/bridgefactory.hxx144
-rwxr-xr-xbinaryurp/source/cache.hxx134
-rw-r--r--binaryurp/source/currentcontext.cxx80
-rw-r--r--binaryurp/source/currentcontext.hxx49
-rw-r--r--binaryurp/source/incomingreply.hxx58
-rw-r--r--binaryurp/source/incomingrequest.cxx300
-rw-r--r--binaryurp/source/incomingrequest.hxx86
-rw-r--r--binaryurp/source/lessoperators.cxx71
-rw-r--r--binaryurp/source/lessoperators.hxx50
-rw-r--r--binaryurp/source/makefile.mk (renamed from remotebridges/source/factory/makefile.mk)74
-rw-r--r--binaryurp/source/marshal.cxx314
-rwxr-xr-xbinaryurp/source/marshal.hxx95
-rw-r--r--binaryurp/source/outgoingrequest.hxx55
-rw-r--r--binaryurp/source/outgoingrequests.cxx80
-rw-r--r--binaryurp/source/outgoingrequests.hxx65
-rw-r--r--binaryurp/source/proxy.cxx260
-rw-r--r--binaryurp/source/proxy.hxx92
-rwxr-xr-xbinaryurp/source/reader.cxx553
-rw-r--r--binaryurp/source/reader.hxx89
-rw-r--r--binaryurp/source/readerstate.hxx52
-rw-r--r--binaryurp/source/specialfunctionids.hxx (renamed from remotebridges/source/bridge/remotebridge.component)37
-rwxr-xr-xbinaryurp/source/unmarshal.cxx563
-rw-r--r--binaryurp/source/unmarshal.hxx106
-rwxr-xr-xbinaryurp/source/writer.cxx476
-rw-r--r--binaryurp/source/writer.hxx185
-rw-r--r--binaryurp/source/writerstate.hxx55
-rw-r--r--bridges/inc/bridges/remote/bridgeimpl.hxx94
-rw-r--r--bridges/inc/bridges/remote/connection.h67
-rw-r--r--bridges/inc/bridges/remote/context.h260
-rw-r--r--bridges/inc/bridges/remote/counter.hxx57
-rw-r--r--bridges/inc/bridges/remote/helper.hxx68
-rw-r--r--bridges/inc/bridges/remote/mapping.hxx69
-rw-r--r--bridges/inc/bridges/remote/proxy.hxx91
-rw-r--r--bridges/inc/bridges/remote/remote.h93
-rw-r--r--bridges/inc/bridges/remote/remote.hxx73
-rw-r--r--bridges/inc/bridges/remote/stub.hxx64
-rw-r--r--bridges/inc/pch/precompiled_bridges.hxx4
-rw-r--r--bridges/prj/build.lst3
-rw-r--r--bridges/prj/d.lst18
-rw-r--r--bridges/source/remote/context/context.cxx484
-rw-r--r--bridges/source/remote/context/exports.dxp5
-rwxr-xr-xbridges/source/remote/context/rmcxt.map10
-rw-r--r--bridges/source/remote/idl/corba.idl88
-rw-r--r--bridges/source/remote/static/helper.cxx209
-rw-r--r--bridges/source/remote/static/mapping.cxx218
-rw-r--r--bridges/source/remote/static/proxy.cxx338
-rw-r--r--bridges/source/remote/static/remote.cxx161
-rw-r--r--bridges/source/remote/static/remote_types.cxx96
-rw-r--r--bridges/source/remote/static/remote_types.hxx89
-rw-r--r--bridges/source/remote/static/stub.cxx336
-rw-r--r--bridges/source/remote/urp/makefile.mk78
-rw-r--r--bridges/source/remote/urp/urp_bridgeimpl.cxx250
-rw-r--r--bridges/source/remote/urp/urp_bridgeimpl.hxx133
-rw-r--r--bridges/source/remote/urp/urp_cache.h57
-rw-r--r--bridges/source/remote/urp/urp_cache.hxx160
-rw-r--r--bridges/source/remote/urp/urp_dispatch.cxx116
-rw-r--r--bridges/source/remote/urp/urp_dispatch.hxx78
-rw-r--r--bridges/source/remote/urp/urp_environment.cxx551
-rw-r--r--bridges/source/remote/urp/urp_job.cxx939
-rw-r--r--bridges/source/remote/urp/urp_job.hxx379
-rw-r--r--bridges/source/remote/urp/urp_log.cxx147
-rw-r--r--bridges/source/remote/urp/urp_log.hxx50
-rw-r--r--bridges/source/remote/urp/urp_marshal.cxx235
-rw-r--r--bridges/source/remote/urp/urp_marshal.hxx343
-rw-r--r--bridges/source/remote/urp/urp_marshal_decl.hxx106
-rw-r--r--bridges/source/remote/urp/urp_property.hxx93
-rw-r--r--bridges/source/remote/urp/urp_propertyobject.cxx793
-rw-r--r--bridges/source/remote/urp/urp_propertyobject.hxx108
-rw-r--r--bridges/source/remote/urp/urp_reader.cxx832
-rw-r--r--bridges/source/remote/urp/urp_reader.hxx78
-rw-r--r--bridges/source/remote/urp/urp_replycontainer.hxx75
-rw-r--r--bridges/source/remote/urp/urp_threadid.cxx48
-rw-r--r--bridges/source/remote/urp/urp_threadid.hxx59
-rw-r--r--bridges/source/remote/urp/urp_unmarshal.cxx707
-rw-r--r--bridges/source/remote/urp/urp_unmarshal.hxx280
-rw-r--r--bridges/source/remote/urp/urp_writer.cxx269
-rw-r--r--bridges/source/remote/urp/urp_writer.hxx83
-rw-r--r--bridges/unotypes/makefile.mk13
-rw-r--r--canvas/source/cairo/cairo_textlayout.cxx311
-rw-r--r--canvas/source/vcl/canvashelper_texturefill.cxx4
-rwxr-xr-x[-rw-r--r--]canvas/source/vcl/spritehelper.cxx17
-rw-r--r--chart2/prj/build.lst2
-rwxr-xr-xchart2/source/controller/chartapiwrapper/LegendWrapper.cxx21
-rw-r--r--chart2/source/controller/dialogs/ChartTypeDialogController.cxx2
-rw-r--r--chart2/source/controller/dialogs/Strings.src9
-rw-r--r--chart2/source/controller/dialogs/Strings_Statistic.src12
-rw-r--r--chart2/source/controller/dialogs/res_BarGeometry.cxx2
-rw-r--r--chart2/source/controller/dialogs/res_LegendPosition.cxx93
-rw-r--r--chart2/source/controller/dialogs/res_LegendPosition.hxx5
-rw-r--r--chart2/source/controller/dialogs/res_TextSeparator.cxx3
-rw-r--r--chart2/source/controller/dialogs/tp_3D_SceneAppearance.cxx2
-rw-r--r--chart2/source/controller/dialogs/tp_3D_SceneAppearance.hxx2
-rw-r--r--chart2/source/controller/dialogs/tp_3D_SceneGeometry.cxx2
-rw-r--r--chart2/source/controller/dialogs/tp_3D_SceneIllumination.cxx9
-rw-r--r--chart2/source/controller/dialogs/tp_3D_SceneIllumination.hrc4
-rw-r--r--chart2/source/controller/dialogs/tp_3D_SceneIllumination.src5
-rw-r--r--chart2/source/controller/dialogs/tp_AxisPositions.cxx4
-rw-r--r--chart2/source/controller/dialogs/tp_ChartType.cxx11
-rw-r--r--chart2/source/controller/dialogs/tp_DataSource.cxx2
-rw-r--r--chart2/source/controller/dialogs/tp_LegendPosition.cxx1
-rw-r--r--chart2/source/controller/itemsetwrapper/LegendItemConverter.cxx133
-rw-r--r--chart2/source/controller/main/ChartController_Position.cxx14
-rw-r--r--chart2/source/controller/main/ChartController_Tools.cxx9
-rw-r--r--chart2/source/controller/main/ChartController_Window.cxx16
-rw-r--r--chart2/source/controller/main/PositionAndSizeHelper.cxx59
-rw-r--r--chart2/source/controller/main/SelectionHelper.cxx20
-rw-r--r--chart2/source/inc/Strings.hrc7
-rw-r--r--chart2/source/inc/chartview/ChartSfxItemIds.hxx3
-rwxr-xr-xchart2/source/model/main/Legend.cxx70
-rwxr-xr-x[-rw-r--r--]chart2/source/model/main/Legend.hxx19
-rwxr-xr-xchart2/source/model/template/BubbleChartTypeTemplate.cxx2
-rwxr-xr-xchart2/source/model/template/StockChartTypeTemplate.cxx1
-rwxr-xr-xchart2/source/tools/LegendHelper.cxx8
-rwxr-xr-xchart2/source/tools/RegressionCurveHelper.cxx4
-rw-r--r--chart2/source/view/charttypes/AreaChart.cxx6
-rw-r--r--chart2/source/view/charttypes/AreaChart.hxx2
-rw-r--r--chart2/source/view/charttypes/BubbleChart.cxx2
-rw-r--r--chart2/source/view/charttypes/BubbleChart.hxx2
-rw-r--r--chart2/source/view/charttypes/CandleStickChart.cxx2
-rw-r--r--chart2/source/view/charttypes/CandleStickChart.hxx2
-rwxr-xr-x[-rw-r--r--]chart2/source/view/charttypes/VSeriesPlotter.cxx215
-rw-r--r--chart2/source/view/inc/LegendEntryProvider.hxx57
-rw-r--r--chart2/source/view/inc/VLegendSymbolFactory.hxx12
-rw-r--r--chart2/source/view/inc/VSeriesPlotter.hxx36
-rw-r--r--chart2/source/view/main/ChartItemPool.cxx5
-rw-r--r--chart2/source/view/main/VLegend.cxx495
-rw-r--r--chart2/source/view/main/VLegendSymbolFactory.cxx288
-rw-r--r--comphelper/Library_comphelp.mk1
-rw-r--r--comphelper/Package_inc.mk2
-rwxr-xr-xcomphelper/inc/comphelper/anycompare.hxx226
-rwxr-xr-xcomphelper/inc/comphelper/componentguard.hxx70
-rw-r--r--comphelper/source/container/enumerablemap.cxx205
-rwxr-xr-xcomphelper/source/misc/anycompare.cxx131
-rw-r--r--configmgr/source/access.cxx100
-rw-r--r--configmgr/source/xcuparser.cxx26
-rw-r--r--configure.in26
-rw-r--r--connectivity/prj/build.lst2
-rw-r--r--cppu/source/uno/data.cxx11
-rw-r--r--cpputools/source/unoexe/unoexe.cxx17
-rwxr-xr-xcrashrep/prj/build.lst2
-rw-r--r--cui/source/customize/cfg.cxx12
-rw-r--r--cui/source/customize/cfg.hrc5
-rw-r--r--cui/source/customize/cfg.src8
-rw-r--r--cui/source/dialogs/commonlingui.cxx1
-rw-r--r--cui/source/dialogs/cuigaldlg.cxx21
-rw-r--r--cui/source/dialogs/cuigrfflt.cxx10
-rw-r--r--cui/source/dialogs/gallery.src4
-rw-r--r--cui/source/dialogs/hldocntp.cxx3
-rw-r--r--cui/source/dialogs/hldoctp.cxx4
-rw-r--r--cui/source/dialogs/hlinettp.cxx11
-rw-r--r--cui/source/dialogs/hlmailtp.cxx3
-rw-r--r--cui/source/dialogs/hlmarkwn.cxx3
-rw-r--r--cui/source/dialogs/hlmarkwn.hrc3
-rw-r--r--cui/source/dialogs/hlmarkwn.src19
-rw-r--r--cui/source/dialogs/hltpbase.cxx3
-rw-r--r--cui/source/dialogs/insdlg.cxx23
-rw-r--r--cui/source/dialogs/linkdlg.cxx28
-rw-r--r--cui/source/dialogs/multipat.cxx3
-rw-r--r--cui/source/dialogs/pastedlg.cxx4
-rw-r--r--cui/source/dialogs/postdlg.cxx4
-rw-r--r--cui/source/dialogs/splitcelldlg.cxx4
-rw-r--r--cui/source/dialogs/zoom.cxx8
-rw-r--r--cui/source/inc/backgrnd.hxx25
-rw-r--r--cui/source/inc/cuigaldlg.hxx6
-rw-r--r--cui/source/inc/cuigrfflt.hxx10
-rw-r--r--cui/source/inc/cuitabline.hxx10
-rw-r--r--cui/source/inc/gallery.hrc1
-rw-r--r--cui/source/inc/hlinettp.hxx4
-rw-r--r--cui/source/inc/insdlg.hxx13
-rw-r--r--cui/source/inc/linkdlg.hxx20
-rw-r--r--cui/source/inc/numfmt.hxx7
-rw-r--r--cui/source/inc/optdict.hxx4
-rw-r--r--cui/source/inc/page.hxx2
-rw-r--r--cui/source/inc/paragrph.hxx10
-rw-r--r--cui/source/inc/pastedlg.hxx2
-rw-r--r--cui/source/inc/splitcelldlg.hxx4
-rw-r--r--cui/source/inc/tabstpge.hxx7
-rwxr-xr-xcui/source/options/optdict.cxx10
-rw-r--r--cui/source/options/optlingu.cxx7
-rw-r--r--cui/source/options/optlingu.hrc6
-rwxr-xr-xcui/source/options/optlingu.src13
-rw-r--r--cui/source/options/treeopt.cxx2
-rw-r--r--cui/source/tabpages/align.cxx4
-rw-r--r--cui/source/tabpages/autocdlg.cxx27
-rw-r--r--cui/source/tabpages/autocdlg.hrc12
-rw-r--r--cui/source/tabpages/autocdlg.src40
-rw-r--r--cui/source/tabpages/backgrnd.cxx35
-rw-r--r--cui/source/tabpages/connect.cxx3
-rw-r--r--cui/source/tabpages/grfpage.cxx2
-rw-r--r--cui/source/tabpages/measure.cxx4
-rw-r--r--cui/source/tabpages/numfmt.cxx21
-rw-r--r--cui/source/tabpages/numpages.cxx9
-rw-r--r--cui/source/tabpages/page.cxx9
-rw-r--r--cui/source/tabpages/paragrph.cxx22
-rw-r--r--cui/source/tabpages/paragrph.hrc4
-rw-r--r--cui/source/tabpages/paragrph.src43
-rw-r--r--cui/source/tabpages/tabarea.hrc4
-rw-r--r--cui/source/tabpages/tabarea.src62
-rw-r--r--cui/source/tabpages/tabline.hrc26
-rw-r--r--cui/source/tabpages/tabline.src52
-rw-r--r--cui/source/tabpages/tabstpge.cxx23
-rw-r--r--cui/source/tabpages/tabstpge.hrc3
-rw-r--r--cui/source/tabpages/tabstpge.src39
-rw-r--r--cui/source/tabpages/textanim.cxx18
-rw-r--r--cui/source/tabpages/textattr.cxx2
-rw-r--r--cui/source/tabpages/tparea.cxx20
-rw-r--r--cui/source/tabpages/tpbitmap.cxx11
-rw-r--r--cui/source/tabpages/tpcolor.cxx11
-rw-r--r--cui/source/tabpages/tpgradnt.cxx10
-rw-r--r--cui/source/tabpages/tphatch.cxx10
-rw-r--r--cui/source/tabpages/tpline.cxx21
-rw-r--r--cui/source/tabpages/tplnedef.cxx13
-rw-r--r--cui/source/tabpages/tplneend.cxx3
-rw-r--r--cui/source/tabpages/tpshadow.cxx4
-rw-r--r--cui/source/tabpages/transfrm.cxx9
-rw-r--r--dbaccess/prj/build.lst2
-rw-r--r--dbaccess/source/ui/uno/ColumnControl.cxx4
-rw-r--r--dbaccess/source/ui/uno/ColumnControl.hxx1
-rw-r--r--desktop/prj/build.lst2
-rw-r--r--editeng/inc/editeng/editrids.hrc39
-rw-r--r--editeng/prj/build.lst2
-rw-r--r--editeng/source/items/page.src148
-rw-r--r--editeng/source/items/paperinf.cxx46
-rw-r--r--extensions/prj/build.lst2
-rw-r--r--extensions/source/dbpilots/groupboxwiz.cxx8
-rw-r--r--extensions/source/ole/unoobjw.cxx2
-rw-r--r--extensions/source/oooimprovement/onlogrotate_job.cxx44
-rw-r--r--filter/prj/build.lst2
-rw-r--r--filter/source/pdf/impdialog.cxx48
-rw-r--r--filter/source/pdf/impdialog.hrc4
-rw-r--r--filter/source/pdf/impdialog.hxx3
-rw-r--r--filter/source/pdf/impdialog.src16
-rw-r--r--filter/source/xsltdialog/xmlfiltersettingsdialog.cxx2
-rw-r--r--filter/source/xsltdialog/xmlfiltersettingsdialog.hrc2
-rw-r--r--filter/source/xsltdialog/xmlfiltersettingsdialog.src5
-rw-r--r--forms/prj/build.lst2
-rw-r--r--forms/source/component/Filter.cxx14
-rw-r--r--forms/source/component/Filter.hxx1
-rw-r--r--forms/source/richtext/richtextcontrol.cxx2
-rw-r--r--forms/source/richtext/richtextcontrol.hxx4
-rw-r--r--forms/source/solar/component/navbarcontrol.cxx4
-rw-r--r--forms/source/solar/component/navbarcontrol.hxx4
-rw-r--r--formula/source/ui/dlg/formula.cxx5
-rw-r--r--formula/source/ui/dlg/parawin.cxx24
-rw-r--r--formula/source/ui/dlg/parawin.hxx26
-rw-r--r--fpicker/prj/build.lst2
-rw-r--r--fpicker/source/office/iodlg.cxx1
-rw-r--r--fpicker/source/office/iodlg.hrc1
-rw-r--r--fpicker/source/office/iodlg.src4
-rw-r--r--framework/prj/build.lst2
-rw-r--r--framework/source/classes/fwktabwindow.cxx3
-rw-r--r--framework/util/fwk.component3
-rw-r--r--framework/util/fwl.component3
-rw-r--r--i18npool/inc/i18npool/lang.h5
-rw-r--r--i18npool/source/breakiterator/makefile.mk12
-rw-r--r--i18npool/source/calendar/calendar_gregorian.cxx6
-rw-r--r--i18npool/source/isolang/isolang.cxx9
-rw-r--r--i18npool/source/isolang/mslangid.cxx2
-rw-r--r--i18npool/source/localedata/LocaleNode.cxx77
-rw-r--r--i18npool/source/localedata/data/dsb_DE.xml350
-rw-r--r--i18npool/source/localedata/data/fi_FI.xml2
-rw-r--r--i18npool/source/localedata/data/haw_US.xml358
-rw-r--r--i18npool/source/localedata/data/hsb_DE.xml2
-rw-r--r--i18npool/source/localedata/data/ht_HT.xml358
-rw-r--r--i18npool/source/localedata/data/jbo.xml358
-rw-r--r--i18npool/source/localedata/data/lif_NP.xml357
-rw-r--r--i18npool/source/localedata/data/localedata_euro.map17
-rw-r--r--i18npool/source/localedata/data/localedata_others.map104
-rw-r--r--[-rwxr-xr-x]i18npool/source/localedata/data/makefile.mk7
-rw-r--r--i18npool/source/localedata/data/no_NO.xml2
-rw-r--r--i18npool/source/localedata/data/sv_SE.xml2
-rw-r--r--i18npool/source/localedata/data/ur_PK.xml358
-rw-r--r--i18npool/source/localedata/data/yi_US.xml163
-rw-r--r--i18npool/source/localedata/localedata.cxx7
-rwxr-xr-xicu/icuversion.mk6
-rw-r--r--instsetoo_native/prj/build.lst2
-rw-r--r--instsetoo_native/util/openoffice.lst2
-rw-r--r--io/source/acceptor/acc_pipe.cxx10
-rwxr-xr-xjavainstaller2/prj/build.lst2
-rw-r--r--jurt/com/sun/star/lib/uno/bridges/java_remote/java_remote_bridge.java17
-rw-r--r--jurt/com/sun/star/lib/uno/environments/remote/IProtocol.java2
-rw-r--r--jurt/com/sun/star/lib/uno/environments/remote/IThreadPool.java6
-rw-r--r--jurt/com/sun/star/lib/uno/environments/remote/JobQueue.java9
-rw-r--r--jurt/com/sun/star/lib/uno/protocols/urp/urp.java16
-rwxr-xr-xl10ntools/scripts/localize.pl2
-rw-r--r--l10ntools/scripts/tool/l10ntool.py5
-rw-r--r--neon/neon.patch57
-rw-r--r--odk/util/check.pl12
-rw-r--r--odk/util/makefile.pmk1
-rw-r--r--offapi/com/sun/star/awt/UnoControlDialog.idl6
-rw-r--r--offapi/com/sun/star/awt/XDialog2.idl2
-rw-r--r--offapi/com/sun/star/awt/grid/DefaultGridDataModel.idl15
-rw-r--r--offapi/com/sun/star/awt/grid/GridColumnEvent.idl10
-rw-r--r--offapi/com/sun/star/awt/grid/GridControlEvent.idl54
-rw-r--r--offapi/com/sun/star/awt/grid/GridDataEvent.idl45
-rwxr-xr-xoffapi/com/sun/star/awt/grid/SortableGridDataModel.idl102
-rw-r--r--offapi/com/sun/star/awt/grid/UnoControlGridModel.idl109
-rw-r--r--offapi/com/sun/star/awt/grid/XGridCell.idl56
-rw-r--r--offapi/com/sun/star/awt/grid/XGridCellRenderer.idl52
-rw-r--r--offapi/com/sun/star/awt/grid/XGridColumn.idl106
-rw-r--r--offapi/com/sun/star/awt/grid/XGridColumnListener.idl25
-rw-r--r--offapi/com/sun/star/awt/grid/XGridColumnModel.idl82
-rw-r--r--offapi/com/sun/star/awt/grid/XGridControl.idl45
-rw-r--r--offapi/com/sun/star/awt/grid/XGridDataListener.idl17
-rw-r--r--offapi/com/sun/star/awt/grid/XGridDataModel.idl94
-rw-r--r--offapi/com/sun/star/awt/grid/XGridSelection.idl48
-rwxr-xr-xoffapi/com/sun/star/awt/grid/XMutableGridDataModel.idl163
-rwxr-xr-xoffapi/com/sun/star/awt/grid/XSortableGridData.idl77
-rwxr-xr-x[-rw-r--r--]offapi/com/sun/star/awt/grid/XSortableMutableGridDataModel.idl (renamed from offapi/com/sun/star/awt/grid/ScrollBarMode.idl)51
-rw-r--r--offapi/com/sun/star/awt/grid/makefile.mk12
-rw-r--r--offapi/com/sun/star/awt/tree/XTreeControl.idl2
-rwxr-xr-x[-rw-r--r--]offapi/com/sun/star/chart/ChartLegendExpansion.idl (renamed from offapi/com/sun/star/chart2/LegendExpansion.idl)24
-rw-r--r--offapi/com/sun/star/chart/makefile.mk1
-rw-r--r--offapi/com/sun/star/chart2/CustomLegendEntry.idl50
-rw-r--r--offapi/com/sun/star/chart2/Legend.idl6
-rw-r--r--offapi/com/sun/star/chart2/LegendSymbolStyle.idl107
-rw-r--r--offapi/com/sun/star/chart2/ViewLegendEntry.idl58
-rw-r--r--offapi/com/sun/star/chart2/XLegend.idl33
-rw-r--r--offapi/com/sun/star/chart2/XLegendEntry.idl30
-rw-r--r--offapi/com/sun/star/chart2/XLegendSymbolProvider.idl35
-rw-r--r--offapi/com/sun/star/chart2/makefile.mk5
-rw-r--r--offapi/com/sun/star/i18n/TransliterationModules.idl8
-rw-r--r--offapi/com/sun/star/sdb/XSubDocument.idl8
-rw-r--r--offapi/com/sun/star/util/XTextSearch.idl150
-rw-r--r--offapi/com/sun/star/view/XMultiSelectionSupplier.idl4
-rw-r--r--offapi/com/sun/star/xml/sax/XFastAttributeList.idl4
-rw-r--r--offapi/type_reference/typelibrary_history.txt4
-rw-r--r--offapi/type_reference/types.rdbbin7307264 -> 7307264 bytes
-rw-r--r--officecfg/prj/build.lst2
-rw-r--r--officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu12
-rw-r--r--officecfg/registry/schema/org/openoffice/Office/Calc.xcs2
-rw-r--r--officecfg/util/makefile.mk1
-rw-r--r--oox/inc/oox/drawingml/chart/converterbase.hxx5
-rw-r--r--oox/source/drawingml/chart/converterbase.cxx43
-rw-r--r--oox/source/drawingml/chart/titleconverter.cxx38
-rw-r--r--oox/source/token/properties.txt1
-rw-r--r--padmin/AllLangResTarget_spa.mk48
-rw-r--r--padmin/Executable_spadmin.bin.mk70
-rw-r--r--padmin/Library_spa.mk76
-rw-r--r--[-rwxr-xr-x]padmin/Makefile (renamed from remotebridges/source/dynamicloader/makefile.mk)47
-rw-r--r--padmin/Module_padmin.mk (renamed from bridges/source/remote/context/makefile.mk)44
-rw-r--r--padmin/Package_inc.mk30
-rw-r--r--padmin/prj/build.lst2
-rw-r--r--padmin/prj/d.lst7
-rw-r--r--padmin/prj/makefile.mk (renamed from bridges/source/remote/static/makefile.mk)41
-rw-r--r--padmin/source/helper.hxx7
-rw-r--r--padmin/source/makefile.mk115
-rw-r--r--padmin/source/padialog.hxx2
-rw-r--r--padmin/source/padialog.src18
-rw-r--r--padmin/source/prtsetup.cxx6
-rw-r--r--postprocess/packcomponents/makefile.mk5
-rw-r--r--readlicense_oo/prj/build.lst2
-rw-r--r--remotebridges/prj/build.lst6
-rwxr-xr-x[-rw-r--r--]remotebridges/prj/d.lst20
-rw-r--r--remotebridges/source/bridge/bridge_connection.cxx139
-rw-r--r--remotebridges/source/bridge/bridge_connection.hxx57
-rw-r--r--remotebridges/source/bridge/bridge_provider.cxx179
-rw-r--r--remotebridges/source/bridge/makefile.mk72
-rw-r--r--remotebridges/source/bridge/remote_bridge.cxx470
-rw-r--r--remotebridges/source/bridge/remote_bridge.hxx147
-rw-r--r--remotebridges/source/bridge/remotebridge.xml47
-rw-r--r--remotebridges/source/dynamicloader/dynamicloader.cxx403
-rw-r--r--remotebridges/source/dynamicloader/dynamicloader.xml36
-rw-r--r--remotebridges/source/factory/brdgfctr.xml44
-rw-r--r--remotebridges/source/factory/bridgefactory.cxx493
-rw-r--r--remotebridges/source/factory/bridgeimpl.cxx270
-rw-r--r--remotebridges/source/factory/bridgeimpl.hxx106
-rw-r--r--reportdesign/prj/build.lst2
-rw-r--r--sal/inc/osl/thread.h12
-rw-r--r--sal/inc/osl/thread.hxx3
-rw-r--r--sal/osl/os2/thread.c4
-rw-r--r--sal/osl/unx/pipe.c2
-rw-r--r--sal/osl/unx/thread.c16
-rwxr-xr-x[-rw-r--r--]sal/osl/w32/thread.c25
-rw-r--r--sal/prj/build.lst1
-rw-r--r--sal/qa/osl/setthreadname/makefile.mk57
-rwxr-xr-xsal/qa/osl/setthreadname/test-setthreadname.cxx87
-rw-r--r--sal/qa/osl/setthreadname/version.map34
-rwxr-xr-xsal/util/sal.map1
-rw-r--r--sc/inc/dpglobal.hxx2
-rw-r--r--sc/inc/dpobject.hxx12
-rw-r--r--sc/inc/global.hxx4
-rw-r--r--sc/inc/pivot.hxx124
-rw-r--r--sc/inc/sc.hrc8
-rw-r--r--sc/inc/scabstdlg.hxx8
-rw-r--r--sc/prj/build.lst2
-rw-r--r--sc/source/core/data/document.cxx2
-rw-r--r--sc/source/core/data/dpobject.cxx159
-rw-r--r--sc/source/core/data/global2.cxx178
-rw-r--r--sc/source/core/data/makefile.mk1
-rw-r--r--sc/source/core/data/pivot2.cxx55
-rw-r--r--sc/source/filter/dif/difimp.cxx3
-rw-r--r--sc/source/filter/excel/xechart.cxx56
-rw-r--r--sc/source/filter/excel/xichart.cxx83
-rw-r--r--sc/source/filter/inc/xechart.hxx2
-rw-r--r--sc/source/filter/inc/xichart.hxx5
-rwxr-xr-xsc/source/filter/inc/xlchart.hxx1
-rw-r--r--sc/source/filter/inc/xlconst.hxx2
-rw-r--r--sc/source/ui/Accessibility/AccessibleDataPilotControl.cxx130
-rw-r--r--sc/source/ui/app/inputhdl.cxx7
-rwxr-xr-xsc/source/ui/app/inputwin.cxx1
-rw-r--r--sc/source/ui/attrdlg/condfrmt.cxx30
-rw-r--r--sc/source/ui/attrdlg/scdlgfact.cxx6
-rw-r--r--sc/source/ui/attrdlg/scdlgfact.hxx6
-rw-r--r--sc/source/ui/dbgui/asciiopt.cxx6
-rw-r--r--sc/source/ui/dbgui/dbnamdlg.cxx1
-rw-r--r--sc/source/ui/dbgui/fieldwnd.cxx1191
-rw-r--r--sc/source/ui/dbgui/filtdlg.cxx59
-rw-r--r--sc/source/ui/dbgui/imoptdlg.cxx35
-rw-r--r--sc/source/ui/dbgui/imoptdlg.hrc1
-rw-r--r--sc/source/ui/dbgui/imoptdlg.src12
-rw-r--r--sc/source/ui/dbgui/pivot.hrc7
-rw-r--r--sc/source/ui/dbgui/pivot.src131
-rw-r--r--sc/source/ui/dbgui/pvfundlg.cxx12
-rw-r--r--sc/source/ui/dbgui/pvlaydlg.cxx2099
-rw-r--r--sc/source/ui/dbgui/scendlg.cxx5
-rw-r--r--sc/source/ui/dbgui/scendlg.hrc3
-rw-r--r--sc/source/ui/dbgui/scendlg.src4
-rw-r--r--sc/source/ui/dbgui/scuiasciiopt.cxx67
-rw-r--r--sc/source/ui/dbgui/scuiimoptdlg.cxx10
-rw-r--r--sc/source/ui/dbgui/sfiltdlg.cxx7
-rw-r--r--sc/source/ui/dbgui/tpsort.cxx7
-rw-r--r--sc/source/ui/dbgui/tpsubt.cxx3
-rw-r--r--sc/source/ui/docshell/docsh.cxx41
-rw-r--r--sc/source/ui/docshell/impex.cxx6
-rw-r--r--sc/source/ui/inc/AccessibleDataPilotControl.hxx6
-rw-r--r--sc/source/ui/inc/areasdlg.hxx6
-rw-r--r--sc/source/ui/inc/condfrmt.hrc6
-rw-r--r--sc/source/ui/inc/condfrmt.hxx7
-rw-r--r--sc/source/ui/inc/fieldwnd.hxx368
-rw-r--r--sc/source/ui/inc/filldlg.hxx21
-rw-r--r--sc/source/ui/inc/filtdlg.hxx2
-rw-r--r--sc/source/ui/inc/filter.hrc7
-rw-r--r--sc/source/ui/inc/imoptdlg.hxx18
-rw-r--r--sc/source/ui/inc/instbdlg.hxx4
-rw-r--r--sc/source/ui/inc/pvfundlg.hxx22
-rw-r--r--sc/source/ui/inc/pvlaydlg.hxx283
-rw-r--r--sc/source/ui/inc/scuiimoptdlg.hxx3
-rw-r--r--sc/source/ui/inc/shtabdlg.hxx2
-rw-r--r--sc/source/ui/miscdlgs/crnrdlg.cxx3
-rw-r--r--sc/source/ui/miscdlgs/filldlg.cxx18
-rw-r--r--sc/source/ui/miscdlgs/highred.cxx1
-rw-r--r--sc/source/ui/miscdlgs/highred.src2
-rw-r--r--sc/source/ui/miscdlgs/instbdlg.cxx5
-rw-r--r--sc/source/ui/miscdlgs/linkarea.cxx3
-rw-r--r--sc/source/ui/miscdlgs/optsolver.cxx13
-rw-r--r--sc/source/ui/miscdlgs/shtabdlg.cxx4
-rw-r--r--sc/source/ui/miscdlgs/solvrdlg.cxx3
-rw-r--r--sc/source/ui/namedlg/namedlg.cxx2
-rw-r--r--sc/source/ui/navipi/navipi.cxx4
-rw-r--r--sc/source/ui/pagedlg/areasdlg.cxx6
-rw-r--r--sc/source/ui/pagedlg/tphf.cxx2
-rw-r--r--sc/source/ui/pagedlg/tptable.cxx3
-rw-r--r--sc/source/ui/src/condfrmt.src49
-rw-r--r--sc/source/ui/src/filter.src20
-rw-r--r--sc/source/ui/src/globstr.src38
-rw-r--r--sc/source/ui/src/popup.src4
-rw-r--r--sc/source/ui/src/scfuncs.src8
-rw-r--r--sc/source/ui/src/scstring.src25
-rw-r--r--sc/source/ui/view/gridwin2.cxx6
-rw-r--r--sc/source/ui/view/tabvwshc.cxx2
-rw-r--r--scaddins/prj/build.lst2
-rw-r--r--sccomp/prj/build.lst2
-rw-r--r--scp2/prj/build.lst2
-rwxr-xr-xscp2/source/ooo/ure.scp42
-rw-r--r--sd/prj/build.lst2
-rwxr-xr-xsd/source/ui/app/strings.src7
-rwxr-xr-xsd/source/ui/dlg/animobjs.cxx12
-rwxr-xr-x[-rw-r--r--]sd/source/ui/dlg/animobjs.src4
-rwxr-xr-xsd/source/ui/dlg/copydlg.cxx6
-rwxr-xr-x[-rw-r--r--]sd/source/ui/dlg/custsdlg.src3
-rwxr-xr-xsd/source/ui/dlg/dlgfield.cxx2
-rwxr-xr-xsd/source/ui/dlg/headerfooterdlg.cxx13
-rwxr-xr-xsd/source/ui/dlg/navigatr.cxx2
-rwxr-xr-x[-rw-r--r--]sd/source/ui/dlg/navigatr.src5
-rwxr-xr-xsd/source/ui/dlg/present.cxx6
-rwxr-xr-xsd/source/ui/dlg/prntopts.cxx3
-rwxr-xr-xsd/source/ui/dlg/tpaction.cxx3
-rwxr-xr-x[-rw-r--r--]sd/source/ui/dlg/tpaction.src5
-rwxr-xr-xsd/source/ui/dlg/vectdlg.cxx3
-rwxr-xr-x[-rw-r--r--]sd/source/ui/dlg/vectdlg.src3
-rwxr-xr-x[-rw-r--r--]sd/source/ui/inc/animobjs.hrc3
-rwxr-xr-xsd/source/ui/inc/animobjs.hxx5
-rwxr-xr-x[-rw-r--r--]sd/source/ui/inc/copydlg.hxx6
-rwxr-xr-x[-rw-r--r--]sd/source/ui/inc/dlgfield.hxx2
-rwxr-xr-x[-rw-r--r--]sd/source/ui/inc/navigatr.hrc7
-rwxr-xr-xsd/source/ui/inc/strings.hrc3
-rwxr-xr-x[-rw-r--r--]sd/source/ui/inc/tpaction.hrc3
-rw-r--r--sdext/prj/build.lst2
-rw-r--r--set_soenv.in16
-rw-r--r--setup_native/prj/build.lst2
-rw-r--r--setup_native/source/mac/ooo3_installer.icnsbin49809 -> 56605 bytes
-rwxr-xr-xsetup_native/source/packinfo/packinfo_office.txt6
-rw-r--r--setup_native/source/win32/msi-encodinglist.txt27
-rw-r--r--sfx2/inc/sfx2/dinfdlg.hxx2
-rw-r--r--sfx2/inc/sfx2/mgetempl.hxx2
-rwxr-xr-xsfx2/inc/sfx2/sfx.hrc3
-rw-r--r--sfx2/prj/build.lst2
-rw-r--r--sfx2/source/appl/sfx.src5
-rw-r--r--sfx2/source/dialog/dinfdlg.cxx15
-rw-r--r--sfx2/source/dialog/dinfdlg.hrc4
-rw-r--r--sfx2/source/dialog/dinfdlg.src4
-rw-r--r--sfx2/source/dialog/mgetempl.cxx2
-rw-r--r--sfx2/source/dialog/newstyle.cxx1
-rw-r--r--sfx2/source/dialog/passwd.cxx1
-rw-r--r--sfx2/source/dialog/passwd.hrc3
-rw-r--r--sfx2/source/dialog/passwd.src37
-rw-r--r--sfx2/source/dialog/tabdlg.cxx5
-rw-r--r--sfx2/source/dialog/templdlg.cxx2
-rw-r--r--sfx2/source/dialog/templdlg.hrc3
-rw-r--r--sfx2/source/dialog/templdlg.src4
-rwxr-xr-xshell/prj/build.lst2
-rwxr-xr-xsolenv/bin/build.pl18
-rw-r--r--solenv/bin/cws.pl74
-rw-r--r--solenv/bin/make_installer.pl3
-rw-r--r--solenv/bin/modules/CwsConfig.pm107
-rw-r--r--solenv/bin/modules/installer/globals.pm7
-rw-r--r--solenv/bin/modules/installer/windows/component.pm16
-rw-r--r--solenv/bin/modules/installer/windows/directory.pm107
-rw-r--r--solenv/bin/modules/installer/windows/file.pm232
-rw-r--r--solenv/bin/modules/installer/windows/idtglobal.pm22
-rw-r--r--solenv/bin/modules/installer/windows/msiglobal.pm109
-rw-r--r--solenv/config/sdev300.ini13
-rw-r--r--solenv/gbuild/AllLangResTarget.mk5
-rw-r--r--solenv/gbuild/SdiTarget.mk3
-rwxr-xr-xsolenv/gbuild/platform/linux.mk2
-rwxr-xr-xsolenv/gbuild/platform/solaris.mk2
-rw-r--r--solenv/inc/_cppunit.mk20
-rw-r--r--solenv/inc/cppunit.mk2
-rw-r--r--solenv/inc/extension_post.mk15
-rw-r--r--solenv/inc/langlist.mk2
-rw-r--r--solenv/inc/minor.mk6
-rw-r--r--solenv/inc/settings.mk2
-rw-r--r--solenv/inc/tg_ext.mk4
-rw-r--r--starmath/prj/build.lst2
-rw-r--r--stoc/source/corereflection/crefl.cxx2
-rw-r--r--stoc/source/corereflection/lrucache.hxx3
-rw-r--r--stoc/source/security/file_policy.cxx1
-rw-r--r--svl/prj/build.lst2
-rw-r--r--svtools/Library_svt.mk3
-rw-r--r--svtools/Package_inc.mk4
-rwxr-xr-xsvtools/inc/svtools/accessiblefactory.hxx15
-rw-r--r--svtools/inc/svtools/accessibletable.hxx10
-rw-r--r--svtools/inc/svtools/svtools.hrc9
-rw-r--r--svtools/inc/svtools/table/abstracttablecontrol.hxx134
-rw-r--r--svtools/inc/svtools/table/defaultinputhandler.hxx41
-rw-r--r--svtools/inc/svtools/table/gridtablerenderer.hxx50
-rw-r--r--svtools/inc/svtools/table/tablecontrol.hxx165
-rw-r--r--svtools/inc/svtools/table/tablecontrolinterface.hxx254
-rw-r--r--svtools/inc/svtools/table/tableinputhandler.hxx22
-rwxr-xr-x[-rw-r--r--]svtools/inc/svtools/table/tablemodel.hxx331
-rw-r--r--svtools/inc/svtools/table/tablerenderer.hxx79
-rwxr-xr-xsvtools/inc/svtools/table/tablesort.hxx91
-rw-r--r--svtools/inc/svtools/table/tabletypes.hxx7
-rw-r--r--svtools/prj/build.lst2
-rw-r--r--svtools/source/brwbox/datwin.cxx9
-rw-r--r--svtools/source/contnr/svcontnr.src27
-rwxr-xr-x[-rw-r--r--]svtools/source/control/filectrl.src40
-rwxr-xr-xsvtools/source/control/ruler.cxx1
-rwxr-xr-xsvtools/source/control/tabbar.cxx13
-rw-r--r--svtools/source/control/toolbarmenuacc.cxx2
-rw-r--r--svtools/source/control/valueacc.cxx2
-rw-r--r--svtools/source/dialogs/colrdlg.hrc2
-rw-r--r--svtools/source/dialogs/colrdlg.src38
-rw-r--r--svtools/source/inc/filectrl.hrc7
-rw-r--r--svtools/source/misc/langtab.src8
-rwxr-xr-xsvtools/source/table/cellvalueconversion.cxx77
-rwxr-xr-x[-rw-r--r--]svtools/source/table/cellvalueconversion.hxx (renamed from svtools/source/inc/accessibletableimp.hxx)48
-rw-r--r--svtools/source/table/defaultinputhandler.cxx197
-rw-r--r--svtools/source/table/gridtablerenderer.cxx663
-rwxr-xr-xsvtools/source/table/mousefunction.cxx320
-rwxr-xr-xsvtools/source/table/mousefunction.hxx161
-rw-r--r--svtools/source/table/tablecontrol.cxx788
-rwxr-xr-x[-rw-r--r--]svtools/source/table/tablecontrol_impl.cxx2601
-rwxr-xr-x[-rw-r--r--]svtools/source/table/tablecontrol_impl.hxx315
-rw-r--r--svtools/source/table/tabledatawindow.cxx199
-rw-r--r--svtools/source/table/tabledatawindow.hxx (renamed from svtools/inc/svtools/table/tabledatawindow.hxx)11
-rw-r--r--svtools/source/table/tablegeometry.cxx132
-rw-r--r--svtools/source/table/tablegeometry.hxx44
-rw-r--r--[-rwxr-xr-x]svtools/source/uno/svtxgridcontrol.cxx1045
-rwxr-xr-xsvtools/source/uno/svtxgridcontrol.hxx88
-rw-r--r--svtools/source/uno/treecontrolpeer.cxx4
-rw-r--r--svtools/source/uno/unocontroltablemodel.cxx980
-rw-r--r--svtools/source/uno/unocontroltablemodel.hxx240
-rwxr-xr-xsvtools/source/uno/unogridcolumnfacade.cxx427
-rwxr-xr-xsvtools/source/uno/unogridcolumnfacade.hxx114
-rw-r--r--svx/inc/float3d.hrc4
-rw-r--r--svx/inc/svx/bmpmask.hxx7
-rw-r--r--svx/inc/svx/chrtitem.hxx34
-rwxr-xr-xsvx/inc/svx/dialogs.hrc16
-rw-r--r--svx/inc/svx/float3d.hxx26
-rw-r--r--svx/inc/svx/fontworkgallery.hxx2
-rw-r--r--svx/inc/svx/hdft.hxx2
-rw-r--r--svx/inc/svx/svdstr.hrc8
-rw-r--r--svx/prj/build.lst2
-rw-r--r--svx/source/dialog/_bmpmask.cxx43
-rw-r--r--svx/source/dialog/bmpmask.hrc6
-rw-r--r--svx/source/dialog/bmpmask.src55
-rw-r--r--svx/source/dialog/ctredlin.cxx18
-rw-r--r--svx/source/dialog/ctredlin.hrc9
-rw-r--r--svx/source/dialog/ctredlin.src36
-rw-r--r--svx/source/dialog/dlgctl3d.cxx2
-rw-r--r--svx/source/dialog/dlgctrl.src7
-rw-r--r--svx/source/dialog/hdft.cxx16
-rw-r--r--svx/source/dialog/optgrid.cxx11
-rw-r--r--svx/source/dialog/rubydialog.cxx8
-rw-r--r--svx/source/dialog/sdstring.src121
-rw-r--r--svx/source/dialog/srchdlg.cxx8
-rw-r--r--svx/source/engine3d/float3d.cxx110
-rw-r--r--svx/source/engine3d/float3d.src55
-rw-r--r--svx/source/fmcomp/fmgridif.cxx3
-rw-r--r--svx/source/form/formcontroller.cxx7
-rw-r--r--svx/source/gallery2/galbrws1.cxx3
-rw-r--r--svx/source/gallery2/galbrws2.cxx24
-rw-r--r--svx/source/gallery2/gallery.src82
-rw-r--r--svx/source/items/chrtitem.cxx34
-rw-r--r--svx/source/svdraw/svdstr.src82
-rw-r--r--svx/source/tbxctrls/colrctrl.cxx2
-rw-r--r--svx/source/tbxctrls/colrctrl.src33
-rw-r--r--svx/source/tbxctrls/fontworkgallery.cxx2
-rw-r--r--svx/source/tbxctrls/tbcontrl.cxx8
-rw-r--r--svx/source/tbxctrls/tbcontrl.src6
-rw-r--r--sw/Module_sw.mk6
-rw-r--r--sw/inc/access.hrc15
-rw-r--r--sw/inc/colwd.hxx2
-rw-r--r--sw/inc/fesh.hxx5
-rw-r--r--sw/inc/poolfmt.hrc9
-rw-r--r--sw/inc/unomap.hxx6
-rw-r--r--sw/prj/build.lst2
-rw-r--r--sw/source/core/doc/docdraw.cxx20
-rw-r--r--sw/source/core/draw/dflyobj.cxx29
-rw-r--r--sw/source/core/draw/dview.cxx10
-rw-r--r--sw/source/core/frmedt/fews.cxx170
-rw-r--r--sw/source/core/inc/anchoredobjectposition.hxx60
-rw-r--r--sw/source/core/inc/frame.hxx48
-rw-r--r--sw/source/core/layout/calcmove.cxx17
-rw-r--r--sw/source/core/layout/colfrm.cxx3
-rw-r--r--sw/source/core/layout/findfrm.cxx3
-rw-r--r--sw/source/core/layout/fly.cxx12
-rw-r--r--sw/source/core/layout/flycnt.cxx169
-rw-r--r--sw/source/core/layout/ftnfrm.cxx6
-rw-r--r--sw/source/core/layout/layact.cxx10
-rw-r--r--sw/source/core/layout/newfrm.cxx58
-rw-r--r--sw/source/core/layout/pagechg.cxx13
-rw-r--r--sw/source/core/layout/paintfrm.cxx20
-rw-r--r--sw/source/core/layout/ssfrm.cxx13
-rw-r--r--sw/source/core/layout/tabfrm.cxx6
-rw-r--r--sw/source/core/layout/trvlfrm.cxx3
-rw-r--r--sw/source/core/layout/wsfrm.cxx54
-rw-r--r--sw/source/core/objectpositioning/anchoredobjectposition.cxx102
-rw-r--r--sw/source/core/objectpositioning/tocntntanchoredobjectposition.cxx109
-rw-r--r--sw/source/core/objectpositioning/tolayoutanchoredobjectposition.cxx12
-rw-r--r--sw/source/core/text/frmcrsr.cxx13
-rw-r--r--sw/source/core/text/frmform.cxx18
-rw-r--r--sw/source/core/text/frmpaint.cxx4
-rw-r--r--sw/source/core/text/inftxt.cxx6
-rw-r--r--sw/source/core/text/itrtxt.cxx6
-rw-r--r--sw/source/core/text/txtfrm.cxx89
-rw-r--r--sw/source/core/text/txttab.cxx7
-rw-r--r--sw/source/core/text/widorp.cxx10
-rw-r--r--sw/source/filter/ascii/parasc.cxx2
-rw-r--r--sw/source/ui/chrdlg/break.cxx5
-rw-r--r--sw/source/ui/chrdlg/chardlg.cxx2
-rw-r--r--sw/source/ui/chrdlg/drpcps.cxx4
-rw-r--r--sw/source/ui/chrdlg/numpara.cxx6
-rw-r--r--sw/source/ui/chrdlg/swuiccoll.cxx4
-rw-r--r--sw/source/ui/config/optpage.cxx9
-rw-r--r--sw/source/ui/dialog/docstdlg.cxx18
-rw-r--r--sw/source/ui/dialog/uiregionsw.cxx10
-rw-r--r--sw/source/ui/docvw/access.src19
-rw-r--r--sw/source/ui/docvw/edtwin.cxx8
-rw-r--r--sw/source/ui/envelp/label1.cxx10
-rw-r--r--sw/source/ui/envelp/labprt.cxx6
-rw-r--r--sw/source/ui/envelp/labprt.hxx4
-rw-r--r--sw/source/ui/envelp/swuilabimp.hxx7
-rw-r--r--sw/source/ui/fldui/fldfunc.cxx16
-rw-r--r--sw/source/ui/frmdlg/column.cxx43
-rw-r--r--sw/source/ui/frmdlg/column.hrc1
-rw-r--r--sw/source/ui/frmdlg/column.src12
-rw-r--r--sw/source/ui/frmdlg/frmmgr.cxx18
-rw-r--r--sw/source/ui/frmdlg/frmpage.cxx112
-rw-r--r--sw/source/ui/inc/bookmark.hxx2
-rw-r--r--sw/source/ui/inc/break.hxx2
-rw-r--r--sw/source/ui/inc/column.hxx6
-rw-r--r--sw/source/ui/inc/docstdlg.hxx17
-rw-r--r--sw/source/ui/inc/drpcps.hxx4
-rw-r--r--sw/source/ui/inc/frmmgr.hxx3
-rw-r--r--sw/source/ui/inc/frmpage.hxx15
-rw-r--r--sw/source/ui/inc/glosbib.hxx7
-rw-r--r--sw/source/ui/inc/insfnote.hxx8
-rw-r--r--sw/source/ui/inc/linenum.hxx6
-rw-r--r--sw/source/ui/inc/num.hxx4
-rw-r--r--sw/source/ui/inc/numpara.hxx2
-rw-r--r--sw/source/ui/inc/optpage.hxx2
-rw-r--r--sw/source/ui/inc/outline.hxx4
-rw-r--r--sw/source/ui/inc/pgfnote.hxx4
-rw-r--r--sw/source/ui/inc/rowht.hxx2
-rw-r--r--sw/source/ui/inc/split.hxx4
-rw-r--r--sw/source/ui/inc/srtdlg.hxx4
-rw-r--r--sw/source/ui/inc/swrenamexnameddlg.hxx2
-rw-r--r--sw/source/ui/inc/swuicnttab.hxx10
-rw-r--r--sw/source/ui/inc/swuiidxmrk.hxx2
-rw-r--r--sw/source/ui/inc/tautofmt.hxx2
-rw-r--r--sw/source/ui/index/cnttab.cxx38
-rw-r--r--sw/source/ui/index/cnttab.hrc1
-rw-r--r--sw/source/ui/index/cnttab.src6
-rw-r--r--sw/source/ui/index/swuiidxmrk.cxx4
-rw-r--r--sw/source/ui/misc/bookmark.cxx3
-rw-r--r--sw/source/ui/misc/docfnote.cxx11
-rw-r--r--sw/source/ui/misc/glosbib.cxx7
-rw-r--r--sw/source/ui/misc/glossary.cxx11
-rw-r--r--sw/source/ui/misc/glossary.src8
-rw-r--r--sw/source/ui/misc/impfnote.hxx8
-rw-r--r--sw/source/ui/misc/insfnote.cxx8
-rw-r--r--sw/source/ui/misc/insfnote.hrc4
-rw-r--r--sw/source/ui/misc/insfnote.src6
-rw-r--r--sw/source/ui/misc/linenum.cxx19
-rw-r--r--sw/source/ui/misc/num.cxx5
-rw-r--r--sw/source/ui/misc/outline.cxx13
-rw-r--r--sw/source/ui/misc/pgfnote.cxx10
-rw-r--r--sw/source/ui/misc/srtdlg.cxx44
-rw-r--r--sw/source/ui/shells/drwbassh.cxx11
-rw-r--r--sw/source/ui/table/colwd.cxx2
-rw-r--r--sw/source/ui/table/convert.cxx2
-rw-r--r--sw/source/ui/table/convert.hrc3
-rw-r--r--sw/source/ui/table/convert.src6
-rw-r--r--sw/source/ui/table/rowht.cxx2
-rw-r--r--sw/source/ui/table/tabledlg.cxx24
-rw-r--r--sw/source/ui/table/tabledlg.hrc1
-rw-r--r--sw/source/ui/table/tabledlg.src1
-rw-r--r--sw/source/ui/table/tablepg.hxx3
-rw-r--r--sw/source/ui/table/tautofmt.cxx2
-rw-r--r--sw/source/ui/uiview/viewtab.cxx33
-rw-r--r--sw/source/ui/uno/unotxdoc.cxx17
-rw-r--r--sw/source/ui/utlui/navipi.cxx8
-rw-r--r--sw/source/ui/utlui/navipi.hrc1
-rw-r--r--sw/source/ui/utlui/navipi.src13
-rw-r--r--sw/source/ui/utlui/poolfmt.src23
-rw-r--r--sw/source/ui/utlui/swrenamexnameddlg.cxx4
-rw-r--r--swext/prj/build.lst2
-rw-r--r--sysui/prj/build.lst2
-rwxr-xr-xtestautomation/framework/optional/includes/CJK_FeatureSwitchTest_1.inc17
-rw-r--r--testautomation/framework/optional/includes/configuration.inc66
-rw-r--r--testautomation/framework/optional/includes/options_loadsave_general.inc3
-rw-r--r--testautomation/framework/optional/includes/options_ooo_colors.inc10
-rw-r--r--testautomation/framework/optional/includes/options_ooo_general.inc6
-rw-r--r--testautomation/global/required/includes/g_printing.inc4
-rw-r--r--testautomation/global/system/includes/iniinfo.inc36
-rwxr-xr-xtestautomation/global/win/dial_d_h.win1
-rwxr-xr-xtestautomation/global/win/edia_p_s.win2
-rw-r--r--testautomation/math/optional/includes/m_101_.inc3
-rw-r--r--testautomation/math/optional/includes/m_105.inc10
-rwxr-xr-xtestautomation/math/required/includes/m_001_.inc6
-rw-r--r--testautomation/math/required/includes/m_005_.inc3
-rw-r--r--testautomation/math/required/includes/m_007_.inc3
-rw-r--r--testautomation/spreadsheet/required/includes/c_upd_filemenu.inc64
-rw-r--r--toolkit/Library_tk.mk2
-rw-r--r--toolkit/inc/toolkit/awt/vclxcontainer.hxx2
-rw-r--r--toolkit/inc/toolkit/awt/vclxtopwindow.hxx2
-rw-r--r--toolkit/inc/toolkit/awt/vclxwindows.hxx2
-rwxr-xr-xtoolkit/inc/toolkit/controls/animatedimages.hxx4
-rw-r--r--toolkit/inc/toolkit/controls/controlmodelcontainerbase.hxx7
-rw-r--r--toolkit/inc/toolkit/controls/dialogcontrol.hxx6
-rw-r--r--toolkit/inc/toolkit/controls/formattedcontrol.hxx9
-rw-r--r--toolkit/inc/toolkit/controls/geometrycontrolmodel.hxx3
-rw-r--r--toolkit/inc/toolkit/controls/geometrycontrolmodel_impl.hxx16
-rw-r--r--toolkit/inc/toolkit/controls/roadmapcontrol.hxx38
-rwxr-xr-xtoolkit/inc/toolkit/controls/spinningprogress.hxx2
-rw-r--r--toolkit/inc/toolkit/controls/tabpagecontainer.hxx4
-rw-r--r--toolkit/inc/toolkit/controls/tabpagemodel.hxx5
-rw-r--r--toolkit/inc/toolkit/controls/tkscrollbar.hxx4
-rw-r--r--toolkit/inc/toolkit/controls/tksimpleanimation.hxx4
-rw-r--r--toolkit/inc/toolkit/controls/tkspinbutton.hxx4
-rw-r--r--toolkit/inc/toolkit/controls/tkthrobber.hxx4
-rw-r--r--toolkit/inc/toolkit/controls/unocontrol.hxx7
-rw-r--r--toolkit/inc/toolkit/controls/unocontrolbase.hxx8
-rw-r--r--toolkit/inc/toolkit/controls/unocontrolcontainer.hxx5
-rw-r--r--toolkit/inc/toolkit/controls/unocontrolcontainermodel.hxx2
-rw-r--r--toolkit/inc/toolkit/controls/unocontrolmodel.hxx49
-rw-r--r--toolkit/inc/toolkit/controls/unocontrols.hxx95
-rw-r--r--toolkit/inc/toolkit/helper/mutexandbroadcasthelper.hxx6
-rw-r--r--toolkit/inc/toolkit/helper/property.hxx13
-rw-r--r--toolkit/inc/toolkit/helper/servicenames.hxx1
-rw-r--r--toolkit/prj/build.lst5
-rwxr-xr-xtoolkit/qa/complex/toolkit/AccessibleStatusBar.java (renamed from toolkit/qa/complex/toolkit/CheckAccessibleStatusBar.java)107
-rwxr-xr-xtoolkit/qa/complex/toolkit/AccessibleStatusBarItem.java (renamed from toolkit/qa/complex/toolkit/CheckAccessibleStatusBarItem.java)122
-rwxr-xr-xtoolkit/qa/complex/toolkit/Assert.java234
-rw-r--r--toolkit/qa/complex/toolkit/CallbackClass.java67
-rw-r--r--toolkit/qa/complex/toolkit/CheckAsyncCallback.java156
-rwxr-xr-xtoolkit/qa/complex/toolkit/GridControl.java687
-rw-r--r--toolkit/qa/complex/toolkit/UnitConversion.java247
-rw-r--r--toolkit/qa/complex/toolkit/_XRequestCallback.java88
-rwxr-xr-xtoolkit/qa/complex/toolkit/accessibility/_XAccessibleComponent.java (renamed from toolkit/qa/complex/toolkit/_XAccessibleComponent.java)3
-rwxr-xr-xtoolkit/qa/complex/toolkit/accessibility/_XAccessibleContext.java (renamed from toolkit/qa/complex/toolkit/_XAccessibleContext.java)2
-rwxr-xr-xtoolkit/qa/complex/toolkit/accessibility/_XAccessibleEventBroadcaster.java (renamed from toolkit/qa/complex/toolkit/_XAccessibleEventBroadcaster.java)14
-rwxr-xr-xtoolkit/qa/complex/toolkit/accessibility/_XAccessibleExtendedComponent.java (renamed from toolkit/qa/complex/toolkit/_XAccessibleExtendedComponent.java)2
-rwxr-xr-xtoolkit/qa/complex/toolkit/accessibility/_XAccessibleText.java (renamed from toolkit/qa/complex/toolkit/_XAccessibleText.java)2
-rwxr-xr-xtoolkit/qa/complex/toolkit/awtgrid/DummyColumn.java180
-rwxr-xr-xtoolkit/qa/complex/toolkit/awtgrid/GridDataListener.java98
-rwxr-xr-xtoolkit/qa/complex/toolkit/awtgrid/TMutableGridDataModel.java314
-rwxr-xr-xtoolkit/qa/complex/toolkit/makefile.mk97
-rw-r--r--toolkit/qa/complex/xunitconversion/XUnitConversionTest.java250
-rw-r--r--toolkit/source/awt/vclxaccessiblecomponent.cxx4
-rwxr-xr-xtoolkit/source/controls/animatedimages.cxx10
-rw-r--r--toolkit/source/controls/controlmodelcontainerbase.cxx129
-rw-r--r--toolkit/source/controls/dialogcontrol.cxx13
-rw-r--r--toolkit/source/controls/formattedcontrol.cxx8
-rw-r--r--toolkit/source/controls/grid/defaultgridcolumnmodel.cxx460
-rw-r--r--toolkit/source/controls/grid/defaultgridcolumnmodel.hxx81
-rw-r--r--toolkit/source/controls/grid/defaultgriddatamodel.cxx567
-rw-r--r--toolkit/source/controls/grid/defaultgriddatamodel.hxx99
-rw-r--r--toolkit/source/controls/grid/gridcolumn.cxx480
-rw-r--r--toolkit/source/controls/grid/gridcolumn.hxx114
-rw-r--r--toolkit/source/controls/grid/gridcontrol.cxx313
-rw-r--r--toolkit/source/controls/grid/gridcontrol.hxx55
-rwxr-xr-xtoolkit/source/controls/grid/grideventforwarder.cxx149
-rwxr-xr-xtoolkit/source/controls/grid/grideventforwarder.hxx85
-rwxr-xr-xtoolkit/source/controls/grid/initguard.hxx64
-rwxr-xr-xtoolkit/source/controls/grid/sortablegriddatamodel.cxx877
-rwxr-xr-xtoolkit/source/controls/grid/sortablegriddatamodel.hxx198
-rw-r--r--toolkit/source/controls/roadmapcontrol.cxx8
-rwxr-xr-xtoolkit/source/controls/spinningprogress.cxx4
-rw-r--r--toolkit/source/controls/tabpagecontainer.cxx18
-rw-r--r--toolkit/source/controls/tabpagemodel.cxx20
-rw-r--r--toolkit/source/controls/tkscrollbar.cxx8
-rw-r--r--toolkit/source/controls/tksimpleanimation.cxx6
-rw-r--r--toolkit/source/controls/tkspinbutton.cxx8
-rw-r--r--toolkit/source/controls/tkthrobber.cxx6
-rw-r--r--toolkit/source/controls/tree/treecontrol.cxx20
-rw-r--r--toolkit/source/controls/tree/treecontrol.hxx7
-rw-r--r--toolkit/source/controls/unocontrol.cxx22
-rw-r--r--toolkit/source/controls/unocontrolbase.cxx9
-rw-r--r--toolkit/source/controls/unocontrolcontainer.cxx9
-rw-r--r--toolkit/source/controls/unocontrolcontainermodel.cxx3
-rw-r--r--toolkit/source/controls/unocontrolmodel.cxx64
-rw-r--r--toolkit/source/controls/unocontrols.cxx157
-rw-r--r--toolkit/source/helper/property.cxx22
-rw-r--r--toolkit/source/helper/registerservices.cxx299
-rw-r--r--toolkit/source/helper/servicenames.cxx1
-rw-r--r--toolkit/source/helper/unowrapper.cxx1
-rw-r--r--toolkit/source/helper/vclunohelper.cxx5
-rw-r--r--toolkit/util/tk.component5
-rw-r--r--tools/inc/tools/stream.hxx17
-rw-r--r--tools/inc/tools/wintypes.hxx3
-rwxr-xr-xtools/source/stream/stream.cxx46
-rw-r--r--ucb/source/ucp/tdoc/tdoc_docmgr.cxx105
-rw-r--r--ucb/source/ucp/tdoc/tdoc_docmgr.hxx34
-rw-r--r--unotools/inc/unotools/textsearch.hxx9
-rw-r--r--unotools/source/i18n/textsearch.cxx37
-rw-r--r--ure/prj/build.lst2
-rw-r--r--ure/source/README10
-rw-r--r--ure/source/makefile.mk3
-rw-r--r--uui/prj/build.lst2
-rw-r--r--vbahelper/source/vbahelper/vbaapplicationbase.cxx13
-rw-r--r--vbahelper/source/vbahelper/vbadocumentbase.cxx13
-rw-r--r--vbahelper/source/vbahelper/vbadocumentsbase.cxx61
-rw-r--r--vcl/aqua/inc/salgdi.h8
-rw-r--r--vcl/aqua/source/dtrans/DragSource.cxx13
-rw-r--r--vcl/aqua/source/dtrans/service_entry.cxx14
-rw-r--r--vcl/aqua/source/gdi/aquaprintaccessoryview.mm8
-rw-r--r--vcl/aqua/source/gdi/salgdi.cxx59
-rw-r--r--vcl/aqua/source/gdi/salprn.cxx10
-rw-r--r--vcl/inc/vcl/cvtsvm.hxx2
-rw-r--r--vcl/inc/vcl/displayconnectiondispatch.hxx52
-rw-r--r--vcl/inc/vcl/dllapi.h6
-rw-r--r--vcl/inc/vcl/fontcache.hxx2
-rw-r--r--vcl/inc/vcl/fontmanager.hxx2
-rw-r--r--vcl/inc/vcl/glyphcache.hxx12
-rw-r--r--vcl/inc/vcl/graphite_adaptors.hxx2
-rw-r--r--vcl/inc/vcl/graphite_layout.hxx6
-rw-r--r--vcl/inc/vcl/graphite_serverfont.hxx8
-rw-r--r--vcl/inc/vcl/help.hxx38
-rw-r--r--vcl/inc/vcl/helpwin.hxx3
-rw-r--r--vcl/inc/vcl/impfont.hxx8
-rw-r--r--vcl/inc/vcl/lineinfo.hxx2
-rw-r--r--vcl/inc/vcl/octree.hxx6
-rwxr-xr-x[-rw-r--r--]vcl/inc/vcl/outdev.hxx6
-rw-r--r--vcl/inc/vcl/outfont.hxx6
-rw-r--r--vcl/inc/vcl/pdfwriter.hxx9
-rw-r--r--vcl/inc/vcl/print.h2
-rw-r--r--vcl/inc/vcl/print.hxx17
-rw-r--r--vcl/inc/vcl/prndlg.hxx6
-rwxr-xr-x[-rw-r--r--]vcl/inc/vcl/region.hxx13
-rw-r--r--vcl/inc/vcl/salbmp.hxx2
-rw-r--r--vcl/inc/vcl/saldatabasic.hxx2
-rw-r--r--vcl/inc/vcl/salframe.hxx2
-rwxr-xr-x[-rw-r--r--]vcl/inc/vcl/salgdi.hxx15
-rw-r--r--vcl/inc/vcl/salimestatus.hxx2
-rw-r--r--vcl/inc/vcl/salinst.hxx38
-rwxr-xr-xvcl/inc/vcl/sallayout.hxx12
-rw-r--r--vcl/inc/vcl/salmenu.hxx4
-rwxr-xr-xvcl/inc/vcl/salnativewidgets.hxx2
-rw-r--r--vcl/inc/vcl/salobj.hxx2
-rw-r--r--vcl/inc/vcl/salprn.hxx6
-rw-r--r--vcl/inc/vcl/salsession.hxx2
-rw-r--r--vcl/inc/vcl/salsys.hxx2
-rw-r--r--vcl/inc/vcl/saltimer.hxx2
-rw-r--r--vcl/inc/vcl/salvd.hxx2
-rw-r--r--vcl/inc/vcl/svdata.hxx18
-rw-r--r--vcl/inc/vcl/svids.hrc4
-rw-r--r--vcl/inc/vcl/sysdata.hxx5
-rw-r--r--vcl/inc/vcl/syswin.hxx2
-rw-r--r--vcl/inc/vcl/window.h18
-rwxr-xr-xvcl/inc/vcl/window.hxx14
-rw-r--r--vcl/inc/vcl/xconnection.hxx15
-rw-r--r--vcl/os2/inc/salgdi.h8
-rw-r--r--vcl/os2/source/gdi/salgdi.cxx50
-rw-r--r--vcl/prj/build.lst2
-rw-r--r--vcl/source/app/help.cxx47
-rw-r--r--vcl/source/app/session.cxx36
-rw-r--r--vcl/source/app/svapp.cxx5
-rw-r--r--vcl/source/app/svdata.cxx15
-rw-r--r--vcl/source/app/svmain.cxx16
-rwxr-xr-xvcl/source/control/edit.cxx24
-rw-r--r--vcl/source/control/tabctrl.cxx19
-rw-r--r--vcl/source/gdi/bitmap.cxx10
-rw-r--r--vcl/source/gdi/lineinfo.cxx22
-rwxr-xr-x[-rw-r--r--]vcl/source/gdi/outdev.cxx847
-rw-r--r--vcl/source/gdi/outdev3.cxx8
-rw-r--r--vcl/source/gdi/pdfwriter_impl.cxx307
-rw-r--r--vcl/source/gdi/pdfwriter_impl.hxx11
-rw-r--r--vcl/source/gdi/pdfwriter_impl2.cxx511
-rw-r--r--vcl/source/gdi/print.cxx44
-rw-r--r--vcl/source/gdi/print2.cxx35
-rwxr-xr-x[-rw-r--r--]vcl/source/gdi/region.cxx193
-rwxr-xr-xvcl/source/gdi/salgdilayout.cxx60
-rw-r--r--vcl/source/helper/xconnection.cxx77
-rw-r--r--vcl/source/src/print.src60
-rw-r--r--vcl/source/window/dlgctrl.cxx73
-rw-r--r--vcl/source/window/msgbox.cxx2
-rw-r--r--vcl/source/window/printdlg.cxx32
-rw-r--r--vcl/source/window/window.cxx151
-rw-r--r--vcl/unx/gtk/app/gtkdata.cxx6
-rw-r--r--vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx25
-rw-r--r--vcl/unx/headless/svpgdi.cxx50
-rw-r--r--vcl/unx/headless/svpgdi.hxx5
-rw-r--r--vcl/unx/headless/svppspgraphics.cxx36
-rw-r--r--vcl/unx/headless/svppspgraphics.hxx5
-rw-r--r--vcl/unx/inc/dtint.hxx2
-rw-r--r--vcl/unx/inc/plugins/gtk/gtkgdi.hxx5
-rw-r--r--vcl/unx/inc/pspgraphics.h5
-rw-r--r--vcl/unx/inc/salgdi.h8
-rw-r--r--vcl/unx/source/dtrans/X11_clipboard.hxx26
-rw-r--r--vcl/unx/source/dtrans/X11_dndcontext.hxx6
-rw-r--r--vcl/unx/source/dtrans/X11_selection.cxx68
-rw-r--r--vcl/unx/source/dtrans/X11_selection.hxx39
-rw-r--r--vcl/unx/source/dtrans/X11_service.cxx24
-rw-r--r--vcl/unx/source/dtrans/X11_transferable.hxx4
-rw-r--r--vcl/unx/source/fontmanager/fontmanager.cxx10
-rw-r--r--vcl/unx/source/gdi/pspgraphics.cxx36
-rw-r--r--vcl/unx/source/gdi/salgdi.cxx84
-rw-r--r--vcl/unx/source/gdi/salgdi2.cxx12
-rw-r--r--vcl/unx/source/gdi/salgdi3.cxx24
-rw-r--r--vcl/unx/source/gdi/salprnpsp.cxx2
-rwxr-xr-xvcl/win/inc/salgdi.h10
-rwxr-xr-x[-rw-r--r--]vcl/win/source/gdi/salgdi.cxx213
-rwxr-xr-x[-rw-r--r--]vcl/win/source/gdi/salgdi2.cxx3
-rwxr-xr-x[-rw-r--r--]vcl/win/source/gdi/salprn.cxx9
-rwxr-xr-xvcl/win/source/window/salframe.cxx7
-rw-r--r--wizards/prj/build.lst2
-rw-r--r--xmloff/Library_xo.mk2
-rw-r--r--xmloff/inc/SchXMLImport.hxx8
-rw-r--r--xmloff/inc/xmloff/SchXMLImportHelper.hxx2
-rw-r--r--xmloff/inc/xmloff/xmltoken.hxx6
-rw-r--r--xmloff/source/chart/SchXMLChartContext.cxx128
-rw-r--r--xmloff/source/chart/SchXMLChartContext.hxx15
-rwxr-xr-xxmloff/source/chart/SchXMLEnumConverter.cxx104
-rwxr-xr-x[-rw-r--r--]xmloff/source/chart/SchXMLEnumConverter.hxx (renamed from sc/source/ui/dbgui/pvglob.hxx)17
-rw-r--r--xmloff/source/chart/SchXMLExport.cxx89
-rw-r--r--xmloff/source/chart/SchXMLImport.cxx22
-rwxr-xr-xxmloff/source/chart/SchXMLLegendContext.cxx229
-rwxr-xr-x[-rw-r--r--]xmloff/source/chart/SchXMLLegendContext.hxx (renamed from offapi/com/sun/star/awt/grid/XGridControlListener.idl)29
-rw-r--r--xmloff/source/chart/makefile.mk2
-rw-r--r--xmloff/source/core/xmltoken.cxx6
-rw-r--r--xmlsecurity/prj/build.lst2
1011 files changed, 32637 insertions, 28154 deletions
diff --git a/Module_ooo.mk b/Module_ooo.mk
index b2605d0b909a..307daf7c4b00 100644
--- a/Module_ooo.mk
+++ b/Module_ooo.mk
@@ -31,6 +31,7 @@ $(eval $(call gb_Module_add_moduledirs,ooo,\
comphelper \
editeng \
framework \
+ padmin \
sfx2 \
sot \
svl \
diff --git a/Repository.mk b/Repository.mk
index cc14cc00b6eb..87bbafa59baf 100644
--- a/Repository.mk
+++ b/Repository.mk
@@ -38,6 +38,10 @@ $(eval $(call gb_Helper_register_executables,NONE, \
sspretty \
))
+$(eval $(call gb_Helper_register_executables,OOO, \
+ spadmin.bin \
+))
+
$(eval $(call gb_Helper_register_libraries,OOOLIBS, \
avmedia \
basegfx \
@@ -59,6 +63,7 @@ $(eval $(call gb_Helper_register_libraries,OOOLIBS, \
sb \
sfx \
sot \
+ spa \
svl \
svt \
svx \
@@ -124,6 +129,7 @@ $(eval $(call gb_Helper_register_static_libraries,PLAINLIBS, \
jpeglib \
ooopathutils \
salcpprt \
+ vclmain \
zlib \
vclmain \
))
diff --git a/accessibility/inc/accessibility/standard/vclxaccessiblelistboxlist.hxx b/accessibility/inc/accessibility/standard/vclxaccessiblelistboxlist.hxx
deleted file mode 100644
index 829a4337e878..000000000000
--- a/accessibility/inc/accessibility/standard/vclxaccessiblelistboxlist.hxx
+++ /dev/null
@@ -1,112 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef ACCESSIBILITY_STANDARD_VCLXACCESSIBLELISTBOXLIST_HXX
-#define ACCESSIBILITY_STANDARD_VCLXACCESSIBLELISTBOXLIST_HXX
-
-#include <accessibility/standard/vclxaccessiblelist.hxx>
-#include <com/sun/star/accessibility/XAccessibleAction.hpp>
-#include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
-#ifndef _COMPHELPER_BROADCASTHELPER_HXX
-#include <comphelper/broadcasthelper.hxx>
-#endif
-#ifndef _COMPHELPER_UNO3_HXX
-#include <comphelper/uno3.hxx>
-#endif
-#ifndef _CPPUHELPER_IMPLBASE1_HXX
-#include <cppuhelper/implbase1.hxx>
-#endif
-
-typedef ::cppu::ImplHelper1 < ::com::sun::star::accessibility::XAccessibleSelection
- > VCLXAccessibleListBoxList_BASE;
-
-
-class ListBox;
-/** This class extends the list of the <type>VCLXAccessibleList</type> class
- about selection.
-*/
-class VCLXAccessibleListBoxList :
- public VCLXAccessibleList,
- public VCLXAccessibleListBoxList_BASE
-{
-public:
- VCLXAccessibleListBoxList (VCLXWindow* pVCLXindow, BoxType aBoxType,
- const ::com::sun::star::uno::Reference<
- ::com::sun::star::accessibility::XAccessible >& _xParent);
-
- // XInterface
- DECLARE_XINTERFACE( )
-
- // XTypeProvider
- DECLARE_XTYPEPROVIDER( )
-
- // XServiceInfo
- virtual ::rtl::OUString SAL_CALL getImplementationName (void)
- throw (::com::sun::star::uno::RuntimeException);
- // Return list box list specific services.
- virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL
- getSupportedServiceNames (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);
-
- /** 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);
-
-
-protected:
- virtual ~VCLXAccessibleListBoxList (void);
-
- virtual void ProcessWindowEvent (const VclWindowEvent& rVclWindowEvent);
-
-private:
- sal_Int32 m_nLastTopEntry;
- sal_uInt16 m_nLastSelectedPos;
- bool m_bDisableProcessEvent;
-
- void UpdateEntryRange_Impl (void);
- using VCLXAccessibleList::UpdateSelection_Impl;
- void UpdateSelection_Impl (void);
- using VCLXAccessibleList::checkEntrySelected;
- sal_Bool checkEntrySelected(ListBox* _pListBox,
- sal_uInt16 _nPos,
- ::com::sun::star::uno::Any& _rNewValue,
- ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _rxNewAcc);
-};
-
-#endif // ACCESSIBILITY_STANDARD_VCLXACCESSIBLELISTBOX_HXX
-
diff --git a/accessibility/prj/build.lst b/accessibility/prj/build.lst
index 4fbfe135137f..c9a8c345e056 100755
--- a/accessibility/prj/build.lst
+++ b/accessibility/prj/build.lst
@@ -1,4 +1,4 @@
-ac accessibility : l10n tools jurt offuh unoil vcl javaunohelper jvmaccess cppu sal toolkit svtools LIBXSLT:libxslt NULL
+ac accessibility : L10N:l10n tools jurt offuh unoil vcl javaunohelper jvmaccess cppu sal toolkit svtools LIBXSLT:libxslt NULL
ac accessibility usr1 - all ac_mkout NULL
ac accessibility\inc nmake - all ac_inc NULL
ac accessibility\bridge\org\openoffice\java\accessibility nmake - w ac_ooja ac_inc NULL
diff --git a/accessibility/source/extended/AccessibleGridControlTable.cxx b/accessibility/source/extended/AccessibleGridControlTable.cxx
index 461e776f1392..406baeb2973c 100755
--- a/accessibility/source/extended/AccessibleGridControlTable.cxx
+++ b/accessibility/source/extended/AccessibleGridControlTable.cxx
@@ -245,8 +245,7 @@ void SAL_CALL AccessibleGridControlTable::selectAccessibleChild( sal_Int32 nChil
ensureIsValidIndex( nChildIndex );
sal_Int32 nColumns = m_aTable.GetColumnCount();
sal_Int32 nRow = (nChildIndex / nColumns);
- std::vector< sal_Int32 > selectedRows = m_aTable.GetSelectedRows();
- selectedRows.push_back(nRow);
+ m_aTable.SelectRow( nRow, sal_True );
}
sal_Bool SAL_CALL AccessibleGridControlTable::isAccessibleChildSelected( sal_Int32 nChildIndex )
throw ( lang::IndexOutOfBoundsException, uno::RuntimeException )
@@ -265,8 +264,7 @@ void SAL_CALL AccessibleGridControlTable::clearAccessibleSelection()
TCSolarGuard aSolarGuard;
::osl::MutexGuard aGuard( getOslMutex() );
ensureIsAlive();
- for(unsigned int i=0;i<m_aTable.GetSelectedRows().size();i++)
- m_aTable.RemoveSelectedRow((sal_Int32)i);
+ m_aTable.SelectAllRows( false );
}
void SAL_CALL AccessibleGridControlTable::selectAllAccessibleChildren()
throw ( uno::RuntimeException )
diff --git a/accessibility/source/extended/AccessibleGridControlTableBase.cxx b/accessibility/source/extended/AccessibleGridControlTableBase.cxx
index f6d1147ad309..d97feb1277ec 100755..100644
--- a/accessibility/source/extended/AccessibleGridControlTableBase.cxx
+++ b/accessibility/source/extended/AccessibleGridControlTableBase.cxx
@@ -245,7 +245,10 @@ sal_Int32 AccessibleGridControlTableBase::implGetChildIndex(
void AccessibleGridControlTableBase::implGetSelectedRows( Sequence< sal_Int32 >& rSeq )
{
- rSeq = comphelper::containerToSequence(m_aTable.GetSelectedRows());
+ sal_Int32 const selectionCount( m_aTable.GetSelectedRowCount() );
+ rSeq.realloc( selectionCount );
+ for ( sal_Int32 i=0; i<selectionCount; ++i )
+ rSeq[i] = m_aTable.GetSelectedRowIndex(i);
}
void AccessibleGridControlTableBase::ensureIsValidRow( sal_Int32 nRow )
diff --git a/accessibility/source/standard/vclxaccessiblebox.cxx b/accessibility/source/standard/vclxaccessiblebox.cxx
index 784588938bb8..86b98768736a 100644
--- a/accessibility/source/standard/vclxaccessiblebox.cxx
+++ b/accessibility/source/standard/vclxaccessiblebox.cxx
@@ -31,7 +31,6 @@
#include <accessibility/standard/vclxaccessibletextfield.hxx>
#include <accessibility/standard/vclxaccessibleedit.hxx>
#include <accessibility/standard/vclxaccessiblelist.hxx>
-#include <accessibility/standard/vclxaccessiblelistboxlist.hxx>
#include <accessibility/helper/listboxhelper.hxx>
#include <unotools/accessiblestatesethelper.hxx>
diff --git a/automation/source/server/statemnt.cxx b/automation/source/server/statemnt.cxx
index 4b40f39a1d77..8b7a57bb4a47 100644
--- a/automation/source/server/statemnt.cxx
+++ b/automation/source/server/statemnt.cxx
@@ -82,6 +82,7 @@
#include <svtools/valueset.hxx>
#include <svtools/roadmap.hxx>
#include <svtools/table/tablecontrol.hxx>
+#include <svtools/table/tablecontrolinterface.hxx>
#include <svl/poolitem.hxx>
#include <svtools/extensionlistbox.hxx>
// Hat keinen Includeschutz
@@ -6111,7 +6112,8 @@ protected:
ValueOK( aUId, MethodString( nMethodId ), nNr2, pTC->GetRowCount() ))
{
::svt::table::PTableModel pModel = pTC->GetModel();
- Any aCell = pModel->getCellContent()[nNr2-1][nNr1-1];
+ Any aCell;
+ pModel->getCellContent( nNr1-1, nNr2-1, aCell );
pRet->GenReturn ( RET_Value, aUId, String( aCell.getValueTypeName() ));
}
}
@@ -6122,7 +6124,8 @@ protected:
ValueOK( aUId, MethodString( nMethodId ), nNr2, pTC->GetRowCount() ))
{
::svt::table::PTableModel pModel = pTC->GetModel();
- Any aCell = pModel->getCellContent()[nNr2-1][nNr1-1];
+ Any aCell;
+ pModel->getCellContent( nNr1-1, nNr2-1, aCell );
/* doesn't work ATM since it gets casted to SbxDATE in VCLTestTool unfortunately
SbxVariableRef xRes = new SbxVariable( SbxVARIANT );
unoToSbxValue( xRes, aCell );
@@ -6206,7 +6209,7 @@ protected:
Point aPos( aSize.Width() / 2, aSize.Height() / 2 );
long nStep = aSize.Height() / 4;
::svt::table::RowPos nLastPos;
- while ( ( nLastPos = pTC->GetCurrentRow( aPos ) ) != nNr1-1 && nStep > 0 )
+ while ( ( nLastPos = pTC->getTableControlInterface().hitTest( aPos ).nRow ) != nNr1-1 && nStep > 0 )
{
if ( nLastPos > nNr1-1 || nLastPos == ROW_INVALID )
aPos.Y() -= nStep;
@@ -6214,7 +6217,7 @@ protected:
aPos.Y() += nStep;
nStep /= 2;
}
- if ( pTC->GetCurrentRow( aPos ) == nNr1-1 )
+ if ( pTC->getTableControlInterface().hitTest( aPos ).nRow == nNr1-1 )
{
MouseEvent aMEvnt(aPos,1,MOUSE_SIMPLECLICK|MOUSE_SELECT,MOUSE_LEFT,KEY_MOD1);
pTC->getSelEngine()->SelMouseButtonDown( aMEvnt );
@@ -6231,13 +6234,13 @@ protected:
}
break;
case M_GetSelCount :
- pRet->GenReturn ( RET_Value, aUId, comm_USHORT( pTC->GetSelectedRows().size() ));
+ pRet->GenReturn ( RET_Value, aUId, comm_USHORT( pTC->GetSelectedRowCount() ));
break;
case M_GetSelIndex :
if ( ! (nParams & PARAM_USHORT_1) )
nNr1 = 1;
- if ( ValueOK( aUId, CUniString("GetSelIndex"), nNr1, pTC->GetSelectedRows().size() ) )
- pRet->GenReturn ( RET_Value, aUId, comm_USHORT( pTC->GetSelectedRows()[nNr1-1] +1 ) );
+ if ( ValueOK( aUId, CUniString("GetSelIndex"), nNr1, pTC->GetSelectedRowCount() ) )
+ pRet->GenReturn ( RET_Value, aUId, comm_USHORT( pTC->GetSelectedRowIndex( nNr1-1 ) +1 ) );
break;
/* case M_GetSelText :
if ( ! (nParams & PARAM_USHORT_1) )
diff --git a/avmedia/prj/build.lst b/avmedia/prj/build.lst
index 2348b606dcab..7d9343b916fd 100644
--- a/avmedia/prj/build.lst
+++ b/avmedia/prj/build.lst
@@ -1,4 +1,4 @@
-av avmedia : l10n tools sfx2 LIBXSLT:libxslt NULL
+av avmedia : L10N:l10n tools sfx2 LIBXSLT:libxslt NULL
av avmedia usr1 - all av_mkout NULL
av avmedia\prj get - all av_prj NULL
av avmedia\inc get - all av_inv NULL
diff --git a/basctl/prj/build.lst b/basctl/prj/build.lst
index 0c5283ff0aec..1f92577d2eae 100644
--- a/basctl/prj/build.lst
+++ b/basctl/prj/build.lst
@@ -1,4 +1,4 @@
-bc basctl : LIBXSLT:libxslt l10n svx NULL
+bc basctl : LIBXSLT:libxslt L10N:l10n svx NULL
bc basctl usr1 - all bc_mkout NULL
bc basctl\inc nmake - all bc_inc NULL
bc basctl\source\inc get - all bc_sinc NULL
diff --git a/basctl/source/basicide/baside2b.cxx b/basctl/source/basicide/baside2b.cxx
index 8dcad1f5608b..25aa457cfcc2 100644
--- a/basctl/source/basicide/baside2b.cxx
+++ b/basctl/source/basicide/baside2b.cxx
@@ -1183,6 +1183,9 @@ WatchWindow::WatchWindow( Window* pParent ) :
| 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;
@@ -1521,7 +1524,8 @@ StackWindow::StackWindow( Window* pParent ) :
aGotoCallButton( this, IDEResId( RID_IMGBTN_GOTOCALL ) ),
aStackStr( IDEResId( RID_STR_STACK ) )
{
- aTreeListBox.SetHelpId(HID_BASICIDE_STACKWINDOW_LIST);
+ aTreeListBox.SetHelpId(HID_BASICIDE_STACKWINDOW_LIST);
+ aTreeListBox.SetAccessibleName(String( IDEResId(RID_STR_STACKNAME)));
aTreeListBox.SetPosPixel( Point( DWBORDER, nVirtToolBoxHeight ) );
aTreeListBox.SetHighlightRange();
aTreeListBox.SetSelectionMode( NO_SELECTION );
diff --git a/basctl/source/basicide/moduldl2.cxx b/basctl/source/basicide/moduldl2.cxx
index 4d6bfa923f37..b6fef1100e4e 100644
--- a/basctl/source/basicide/moduldl2.cxx
+++ b/basctl/source/basicide/moduldl2.cxx
@@ -498,9 +498,9 @@ LibPage::LibPage( Window * pParent )
,aEditButton( this, IDEResId( RID_PB_EDIT ) )
,aCloseButton( this, IDEResId( RID_PB_CLOSE ) )
,aPasswordButton( this, IDEResId( RID_PB_PASSWORD ) )
- ,aExportButton( this, IDEResId( RID_PB_EXPORT ) )
,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 )
diff --git a/basctl/source/basicide/moduldlg.hxx b/basctl/source/basicide/moduldlg.hxx
index 93263b020453..7152e699da3b 100644
--- a/basctl/source/basicide/moduldlg.hxx
+++ b/basctl/source/basicide/moduldlg.hxx
@@ -229,9 +229,9 @@ protected:
PushButton aEditButton;
CancelButton aCloseButton;
PushButton aPasswordButton;
- PushButton aExportButton;
PushButton aNewLibButton;
PushButton aInsertLibButton;
+ PushButton aExportButton;
PushButton aDelButton;
ScriptDocument m_aCurDocument;
diff --git a/basctl/source/basicide/objdlg.cxx b/basctl/source/basicide/objdlg.cxx
index 9b9006953411..fbd1c8262669 100644
--- a/basctl/source/basicide/objdlg.cxx
+++ b/basctl/source/basicide/objdlg.cxx
@@ -108,8 +108,10 @@ ObjectCatalog::ObjectCatalog( Window * pParent )
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();
diff --git a/basctl/source/basicide/objdlg.hrc b/basctl/source/basicide/objdlg.hrc
index 930ab31a4ae8..a090d45fc6e9 100644
--- a/basctl/source/basicide/objdlg.hrc
+++ b/basctl/source/basicide/objdlg.hrc
@@ -37,4 +37,6 @@
#define TBITEM_SHOW 1
+#define RID_STR_TLB_MACROS ( RID_BASICIDE_START + 71 )
+
#endif // _OBJDLG_HXX
diff --git a/basctl/source/basicide/objdlg.src b/basctl/source/basicide/objdlg.src
index 2d7981dd1c28..1331be5a992c 100644
--- a/basctl/source/basicide/objdlg.src
+++ b/basctl/source/basicide/objdlg.src
@@ -92,3 +92,9 @@ FloatingWindow RID_BASICIDE_OBJCAT
Size = MAP_APPFONT ( 185 , 18 ) ;
};
};
+
+String RID_STR_TLB_MACROS
+{
+ Text [ en-US ] = "Objects Tree";
+};
+
diff --git a/basic/inc/basic/sbstar.hxx b/basic/inc/basic/sbstar.hxx
index 9eeee5f71d7c..5b00fe68a421 100644
--- a/basic/inc/basic/sbstar.hxx
+++ b/basic/inc/basic/sbstar.hxx
@@ -48,6 +48,7 @@ class BasicLibInfo; // info block for basic manager
class SbTextPortions;
class SbMethod;
class BasicManager;
+class DocBasicItem;
class StarBASICImpl;
@@ -57,6 +58,7 @@ class StarBASIC : public SbxObject
friend class SbiExpression; // Access to RTL
friend class SbiInstance;
friend class SbiRuntime;
+ friend class DocBasicItem;
StarBASICImpl* mpStarBASICImpl;
diff --git a/basic/inc/basic/vbahelper.hxx b/basic/inc/basic/vbahelper.hxx
new file mode 100755
index 000000000000..0d99387965fe
--- /dev/null
+++ b/basic/inc/basic/vbahelper.hxx
@@ -0,0 +1,86 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef BASIC_VBAHELPR_HXX
+#define BASIC_VBAHELPR_HXX
+
+#include <com/sun/star/frame/XModel.hpp>
+
+namespace basic {
+namespace vba {
+
+/* This header contains public helper functions for VBA used from this module
+ and from other VBA implementation modules such as vbahelper.
+ */
+
+// ============================================================================
+
+/** Locks or unlocks the controllers of all documents that have the same type
+ as the specified document.
+
+ First, the global module manager (com.sun.star.frame.ModuleManager) is
+ asked for the type of the passed model, and all open documents with the
+ same type will be locked or unlocked.
+
+ @param rxModel
+ A document model determining the type of the documents to be locked or
+ unlocked.
+
+ @param bLockControllers
+ Passing true will lock all controllers, passing false will unlock them.
+ */
+void lockControllersOfAllDocuments(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& rxModel,
+ sal_Bool bLockControllers );
+
+// ============================================================================
+
+/** Enables or disables the container windows of all controllers of all
+ documents that have the same type as the specified document.
+
+ First, the global module manager (com.sun.star.frame.ModuleManager) is
+ asked for the type of the passed model, and the container windows of all
+ open documents with the same type will be enabled or disabled.
+
+ @param rxModel
+ A document model determining the type of the documents to be enabled or
+ disabled.
+
+ @param bEnableWindows
+ Passing true will enable all container windows of all controllers,
+ passing false will disable them.
+ */
+void enableContainerWindowsOfAllDocuments(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& rxModel,
+ sal_Bool bEnableWindows );
+
+// ============================================================================
+
+} // namespace vba
+} // namespace basic
+
+#endif
diff --git a/basic/prj/build.lst b/basic/prj/build.lst
index 8eab007313ec..17a34fa5bd9f 100644
--- a/basic/prj/build.lst
+++ b/basic/prj/build.lst
@@ -1,4 +1,4 @@
-sb basic : l10n offuh oovbaapi svtools xmlscript framework salhelper LIBXSLT:libxslt NULL
+sb basic : L10N:l10n offuh oovbaapi svtools xmlscript framework salhelper LIBXSLT:libxslt NULL
sb basic usr1 - all sb_mkout NULL
sb basic\inc nmake - all sb_inc NULL
sb basic\source\app nmake - all sb_app sb_class sb_inc NULL
diff --git a/basic/source/basmgr/makefile.mk b/basic/source/basmgr/makefile.mk
index e08e9cc753bd..615a8e8465ef 100644
--- a/basic/source/basmgr/makefile.mk
+++ b/basic/source/basmgr/makefile.mk
@@ -39,7 +39,8 @@ ENABLE_EXCEPTIONS=TRUE
SLOFILES= \
$(SLO)$/basmgr.obj \
- $(SLO)$/basicmanagerrepository.obj
+ $(SLO)$/basicmanagerrepository.obj\
+ $(SLO)$/vbahelper.obj
# --- Targets -------------------------------------------------------------
diff --git a/basic/source/basmgr/vbahelper.cxx b/basic/source/basmgr/vbahelper.cxx
new file mode 100755
index 000000000000..a09446f2e40b
--- /dev/null
+++ b/basic/source/basmgr/vbahelper.cxx
@@ -0,0 +1,212 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_basic.hxx"
+
+#include "basic/vbahelper.hxx"
+#include <com/sun/star/container/XEnumeration.hpp>
+#include <com/sun/star/frame/XDesktop.hpp>
+#include <com/sun/star/frame/XModel2.hpp>
+#include <com/sun/star/frame/XModuleManager.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <comphelper/processfactory.hxx>
+
+namespace basic {
+namespace vba {
+
+using namespace ::com::sun::star;
+
+// ============================================================================
+
+namespace {
+
+/** Creates the global module manager needed to identify the type of documents.
+ */
+uno::Reference< frame::XModuleManager > lclCreateModuleManager()
+{
+ uno::Reference< frame::XModuleManager > xModuleManager;
+ try
+ {
+ uno::Reference< lang::XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory(), uno::UNO_SET_THROW );
+ xModuleManager.set( xFactory->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.ModuleManager" ) ) ), uno::UNO_QUERY );
+ }
+ catch( uno::Exception& )
+ {
+ }
+ OSL_ENSURE( xModuleManager.is(), "::basic::vba::lclCreateModuleManager - cannot create module manager" );
+ return xModuleManager;
+}
+
+// ----------------------------------------------------------------------------
+
+/** Returns the document service name of the specified document.
+ */
+::rtl::OUString lclIdentifyDocument( const uno::Reference< frame::XModuleManager >& rxModuleManager, const uno::Reference< frame::XModel >& rxModel )
+{
+ ::rtl::OUString aServiceName;
+ if( rxModuleManager.is() )
+ {
+ try
+ {
+ aServiceName = rxModuleManager->identify( rxModel );
+ }
+ catch( uno::Exception& )
+ {
+ }
+ OSL_ENSURE( aServiceName.getLength() > 0, "::basic::vba::lclIdentifyDocument - cannot identify document" );
+ }
+ return aServiceName;
+}
+
+// ----------------------------------------------------------------------------
+
+/** Returns an enumeration of all open documents.
+ */
+uno::Reference< container::XEnumeration > lclCreateDocumentEnumeration()
+{
+ uno::Reference< container::XEnumeration > xEnumeration;
+ try
+ {
+ uno::Reference< lang::XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory(), uno::UNO_SET_THROW );
+ uno::Reference< frame::XDesktop > xDesktop( xFactory->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.Desktop" ) ) ), uno::UNO_QUERY_THROW );
+ uno::Reference< container::XEnumerationAccess > xComponentsEA( xDesktop->getComponents(), uno::UNO_SET_THROW );
+ xEnumeration = xComponentsEA->createEnumeration();
+
+ }
+ catch( uno::Exception& )
+ {
+ }
+ OSL_ENSURE( xEnumeration.is(), "::basic::vba::lclCreateDocumentEnumeration - cannot create enumeration of all documents" );
+ return xEnumeration;
+}
+
+// ----------------------------------------------------------------------------
+
+/** Locks or unlocks the controllers of the specified document model.
+ */
+void lclLockControllers( const uno::Reference< frame::XModel >& rxModel, sal_Bool bLockControllers )
+{
+ if( rxModel.is() ) try
+ {
+ if( bLockControllers )
+ rxModel->lockControllers();
+ else
+ rxModel->unlockControllers();
+ }
+ catch( uno::Exception& )
+ {
+ }
+}
+
+// ----------------------------------------------------------------------------
+
+/** Enables or disables the container windows of all controllers of the
+ specified document model.
+ */
+void lclEnableContainerWindows( const uno::Reference< frame::XModel >& rxModel, sal_Bool bEnableWindows )
+{
+ try
+ {
+ uno::Reference< frame::XModel2 > xModel2( rxModel, uno::UNO_QUERY_THROW );
+ uno::Reference< container::XEnumeration > xControllersEnum( xModel2->getControllers(), uno::UNO_SET_THROW );
+ // iterate over all controllers
+ while( xControllersEnum->hasMoreElements() )
+ {
+ try
+ {
+ uno::Reference< frame::XController > xController( xControllersEnum->nextElement(), uno::UNO_QUERY_THROW );
+ uno::Reference< frame::XFrame > xFrame( xController->getFrame(), uno::UNO_SET_THROW );
+ uno::Reference< awt::XWindow > xWindow( xFrame->getContainerWindow(), uno::UNO_SET_THROW );
+ xWindow->setEnable( bEnableWindows );
+ }
+ catch( uno::Exception& )
+ {
+ }
+ }
+ }
+ catch( uno::Exception& )
+ {
+ }
+}
+
+// ----------------------------------------------------------------------------
+
+typedef void (*ModifyDocumentFunc)( const uno::Reference< frame::XModel >&, sal_Bool );
+
+/** Implementation iterating over all documents that have the same type as the
+ specified model, and calling the passed functor.
+ */
+void lclIterateDocuments( ModifyDocumentFunc pModifyDocumentFunc, const uno::Reference< frame::XModel >& rxModel, sal_Bool bModificator )
+{
+ uno::Reference< frame::XModuleManager > xModuleManager = lclCreateModuleManager();
+ uno::Reference< container::XEnumeration > xDocumentsEnum = lclCreateDocumentEnumeration();
+ ::rtl::OUString aIdentifier = lclIdentifyDocument( xModuleManager, rxModel );
+ if( xModuleManager.is() && xDocumentsEnum.is() && (aIdentifier.getLength() > 0) )
+ {
+ // iterate over all open documents
+ while( xDocumentsEnum->hasMoreElements() )
+ {
+ try
+ {
+ uno::Reference< frame::XModel > xCurrModel( xDocumentsEnum->nextElement(), uno::UNO_QUERY_THROW );
+ ::rtl::OUString aCurrIdentifier = lclIdentifyDocument( xModuleManager, xCurrModel );
+ if( aCurrIdentifier == aIdentifier )
+ pModifyDocumentFunc( xCurrModel, bModificator );
+ }
+ catch( uno::Exception& )
+ {
+ }
+ }
+ }
+ else
+ {
+ // no module manager, no documents enumeration, no identifier -> at least process the passed document
+ pModifyDocumentFunc( rxModel, bModificator );
+ }
+}
+
+} // namespace
+
+// ============================================================================
+
+void lockControllersOfAllDocuments( const uno::Reference< frame::XModel >& rxModel, sal_Bool bLockControllers )
+{
+ lclIterateDocuments( &lclLockControllers, rxModel, bLockControllers );
+}
+
+// ============================================================================
+
+void enableContainerWindowsOfAllDocuments( const uno::Reference< frame::XModel >& rxModel, sal_Bool bEnableWindows )
+{
+ lclIterateDocuments( &lclEnableContainerWindows, rxModel, bEnableWindows );
+}
+
+// ============================================================================
+
+} // namespace vba
+} // namespace basic
diff --git a/basic/source/classes/sb.cxx b/basic/source/classes/sb.cxx
index e2f53dd8ed8e..f8ffa46d48a5 100644
--- a/basic/source/classes/sb.cxx
+++ b/basic/source/classes/sb.cxx
@@ -55,8 +55,12 @@
#include "sb.hrc"
#include <basrid.hxx>
#include <vos/mutex.hxx>
+#include <cppuhelper/implbase1.hxx>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/util/XCloseBroadcaster.hpp>
+#include <com/sun/star/util/XCloseListener.hpp>
#include "errobject.hxx"
+#include <map>
#include <hash_map>
#include <com/sun/star/script/ModuleType.hpp>
@@ -80,6 +84,143 @@ using com::sun::star::lang::XMultiServiceFactory;
const static String aThisComponent( RTL_CONSTASCII_USTRINGPARAM("ThisComponent") );
const static String aVBAHook( RTL_CONSTASCII_USTRINGPARAM( "VBAGlobals" ) );
+// ============================================================================
+
+class DocBasicItem : public ::cppu::WeakImplHelper1< util::XCloseListener >
+{
+public:
+ explicit DocBasicItem( StarBASIC& rDocBasic );
+ virtual ~DocBasicItem();
+
+ inline const SbxObjectRef& getClassModules() const { return mxClassModules; }
+ inline bool isDocClosed() const { return mbDocClosed; }
+
+ void clearDependingVarsOnDelete( StarBASIC& rDeletedBasic );
+
+ void startListening();
+ void stopListening();
+
+ virtual void SAL_CALL queryClosing( const lang::EventObject& rSource, sal_Bool bGetsOwnership ) throw (util::CloseVetoException, uno::RuntimeException);
+ virtual void SAL_CALL notifyClosing( const lang::EventObject& rSource ) throw (uno::RuntimeException);
+ virtual void SAL_CALL disposing( const lang::EventObject& rSource ) throw (uno::RuntimeException);
+
+private:
+ StarBASIC& mrDocBasic;
+ SbxObjectRef mxClassModules;
+ bool mbDocClosed;
+ bool mbDisposed;
+};
+
+// ----------------------------------------------------------------------------
+
+DocBasicItem::DocBasicItem( StarBASIC& rDocBasic ) :
+ mrDocBasic( rDocBasic ),
+ mxClassModules( new SbxObject( String() ) ),
+ mbDocClosed( false ),
+ mbDisposed( false )
+{
+}
+
+DocBasicItem::~DocBasicItem()
+{
+ stopListening();
+}
+
+void DocBasicItem::clearDependingVarsOnDelete( StarBASIC& rDeletedBasic )
+{
+ mrDocBasic.implClearDependingVarsOnDelete( &rDeletedBasic );
+}
+
+void DocBasicItem::startListening()
+{
+ Any aThisComp;
+ mrDocBasic.GetUNOConstant( "ThisComponent", aThisComp );
+ Reference< util::XCloseBroadcaster > xCloseBC( aThisComp, UNO_QUERY );
+ if( xCloseBC.is() )
+ try { xCloseBC->addCloseListener( this ); } catch( uno::Exception& ) {}
+}
+
+void DocBasicItem::stopListening()
+{
+ if( mbDisposed ) return;
+ mbDisposed = true;
+ Any aThisComp;
+ mrDocBasic.GetUNOConstant( "ThisComponent", aThisComp );
+ Reference< util::XCloseBroadcaster > xCloseBC( aThisComp, UNO_QUERY );
+ if( xCloseBC.is() )
+ try { xCloseBC->removeCloseListener( this ); } catch( uno::Exception& ) {}
+}
+
+void SAL_CALL DocBasicItem::queryClosing( const lang::EventObject& /*rSource*/, sal_Bool /*bGetsOwnership*/ ) throw (util::CloseVetoException, uno::RuntimeException)
+{
+}
+
+void SAL_CALL DocBasicItem::notifyClosing( const lang::EventObject& /*rEvent*/ ) throw (uno::RuntimeException)
+{
+ stopListening();
+ mbDocClosed = true;
+}
+
+void SAL_CALL DocBasicItem::disposing( const lang::EventObject& /*rEvent*/ ) throw (uno::RuntimeException)
+{
+ stopListening();
+}
+
+// ----------------------------------------------------------------------------
+
+namespace {
+
+typedef ::rtl::Reference< DocBasicItem > DocBasicItemRef;
+typedef std::map< const StarBASIC*, DocBasicItemRef > DocBasicItemMap;
+static DocBasicItemMap GaDocBasicItems;
+
+const DocBasicItem* lclFindDocBasicItem( const StarBASIC* pDocBasic )
+{
+ DocBasicItemMap::iterator it = GaDocBasicItems.find( pDocBasic );
+ return (it != GaDocBasicItems.end()) ? it->second.get() : 0;
+}
+
+void lclInsertDocBasicItem( StarBASIC& rDocBasic )
+{
+ DocBasicItemRef& rxDocBasicItem = GaDocBasicItems[ &rDocBasic ];
+ rxDocBasicItem.set( new DocBasicItem( rDocBasic ) );
+ rxDocBasicItem->startListening();
+}
+
+void lclRemoveDocBasicItem( StarBASIC& rDocBasic )
+{
+ DocBasicItemMap::iterator it = GaDocBasicItems.find( &rDocBasic );
+ if( it != GaDocBasicItems.end() )
+ {
+ it->second->stopListening();
+ GaDocBasicItems.erase( it );
+ }
+ DocBasicItemMap::iterator it_end = GaDocBasicItems.end();
+ for( it = GaDocBasicItems.begin(); it != it_end; ++it )
+ it->second->clearDependingVarsOnDelete( rDocBasic );
+}
+
+StarBASIC* lclGetDocBasicForModule( SbModule* pModule )
+{
+ StarBASIC* pRetBasic = NULL;
+ SbxObject* pCurParent = pModule;
+ while( pCurParent->GetParent() != NULL )
+ {
+ pCurParent = pCurParent->GetParent();
+ StarBASIC* pDocBasic = PTR_CAST( StarBASIC, pCurParent );
+ if( pDocBasic != NULL && pDocBasic->IsDocBasic() )
+ {
+ pRetBasic = pDocBasic;
+ break;
+ }
+ }
+ return pRetBasic;
+}
+
+} // namespace
+
+// ============================================================================
+
SbxObject* StarBASIC::getVBAGlobals( )
{
if ( !pVBAGlobals )
@@ -461,6 +602,7 @@ SbxObject* createUserTypeImpl( const String& rClassName )
return pRetObj;
}
+
TYPEINIT1(SbClassModuleObject,SbModule)
SbClassModuleObject::SbClassModuleObject( SbModule* pClassModule )
@@ -610,8 +752,12 @@ SbClassModuleObject::SbClassModuleObject( SbModule* pClassModule )
SbClassModuleObject::~SbClassModuleObject()
{
+ // do not trigger termination event when document is already closed
if( StarBASIC::IsRunning() )
- triggerTerminateEvent();
+ if( StarBASIC* pDocBasic = lclGetDocBasicForModule( this ) )
+ if( const DocBasicItem* pDocBasicItem = lclFindDocBasicItem( pDocBasic ) )
+ if( !pDocBasicItem->isDocClosed() )
+ triggerTerminateEvent();
// Must be deleted by base class dtor because this data
// is not owned by the SbClassModuleObject object
@@ -699,8 +845,14 @@ SbClassFactory::~SbClassFactory()
void SbClassFactory::AddClassModule( SbModule* pClassModule )
{
+ SbxObjectRef xToUseClassModules = xClassModules;
+
+ if( StarBASIC* pDocBasic = lclGetDocBasicForModule( pClassModule ) )
+ if( const DocBasicItem* pDocBasicItem = lclFindDocBasicItem( pDocBasic ) )
+ xToUseClassModules = pDocBasicItem->getClassModules();
+
SbxObject* pParent = pClassModule->GetParent();
- xClassModules->Insert( pClassModule );
+ xToUseClassModules->Insert( pClassModule );
pClassModule->SetParent( pParent );
}
@@ -717,12 +869,19 @@ SbxBase* SbClassFactory::Create( sal_uInt16, sal_uInt32 )
SbxObject* SbClassFactory::CreateObject( const String& rClassName )
{
- SbxVariable* pVar = xClassModules->Find( rClassName, SbxCLASS_DONTCARE );
+ SbxObjectRef xToUseClassModules = xClassModules;
+
+ if( SbModule* pMod = pMOD )
+ if( StarBASIC* pDocBasic = lclGetDocBasicForModule( pMod ) )
+ if( const DocBasicItem* pDocBasicItem = lclFindDocBasicItem( pDocBasic ) )
+ xToUseClassModules = pDocBasicItem->getClassModules();
+
+ SbxVariable* pVar = xToUseClassModules->Find( rClassName, SbxCLASS_OBJECT );
SbxObject* pRet = NULL;
if( pVar )
{
- SbModule* pMod = (SbModule*)pVar;
- pRet = new SbClassModuleObject( pMod );
+ SbModule* pVarMod = (SbModule*)pVar;
+ pRet = new SbClassModuleObject( pVarMod );
}
return pRet;
}
@@ -734,9 +893,6 @@ SbModule* SbClassFactory::FindClass( const String& rClassName )
return pMod;
}
-typedef std::vector< StarBASIC* > DocBasicVector;
-static DocBasicVector GaDocBasics;
-
StarBASIC::StarBASIC( StarBASIC* p, sal_Bool bIsDocBasic )
: SbxObject( String( RTL_CONSTASCII_USTRINGPARAM("StarBASIC") ) ), bDocBasic( bIsDocBasic )
{
@@ -768,7 +924,7 @@ StarBASIC::StarBASIC( StarBASIC* p, sal_Bool bIsDocBasic )
bQuit = sal_False;
if( bDocBasic )
- GaDocBasics.push_back( this );
+ lclInsertDocBasicItem( *this );
}
// #51727 Override SetModified so that the modified state
@@ -780,6 +936,9 @@ void StarBASIC::SetModified( sal_Bool b )
StarBASIC::~StarBASIC()
{
+ // Needs to be first action as it can trigger events
+ disposeComVariablesForBasic( this );
+
if( !--GetSbData()->nInst )
{
RemoveFactory( pSBFAC );
@@ -812,20 +971,7 @@ StarBASIC::~StarBASIC()
{
SbxError eOld = SbxBase::GetError();
- DocBasicVector::iterator it;
- for( it = GaDocBasics.begin() ; it != GaDocBasics.end() ; ++it )
- {
- if( *it == this )
- {
- GaDocBasics.erase( it );
- break;
- }
- }
- for( it = GaDocBasics.begin() ; it != GaDocBasics.end() ; ++it )
- {
- StarBASIC* pBasic = *it;
- pBasic->implClearDependingVarsOnDelete( this );
- }
+ lclRemoveDocBasicItem( *this );
SbxBase::ResetError();
if( eOld != SbxERR_OK )
@@ -845,7 +991,6 @@ StarBASIC::~StarBASIC()
}
clearUnoMethodsForBasic( this );
- disposeComVariablesForBasic( this );
}
// Override new() operator, so that everyone can create a new instance
diff --git a/basic/source/classes/sbxmod.cxx b/basic/source/classes/sbxmod.cxx
index a268568a410d..592d69c514a0 100755
--- a/basic/source/classes/sbxmod.cxx
+++ b/basic/source/classes/sbxmod.cxx
@@ -54,11 +54,15 @@
#include <basic/basrdll.hxx>
#include <vos/mutex.hxx>
#include <basic/sbobjmod.hxx>
-#include <cppuhelper/implbase2.hxx>
+#include <basic/vbahelper.hxx>
+#include <cppuhelper/implbase3.hxx>
+#include <unotools/eventcfg.hxx>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/script/ModuleType.hpp>
#include <com/sun/star/script/vba/XVBACompatibility.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/document/XEventBroadcaster.hpp>
+#include <com/sun/star/document/XEventListener.hpp>
using namespace com::sun::star;
@@ -496,24 +500,18 @@ IMPL_LINK( AsyncQuitHandler, OnAsyncQuit, void*, /*pNull*/ )
return 0L;
}
-bool VBAUnlockControllers( StarBASIC* pBasic )
+void VBAUnlockDocuments( StarBASIC* pBasic )
{
- bool bRes = false;
if ( pBasic && pBasic->IsDocBasic() )
{
SbUnoObject* pGlobs = dynamic_cast< SbUnoObject* >( pBasic->Find( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ThisComponent" ) ), SbxCLASS_DONTCARE ) );
- if ( pGlobs ) try
- {
- uno::Reference< frame::XModel > xModel( pGlobs->getUnoAny(), uno::UNO_QUERY_THROW );
- if ( xModel->hasControllersLocked() )
- xModel->unlockControllers();
- bRes = true;
- }
- catch( uno::Exception& )
+ if ( pGlobs )
{
+ uno::Reference< frame::XModel > xModel( pGlobs->getUnoAny(), uno::UNO_QUERY );
+ ::basic::vba::lockControllersOfAllDocuments( xModel, sal_False );
+ ::basic::vba::enableContainerWindowsOfAllDocuments( xModel, sal_True );
}
}
- return bRes;
}
/////////////////////////////////////////////////////////////////////////////
@@ -1182,7 +1180,7 @@ sal_uInt16 SbModule::Run( SbMethod* pMeth )
// VBA always ensures screenupdating is enabled after completing
if ( mbVBACompat )
- VBAUnlockControllers( PTR_CAST( StarBASIC, GetParent() ) );
+ VBAUnlockDocuments( PTR_CAST( StarBASIC, GetParent() ) );
#ifdef DBG_TRACE_BASIC
dbg_DeInitTrace();
@@ -2162,22 +2160,27 @@ void SbObjModule::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
}
-typedef ::cppu::WeakImplHelper2< awt::XTopWindowListener, awt::XWindowListener > FormObjEventListener_BASE;
+typedef ::cppu::WeakImplHelper3<
+ awt::XTopWindowListener,
+ awt::XWindowListener,
+ document::XEventListener > FormObjEventListener_BASE;
class FormObjEventListenerImpl : public FormObjEventListener_BASE
{
SbUserFormModule* mpUserForm;
uno::Reference< lang::XComponent > mxComponent;
+ uno::Reference< frame::XModel > mxModel;
bool mbDisposed;
sal_Bool mbOpened;
sal_Bool mbActivated;
sal_Bool mbShowing;
- FormObjEventListenerImpl(); // not defined
+
FormObjEventListenerImpl(const FormObjEventListenerImpl&); // not defined
+ FormObjEventListenerImpl& operator=(const FormObjEventListenerImpl&); // not defined
public:
- FormObjEventListenerImpl( SbUserFormModule* pUserForm, const uno::Reference< lang::XComponent >& xComponent ) :
- mpUserForm( pUserForm ), mxComponent( xComponent) ,
+ FormObjEventListenerImpl( SbUserFormModule* pUserForm, const uno::Reference< lang::XComponent >& xComponent, const uno::Reference< frame::XModel >& xModel ) :
+ mpUserForm( pUserForm ), mxComponent( xComponent), mxModel( xModel ),
mbDisposed( false ), mbOpened( sal_False ), mbActivated( sal_False ), mbShowing( sal_False )
{
if ( mxComponent.is() )
@@ -2194,6 +2197,15 @@ public:
}
catch( uno::Exception& ) {}
}
+
+ if ( mxModel.is() )
+ {
+ try
+ {
+ uno::Reference< document::XEventBroadcaster >( mxModel, uno::UNO_QUERY_THROW )->addEventListener( this );
+ }
+ catch( uno::Exception& ) {}
+ }
}
virtual ~FormObjEventListenerImpl()
@@ -2220,6 +2232,16 @@ public:
catch( uno::Exception& ) {}
}
mxComponent.clear();
+
+ if ( mxModel.is() && !mbDisposed )
+ {
+ try
+ {
+ uno::Reference< document::XEventBroadcaster >( mxModel, uno::UNO_QUERY_THROW )->removeEventListener( this );
+ }
+ catch( uno::Exception& ) {}
+ }
+ mxModel.clear();
}
virtual void SAL_CALL windowOpened( const lang::EventObject& /*e*/ ) throw (uno::RuntimeException)
@@ -2327,13 +2349,25 @@ public:
{
}
+ virtual void SAL_CALL notifyEvent( const document::EventObject& rEvent ) throw (uno::RuntimeException)
+ {
+ // early dosposing on document event "OnUnload", to be sure Basic still exists when calling VBA "UserForm_Terminate"
+ if( rEvent.EventName == GlobalEventConfig::GetEventName( STR_EVENT_CLOSEDOC ) )
+ {
+ removeListener();
+ mbDisposed = true;
+ if ( mpUserForm )
+ mpUserForm->ResetApiObj(); // will trigger "UserForm_Terminate"
+ }
+ }
+
virtual void SAL_CALL disposing( const lang::EventObject& /*Source*/ ) throw (uno::RuntimeException)
{
OSL_TRACE("** Userform/Dialog disposing");
+ removeListener();
mbDisposed = true;
- mxComponent.clear();
if ( mpUserForm )
- mpUserForm->ResetApiObj();
+ mpUserForm->ResetApiObj( false ); // pass false (too late to trigger VBA events here)
}
};
@@ -2567,30 +2601,27 @@ void SbUserFormModule::InitObject()
aArgs[ 2 ] <<= m_xModel;
aArgs[ 3 ] <<= rtl::OUString( GetParent()->GetName() );
pDocObject = new SbUnoObject( GetName(), uno::makeAny( xVBAFactory->createInstanceWithArguments( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msforms.UserForm")), aArgs ) ) );
- uno::Reference< lang::XComponent > xComponent( aArgs[ 1 ], uno::UNO_QUERY_THROW );
+
+ uno::Reference< lang::XComponent > xComponent( m_xDialog, uno::UNO_QUERY_THROW );
// the dialog must be disposed at the end!
- if( xComponent.is() )
+ StarBASIC* pParentBasic = NULL;
+ SbxObject* pCurObject = this;
+ do
{
- StarBASIC* pParentBasic = NULL;
- SbxObject* pCurObject = this;
- do
- {
- SbxObject* pObjParent = pCurObject->GetParent();
- pParentBasic = PTR_CAST( StarBASIC, pObjParent );
- pCurObject = pObjParent;
- }
- while( pParentBasic == NULL && pCurObject != NULL );
-
- OSL_ASSERT( pParentBasic != NULL );
- registerComponentToBeDisposedForBasic( xComponent, pParentBasic );
+ SbxObject* pObjParent = pCurObject->GetParent();
+ pParentBasic = PTR_CAST( StarBASIC, pObjParent );
+ pCurObject = pObjParent;
}
+ while( pParentBasic == NULL && pCurObject != NULL );
+ OSL_ASSERT( pParentBasic != NULL );
+ registerComponentToBeDisposedForBasic( xComponent, pParentBasic );
- // remove old listener if it exists
- if ( m_DialogListener.get() )
+ // if old listener object exists, remove it from dialog and document model
+ if( m_DialogListener.is() )
m_DialogListener->removeListener();
- m_DialogListener = new FormObjEventListenerImpl( this, xComponent );
+ m_DialogListener.set( new FormObjEventListenerImpl( this, xComponent, m_xModel ) );
triggerInitializeEvent();
}
diff --git a/basic/source/comp/scanner.cxx b/basic/source/comp/scanner.cxx
index e518779b78d5..ad94bbe842c8 100644
--- a/basic/source/comp/scanner.cxx
+++ b/basic/source/comp/scanner.cxx
@@ -152,6 +152,16 @@ static SbxDataType GetSuffixType( sal_Unicode c )
// Returnwert ist sal_False bei EOF oder Fehlern
#define BUF_SIZE 80
+namespace {
+
+/** Returns true, if the passed character is a white space character. */
+inline bool lclIsWhitespace( sal_Unicode cChar )
+{
+ return (cChar == ' ') || (cChar == '\t') || (cChar == '\f');
+}
+
+} // namespace
+
sal_Bool SbiScanner::NextSym()
{
// Fuer den EOLN-Fall merken
@@ -177,7 +187,11 @@ sal_Bool SbiScanner::NextSym()
p2 += n;
while( ( n < nLen ) && ( *p2 != '\n' ) && ( *p2 != '\r' ) )
p2++, n++;
- aLine = aBuf.copy( nBufPos, n - nBufPos );
+ // #163944# ignore trailing whitespace
+ sal_Int32 nCopyEndPos = n;
+ while( (nBufPos < nCopyEndPos) && lclIsWhitespace( aBuf[ nCopyEndPos - 1 ] ) )
+ --nCopyEndPos;
+ aLine = aBuf.copy( nBufPos, nCopyEndPos - nBufPos );
if( n < nLen )
{
if( *p2 == '\r' && *( p2+1 ) == '\n' )
@@ -193,7 +207,7 @@ sal_Bool SbiScanner::NextSym()
}
// Leerstellen weg:
- while( *pLine && (( *pLine == ' ' ) || ( *pLine == '\t' ) || ( *pLine == '\f' )) )
+ while( lclIsWhitespace( *pLine ) )
pLine++, nCol++, bSpaces = sal_True;
nCol1 = nCol;
@@ -230,7 +244,7 @@ sal_Bool SbiScanner::NextSym()
{
const sal_Unicode* pTestLine = pLine;
short nTestCol = nCol;
- while( *pTestLine && (( *pTestLine == ' ' ) || ( *pTestLine == '\t' )) )
+ while( lclIsWhitespace( *pTestLine ) )
{
pTestLine++;
nTestCol++;
diff --git a/binaryurp/prj/build.lst b/binaryurp/prj/build.lst
new file mode 100644
index 000000000000..230b323f0a35
--- /dev/null
+++ b/binaryurp/prj/build.lst
@@ -0,0 +1,3 @@
+bu binaryurp : BOOST:boost LIBXSLT:libxslt cppu cppuhelper offuh sal salhelper stlport NULL
+bu binaryurp\source nmake - all bu_source NULL
+bu binaryurp\qa nmake - all bu_qa bu_source NULL
diff --git a/binaryurp/prj/d.lst b/binaryurp/prj/d.lst
new file mode 100644
index 000000000000..48ebd3be806f
--- /dev/null
+++ b/binaryurp/prj/d.lst
@@ -0,0 +1,4 @@
+..\%__SRC%\bin\binaryurp.uno.dll %_DEST%\bin%_EXT%\binaryurp.uno.dll
+..\%__SRC%\lib\binaryurp.uno.dylib %_DEST%\lib%_EXT%\binaryurp.uno.dylib
+..\%__SRC%\lib\binaryurp.uno.so %_DEST%\lib%_EXT%\binaryurp.uno.so
+..\%__SRC%\misc\binaryurp.component %_DEST%\xml%_EXT%\binaryurp.component
diff --git a/binaryurp/qa/makefile.mk b/binaryurp/qa/makefile.mk
new file mode 100644
index 000000000000..14b80c86cfaf
--- /dev/null
+++ b/binaryurp/qa/makefile.mk
@@ -0,0 +1,77 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2011 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#***********************************************************************/
+
+PRJ = ..
+PRJNAME = binaryurp
+TARGET = qa
+
+ENABLE_EXCEPTIONS = TRUE
+
+.INCLUDE: settings.mk
+
+CFLAGSCXX += $(CPPUNIT_CFLAGS)
+
+DLLPRE =
+
+SLOFILES = $(SLO)/test-cache.obj $(SLO)/test-unmarshal.obj
+
+SHL1IMPLIB = i$(SHL1TARGET)
+SHL1OBJS = $(SLO)/test-cache.obj
+SHL1RPATH = NONE
+SHL1STDLIBS = $(CPPUNITLIB) $(SALLIB)
+SHL1TARGET = test-cache
+SHL1VERSIONMAP = version.map
+DEF1NAME = $(SHL1TARGET)
+
+SHL2IMPLIB = i$(SHL2TARGET)
+SHL2OBJS = \
+ $(SLO)/test-unmarshal.obj \
+ $(SLO)/binaryany.obj \
+ $(SLO)/bridge.obj \
+ $(SLO)/bridgefactory.obj \
+ $(SLO)/currentcontext.obj \
+ $(SLO)/incomingrequest.obj \
+ $(SLO)/lessoperators.obj \
+ $(SLO)/marshal.obj \
+ $(SLO)/outgoingrequests.obj \
+ $(SLO)/proxy.obj \
+ $(SLO)/reader.obj \
+ $(SLO)/unmarshal.obj \
+ $(SLO)/writer.obj
+SHL2RPATH = NONE
+SHL2STDLIBS = \
+ $(CPPUHELPERLIB) \
+ $(CPPULIB) \
+ $(CPPUNITLIB) \
+ $(SALHELPERLIB) \
+ $(SALLIB)
+SHL2TARGET = test-unmarshal
+SHL2VERSIONMAP = version.map
+DEF2NAME = $(SHL2TARGET)
+
+.INCLUDE: target.mk
+.INCLUDE: _cppunit.mk
diff --git a/binaryurp/qa/test-cache.cxx b/binaryurp/qa/test-cache.cxx
new file mode 100644
index 000000000000..f9a3946c0df9
--- /dev/null
+++ b/binaryurp/qa/test-cache.cxx
@@ -0,0 +1,84 @@
+/*************************************************************************
+*
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2000, 2011 Oracle and/or its affiliates.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+*
+************************************************************************/
+
+#include "sal/config.h"
+
+#include "cppunit/TestAssert.h"
+#include "cppunit/TestFixture.h"
+#include "cppunit/extensions/HelperMacros.h"
+#include "cppunit/plugin/TestPlugIn.h"
+
+#include "../source/cache.hxx"
+
+namespace {
+
+class Test: public CppUnit::TestFixture {
+private:
+ CPPUNIT_TEST_SUITE(Test);
+ CPPUNIT_TEST(testNothingLostFromLruList);
+ CPPUNIT_TEST_SUITE_END();
+
+ void testNothingLostFromLruList();
+};
+
+// cf. jurt/test/com/sun/star/lib/uno/protocols/urp/Cache_Test.java:
+void Test::testNothingLostFromLruList() {
+ int a[8];
+ for (int i = 0; i != sizeof a / sizeof a[0]; ++i) {
+ for (int j = 0; j != i; ++j) {
+ a[j] = 0;
+ }
+ for (;;) {
+ binaryurp::Cache< int > c(4);
+ for (int k = 0; k != i; ++k) {
+ bool f;
+ c.add(a[k], &f);
+ }
+ bool f;
+ CPPUNIT_ASSERT_EQUAL(
+ 6,
+ c.add(-1, &f) + c.add(-2, &f) + c.add(-3, &f) + c.add(-4, &f));
+ int j = i - 1;
+ while (j >= 0 && a[j] == 3) {
+ --j;
+ }
+ if (j < 0) {
+ break;
+ }
+ ++a[j];
+ for (int k = j + 1; k != i; ++k) {
+ a[k] = 0;
+ }
+ }
+ }
+}
+
+CPPUNIT_TEST_SUITE_REGISTRATION(Test);
+
+}
+
+CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/binaryurp/qa/test-unmarshal.cxx b/binaryurp/qa/test-unmarshal.cxx
new file mode 100644
index 000000000000..3d3c1795a724
--- /dev/null
+++ b/binaryurp/qa/test-unmarshal.cxx
@@ -0,0 +1,112 @@
+/*************************************************************************
+*
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2000, 2011 Oracle and/or its affiliates.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+*
+************************************************************************/
+
+#include "sal/config.h"
+
+#include "com/sun/star/io/IOException.hpp"
+#include "com/sun/star/uno/Sequence.hxx"
+#include "cppu/unotype.hxx"
+#include "cppunit/TestAssert.h"
+#include "cppunit/TestFixture.h"
+#include "cppunit/extensions/HelperMacros.h"
+#include "cppunit/plugin/TestPlugIn.h"
+#include "rtl/ref.hxx"
+#include "rtl/string.h"
+#include "sal/types.h"
+#include "typelib/typedescription.hxx"
+
+#include "../source/bridge.hxx"
+#include "../source/cache.hxx"
+#include "../source/readerstate.hxx"
+#include "../source/unmarshal.hxx"
+
+namespace {
+
+namespace css = com::sun::star;
+
+class Test: public CppUnit::TestFixture {
+private:
+ CPPUNIT_TEST_SUITE(Test);
+ CPPUNIT_TEST(testTypeOfBooleanSequence);
+ CPPUNIT_TEST(testTypeOfVoidSequence);
+ CPPUNIT_TEST_SUITE_END();
+
+ void testTypeOfBooleanSequence();
+
+ void testTypeOfVoidSequence();
+};
+
+void Test::testTypeOfBooleanSequence() {
+ binaryurp::ReaderState state;
+ css::uno::Sequence< sal_Int8 > buf(13);
+ buf[0] = static_cast< sal_Int8 >(20 | 0x80); // sequence type | cache flag
+ buf[1] = static_cast< sal_Int8 >(binaryurp::cache::ignore >> 8);
+ buf[2] = static_cast< sal_Int8 >(binaryurp::cache::ignore & 0xFF);
+ buf[3] = RTL_CONSTASCII_LENGTH("[]boolean");
+ buf[4] = '[';
+ buf[5] = ']';
+ buf[6] = 'b';
+ buf[7] = 'o';
+ buf[8] = 'o';
+ buf[9] = 'l';
+ buf[10] = 'e';
+ buf[11] = 'a';
+ buf[12] = 'n';
+ binaryurp::Unmarshal m(rtl::Reference< binaryurp::Bridge >(), state, buf);
+ css::uno::TypeDescription t(m.readType());
+ CPPUNIT_ASSERT(
+ t.equals(
+ css::uno::TypeDescription(
+ cppu::UnoType< css::uno::Sequence< bool > >::get())));
+ m.done();
+}
+
+void Test::testTypeOfVoidSequence() {
+ binaryurp::ReaderState state;
+ css::uno::Sequence< sal_Int8 > buf(10);
+ buf[0] = static_cast< sal_Int8 >(20 | 0x80); // sequence type | cache flag
+ buf[1] = static_cast< sal_Int8 >(binaryurp::cache::ignore >> 8);
+ buf[2] = static_cast< sal_Int8 >(binaryurp::cache::ignore & 0xFF);
+ buf[3] = RTL_CONSTASCII_LENGTH("[]void");
+ buf[4] = '[';
+ buf[5] = ']';
+ buf[6] = 'v';
+ buf[7] = 'o';
+ buf[8] = 'i';
+ buf[9] = 'd';
+ binaryurp::Unmarshal m(rtl::Reference< binaryurp::Bridge >(), state, buf);
+ try {
+ m.readType();
+ CPPUNIT_FAIL("exception expected");
+ } catch (css::io::IOException &) {}
+}
+
+CPPUNIT_TEST_SUITE_REGISTRATION(Test);
+
+}
+
+CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/binaryurp/qa/version.map b/binaryurp/qa/version.map
new file mode 100644
index 000000000000..ef2ab497cb5e
--- /dev/null
+++ b/binaryurp/qa/version.map
@@ -0,0 +1,34 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2011 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#***********************************************************************/
+
+UDK_3_0_0 {
+ global:
+ cppunitTestPlugIn;
+
+ local:
+ *;
+};
diff --git a/binaryurp/source/binaryany.cxx b/binaryurp/source/binaryany.cxx
new file mode 100644
index 000000000000..c5b8b1a3cb3d
--- /dev/null
+++ b/binaryurp/source/binaryany.cxx
@@ -0,0 +1,98 @@
+/*************************************************************************
+*
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2000, 2011 Oracle and/or its affiliates.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+*
+************************************************************************/
+
+#include "sal/config.h"
+
+#include "osl/diagnose.h"
+#include "typelib/typeclass.h"
+#include "typelib/typedescription.hxx"
+#include "uno/any2.h"
+
+#include "binaryany.hxx"
+
+namespace binaryurp {
+
+namespace {
+
+namespace css = com::sun::star;
+
+}
+
+BinaryAny::BinaryAny() throw () {
+ uno_any_construct(&data_, 0, 0, 0);
+}
+
+BinaryAny::BinaryAny(css::uno::TypeDescription const & type, void * value)
+ throw ()
+{
+ OSL_ASSERT(type.is());
+ uno_any_construct(&data_, value, type.get(), 0);
+}
+
+BinaryAny::BinaryAny(uno_Any const & raw) throw () {
+ OSL_ASSERT(raw.pType != 0);
+ data_.pType = raw.pType;
+ typelib_typedescriptionreference_acquire(data_.pType);
+ data_.pData = raw.pData == &raw.pReserved ? &data_.pReserved : raw.pData;
+ data_.pReserved = raw.pReserved;
+}
+
+BinaryAny::BinaryAny(BinaryAny const & other) throw () {
+ uno_type_any_construct(&data_, other.data_.pData, other.data_.pType, 0);
+}
+
+BinaryAny::~BinaryAny() throw () {
+ uno_any_destruct(&data_, 0);
+}
+
+BinaryAny & BinaryAny::operator =(BinaryAny const & other) throw () {
+ if (&other != this) {
+ uno_type_any_assign(&data_, other.data_.pData, other.data_.pType, 0, 0);
+ }
+ return *this;
+}
+
+uno_Any * BinaryAny::get() throw () {
+ return &data_;
+}
+
+css::uno::TypeDescription BinaryAny::getType() const throw () {
+ return css::uno::TypeDescription(data_.pType);
+}
+
+void * BinaryAny::getValue(css::uno::TypeDescription const & type) const
+ throw ()
+{
+ OSL_ASSERT(
+ type.is() &&
+ (type.get()->eTypeClass == typelib_TypeClass_ANY ||
+ type.equals(css::uno::TypeDescription(data_.pType))));
+ return type.get()->eTypeClass == typelib_TypeClass_ANY
+ ? &data_ : data_.pData;
+}
+
+}
diff --git a/binaryurp/source/binaryany.hxx b/binaryurp/source/binaryany.hxx
new file mode 100644
index 000000000000..4dd6112b5c57
--- /dev/null
+++ b/binaryurp/source/binaryany.hxx
@@ -0,0 +1,73 @@
+/*************************************************************************
+*
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2000, 2011 Oracle and/or its affiliates.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+*
+************************************************************************/
+
+#ifndef INCLUDED_BINARYURP_SOURCE_BINARYANY_HXX
+#define INCLUDED_BINARYURP_SOURCE_BINARYANY_HXX
+
+#include "sal/config.h"
+
+#include "uno/any2.h"
+
+namespace com { namespace sun { namespace star { namespace uno {
+ class TypeDescription;
+} } } }
+
+namespace binaryurp {
+
+class BinaryAny {
+public:
+ BinaryAny() throw ();
+
+ BinaryAny(com::sun::star::uno::TypeDescription const & type, void * value)
+ throw ();
+
+ explicit BinaryAny(uno_Any const & raw) throw ();
+ // takes over raw.pData (but copies raw.pType); raw must not be passed
+ // to uno_any_destruct
+
+ BinaryAny(BinaryAny const & other) throw ();
+
+ ~BinaryAny() throw ();
+
+ BinaryAny & operator =(BinaryAny const & other) throw ();
+
+ uno_Any * get() throw ();
+
+ com::sun::star::uno::TypeDescription getType() const throw ();
+
+ void * getValue(com::sun::star::uno::TypeDescription const & type) const
+ throw ();
+
+private:
+ mutable uno_Any data_;
+ // mutable so that getValue() can return a non-const void *, as in turn
+ // required at various places in binary UNO
+};
+
+}
+
+#endif
diff --git a/remotebridges/source/factory/bridgefac.component b/binaryurp/source/binaryurp.component
index e20bc34250ca..19554bcc088b 100644
--- a/remotebridges/source/factory/bridgefac.component
+++ b/binaryurp/source/binaryurp.component
@@ -3,7 +3,7 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
-* Copyright 2000, 2010 Oracle and/or its affiliates.
+* Copyright 2000, 2011 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
@@ -28,7 +28,7 @@
<component loader="com.sun.star.loader.SharedLibrary"
xmlns="http://openoffice.org/2010/uno-components">
- <implementation name="com.sun.star.comp.remotebridges.BridgeFactory">
+ <implementation name="com.sun.star.comp.bridge.BridgeFactory">
<service name="com.sun.star.bridge.BridgeFactory"/>
</implementation>
</component>
diff --git a/binaryurp/source/bridge.cxx b/binaryurp/source/bridge.cxx
new file mode 100644
index 000000000000..dcf77662c56d
--- /dev/null
+++ b/binaryurp/source/bridge.cxx
@@ -0,0 +1,978 @@
+/*************************************************************************
+*
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2000, 2011 Oracle and/or its affiliates.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+*
+************************************************************************/
+
+#include "sal/config.h"
+
+#include <algorithm>
+#include <cstddef>
+#include <limits>
+#include <memory>
+#include <vector>
+
+#include "boost/noncopyable.hpp"
+#include "com/sun/star/bridge/InvalidProtocolChangeException.hpp"
+#include "com/sun/star/bridge/XBridge.hpp"
+#include "com/sun/star/bridge/XInstanceProvider.hpp"
+#include "com/sun/star/bridge/XProtocolProperties.hpp"
+#include "com/sun/star/connection/XConnection.hpp"
+#include "com/sun/star/io/IOException.hpp"
+#include "com/sun/star/lang/DisposedException.hpp"
+#include "com/sun/star/lang/EventObject.hpp"
+#include "com/sun/star/lang/XEventListener.hpp"
+#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/XInterface.hpp"
+#include "cppuhelper/exc_hlp.hxx"
+#include "cppuhelper/weak.hxx"
+#include "osl/diagnose.h"
+#include "osl/mutex.hxx"
+#include "osl/thread.hxx"
+#include "rtl/byteseq.hxx"
+#include "rtl/random.h"
+#include "rtl/ref.hxx"
+#include "rtl/textenc.h"
+#include "rtl/ustrbuf.hxx"
+#include "rtl/ustring.h"
+#include "rtl/ustring.hxx"
+#include "sal/types.h"
+#include "typelib/typeclass.h"
+#include "typelib/typedescription.h"
+#include "typelib/typedescription.hxx"
+#include "uno/dispatcher.hxx"
+#include "uno/environment.hxx"
+#include "uno/lbnames.h"
+
+#include "binaryany.hxx"
+#include "bridge.hxx"
+#include "bridgefactory.hxx"
+#include "incomingreply.hxx"
+#include "lessoperators.hxx"
+#include "outgoingrequest.hxx"
+#include "outgoingrequests.hxx"
+#include "proxy.hxx"
+#include "reader.hxx"
+
+namespace binaryurp {
+
+namespace {
+
+namespace css = com::sun::star;
+
+sal_Int32 random() {
+ sal_Int32 n;
+ rtlRandomPool pool = rtl_random_createPool();
+ rtl_random_getBytes(pool, &n, sizeof n);
+ rtl_random_destroyPool(pool);
+ return n;
+}
+
+extern "C" void SAL_CALL freeProxyCallback(uno_ExtEnvironment *, void * pProxy)
+{
+ OSL_ASSERT(pProxy != 0);
+ static_cast< Proxy * >(pProxy)->do_free();
+}
+
+void joinThread(osl::Thread * thread) {
+ OSL_ASSERT(thread != 0);
+ if (thread->getIdentifier() != osl::Thread::getCurrentIdentifier()) {
+ thread->join();
+ }
+}
+
+class AttachThread: private boost::noncopyable {
+public:
+ explicit AttachThread(uno_ThreadPool threadPool);
+
+ ~AttachThread();
+
+ rtl::ByteSequence getTid() throw ();
+
+private:
+ uno_ThreadPool threadPool_;
+ rtl::ByteSequence tid_;
+};
+
+AttachThread::AttachThread(uno_ThreadPool threadPool): threadPool_(threadPool) {
+ sal_Sequence * s = 0;
+ uno_getIdOfCurrentThread(&s);
+ tid_ = rtl::ByteSequence(s, rtl::BYTESEQ_NOACQUIRE);
+ uno_threadpool_attach(threadPool_);
+}
+
+AttachThread::~AttachThread() {
+ uno_threadpool_detach(threadPool_);
+ uno_releaseIdFromCurrentThread();
+}
+
+rtl::ByteSequence AttachThread::getTid() throw () {
+ return tid_;
+}
+
+class PopOutgoingRequest: private boost::noncopyable {
+public:
+ PopOutgoingRequest(
+ OutgoingRequests & requests, rtl::ByteSequence const & tid,
+ OutgoingRequest const & request);
+
+ ~PopOutgoingRequest();
+
+ void clear();
+
+private:
+ OutgoingRequests & requests_;
+ rtl::ByteSequence tid_;
+ bool cleared_;
+};
+
+PopOutgoingRequest::PopOutgoingRequest(
+ OutgoingRequests & requests, rtl::ByteSequence const & tid,
+ OutgoingRequest const & request):
+ requests_(requests), tid_(tid), cleared_(false)
+{
+ requests_.push(tid_, request);
+}
+
+PopOutgoingRequest::~PopOutgoingRequest() {
+ if (!cleared_) {
+ requests_.pop(tid_);
+ }
+}
+
+void PopOutgoingRequest::clear() {
+ cleared_ = true;
+}
+
+}
+
+struct Bridge::SubStub {
+ com::sun::star::uno::UnoInterfaceReference object;
+
+ sal_uInt32 references;
+};
+
+Bridge::Bridge(
+ rtl::Reference< BridgeFactory > const & factory, rtl::OUString const & name,
+ css::uno::Reference< css::connection::XConnection > const & connection,
+ css::uno::Reference< css::bridge::XInstanceProvider > const & provider):
+ factory_(factory), name_(name), connection_(connection),
+ provider_(provider),
+ binaryUno_(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(UNO_LB_UNO))),
+ cppToBinaryMapping_(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(CPPU_CURRENT_LANGUAGE_BINDING_NAME)),
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(UNO_LB_UNO))),
+ binaryToCppMapping_(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(UNO_LB_UNO)),
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(CPPU_CURRENT_LANGUAGE_BINDING_NAME))),
+ protPropTid_(
+ reinterpret_cast< sal_Int8 const * >(".UrpProtocolPropertiesTid"),
+ RTL_CONSTASCII_LENGTH(".UrpProtocolPropertiesTid")),
+ protPropOid_(RTL_CONSTASCII_USTRINGPARAM("UrpProtocolProperties")),
+ protPropType_(
+ cppu::UnoType<
+ css::uno::Reference< css::bridge::XProtocolProperties > >::get()),
+ protPropRequest_(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.bridge.XProtocolProperties::requestChange"))),
+ protPropCommit_(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.bridge.XProtocolProperties::commitChange"))),
+ threadPool_(0), currentContextMode_(false), proxies_(0), calls_(0),
+ normalCall_(false), activeCalls_(0), terminated_(false),
+ mode_(MODE_REQUESTED)
+{
+ OSL_ASSERT(factory.is() && connection.is());
+ if (!binaryUno_.is()) {
+ throw css::uno::RuntimeException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM("URP: no binary UNO environment")),
+ css::uno::Reference< css::uno::XInterface >());
+ }
+ if (!(cppToBinaryMapping_.is() && binaryToCppMapping_.is())) {
+ throw css::uno::RuntimeException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM("URP: no C++ UNO mapping")),
+ css::uno::Reference< css::uno::XInterface >());
+ }
+ passive_.set();
+}
+
+void Bridge::start() {
+ OSL_ASSERT(threadPool_ == 0 && !writer_.is() && !reader_.is());
+ threadPool_ = uno_threadpool_create();
+ OSL_ASSERT(threadPool_ != 0);
+ writer_.set(new Writer(this));
+ writer_->create();
+ reader_.set(new Reader(this));
+ reader_->create();
+}
+
+void Bridge::terminate() {
+ rtl::Reference< Reader > r;
+ rtl::Reference< Writer > w;
+ Listeners ls;
+ {
+ osl::MutexGuard g(mutex_);
+ if (terminated_) {
+ return;
+ }
+ std::swap(reader_, r);
+ std::swap(writer_, w);
+ ls.swap(listeners_);
+ terminated_ = true;
+ }
+ try {
+ connection_->close();
+ } catch (css::io::IOException & e) {
+ OSL_TRACE(
+ OSL_LOG_PREFIX "caught IO exception '%s'",
+ rtl::OUStringToOString(e.Message, RTL_TEXTENCODING_UTF8).getStr());
+ }
+ OSL_ASSERT(w.is());
+ w->stop();
+ joinThread(r.get());
+ joinThread(w.get());
+ OSL_ASSERT(threadPool_ != 0);
+ uno_threadpool_dispose(threadPool_);
+ Stubs s;
+ {
+ osl::MutexGuard g(mutex_);
+ s.swap(stubs_);
+ }
+ for (Stubs::iterator i(s.begin()); i != s.end(); ++i) {
+ for (Stub::iterator j(i->second.begin()); j != i->second.end(); ++j) {
+ binaryUno_.get()->pExtEnv->revokeInterface(
+ binaryUno_.get()->pExtEnv, j->second.object.get());
+ }
+ }
+ factory_->removeBridge(this);
+ for (Listeners::iterator i(ls.begin()); i != ls.end(); ++i) {
+ try {
+ (*i)->disposing(
+ css::lang::EventObject(
+ static_cast< cppu::OWeakObject * >(this)));
+ } catch (css::uno::RuntimeException & e) {
+ OSL_TRACE(
+ OSL_LOG_PREFIX "caught runtime exception '%s'",
+ rtl::OUStringToOString(
+ e.Message, RTL_TEXTENCODING_UTF8).getStr());
+ }
+ }
+}
+
+css::uno::Reference< css::connection::XConnection > Bridge::getConnection()
+ const
+{
+ return connection_;
+}
+
+css::uno::Reference< css::bridge::XInstanceProvider > Bridge::getProvider()
+ const
+{
+ return provider_;
+}
+
+css::uno::Mapping & Bridge::getCppToBinaryMapping() {
+ return cppToBinaryMapping_;
+}
+
+BinaryAny Bridge::mapCppToBinaryAny(css::uno::Any const & cppAny) {
+ css::uno::Any in(cppAny);
+ BinaryAny out;
+ out.~BinaryAny();
+ uno_copyAndConvertData(
+ out.get(), &in,
+ css::uno::TypeDescription(cppu::UnoType< css::uno::Any >::get()).get(),
+ cppToBinaryMapping_.get());
+ return out;
+}
+
+uno_ThreadPool Bridge::getThreadPool() const {
+ OSL_ASSERT(threadPool_ != 0);
+ return threadPool_;
+}
+
+rtl::Reference< Writer > Bridge::getWriter() {
+ osl::MutexGuard g(mutex_);
+ if (terminated_) {
+ throw css::lang::DisposedException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "Binary URP bridge already disposed")),
+ static_cast< cppu::OWeakObject * >(this));
+ }
+ OSL_ASSERT(writer_.is());
+ return writer_;
+}
+
+css::uno::UnoInterfaceReference Bridge::registerIncomingInterface(
+ rtl::OUString const & oid, css::uno::TypeDescription const & type)
+{
+ OSL_ASSERT(type.is());
+ if (oid.getLength() == 0) {
+ return css::uno::UnoInterfaceReference();
+ }
+ css::uno::UnoInterfaceReference obj(findStub(oid, type));
+ if (!obj.is()) {
+ binaryUno_.get()->pExtEnv->getRegisteredInterface(
+ binaryUno_.get()->pExtEnv,
+ reinterpret_cast< void ** >(&obj.m_pUnoI), oid.pData,
+ reinterpret_cast< typelib_InterfaceTypeDescription * >(type.get()));
+ if (obj.is()) {
+ makeReleaseCall(oid, type);
+ } else {
+ obj.set(new Proxy(this, oid, type), SAL_NO_ACQUIRE);
+ {
+ osl::MutexGuard g(mutex_);
+ OSL_ASSERT(
+ proxies_ < std::numeric_limits< std::size_t >::max());
+ ++proxies_;
+ }
+ binaryUno_.get()->pExtEnv->registerProxyInterface(
+ binaryUno_.get()->pExtEnv,
+ reinterpret_cast< void ** >(&obj.m_pUnoI), &freeProxyCallback,
+ oid.pData,
+ reinterpret_cast< typelib_InterfaceTypeDescription * >(
+ type.get()));
+ }
+ }
+ return obj;
+}
+
+rtl::OUString Bridge::registerOutgoingInterface(
+ css::uno::UnoInterfaceReference const & object,
+ css::uno::TypeDescription const & type)
+{
+ OSL_ASSERT(type.is());
+ if (!object.is()) {
+ return rtl::OUString();
+ }
+ rtl::OUString oid;
+ if (!Proxy::isProxy(this, object, &oid)) {
+ binaryUno_.get()->pExtEnv->getObjectIdentifier(
+ binaryUno_.get()->pExtEnv, &oid.pData, object.get());
+ osl::MutexGuard g(mutex_);
+ Stubs::iterator i(stubs_.find(oid));
+ Stub newStub;
+ Stub * stub = i == stubs_.end() ? &newStub : &i->second;
+ Stub::iterator j(stub->find(type));
+ //TODO: Release sub-stub if it is not successfully sent to remote side
+ // (otherwise, stub will leak until terminate()):
+ if (j == stub->end()) {
+ j = stub->insert(Stub::value_type(type, SubStub())).first;
+ if (stub == &newStub) {
+ i = stubs_.insert(Stubs::value_type(oid, Stub())).first;
+ std::swap(i->second, newStub);
+ j = i->second.find(type);
+ OSL_ASSERT(j != i->second.end());
+ }
+ j->second.object = object;
+ j->second.references = 1;
+ binaryUno_.get()->pExtEnv->registerInterface(
+ binaryUno_.get()->pExtEnv,
+ reinterpret_cast< void ** >(&j->second.object.m_pUnoI),
+ oid.pData,
+ reinterpret_cast< typelib_InterfaceTypeDescription * >(
+ type.get()));
+ } else {
+ OSL_ASSERT(stub != &newStub);
+ if (j->second.references == SAL_MAX_UINT32) {
+ throw css::uno::RuntimeException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "URP: stub reference count overflow")),
+ css::uno::Reference< css::uno::XInterface >());
+ }
+ ++j->second.references;
+ }
+ }
+ return oid;
+}
+
+css::uno::UnoInterfaceReference Bridge::findStub(
+ rtl::OUString const & oid, css::uno::TypeDescription const & type)
+{
+ OSL_ASSERT(oid.getLength() != 0 && type.is());
+ osl::MutexGuard g(mutex_);
+ Stubs::iterator i(stubs_.find(oid));
+ if (i != stubs_.end()) {
+ Stub::iterator j(i->second.find(type));
+ if (j != i->second.end()) {
+ return j->second.object;
+ }
+ for (j = i->second.begin(); j != i->second.end(); ++j) {
+ if (typelib_typedescription_isAssignableFrom(
+ type.get(), j->first.get()))
+ {
+ return j->second.object;
+ }
+ }
+ }
+ return css::uno::UnoInterfaceReference();
+}
+
+void Bridge::releaseStub(
+ rtl::OUString const & oid, css::uno::TypeDescription const & type)
+{
+ OSL_ASSERT(oid.getLength() != 0 && type.is());
+ css::uno::UnoInterfaceReference obj;
+ bool unused;
+ {
+ osl::MutexGuard g(mutex_);
+ Stubs::iterator i(stubs_.find(oid));
+ if (i == stubs_.end()) {
+ throw css::uno::RuntimeException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM("URP: release unknown stub")),
+ css::uno::Reference< css::uno::XInterface >());
+ }
+ Stub::iterator j(i->second.find(type));
+ if (j == i->second.end()) {
+ throw css::uno::RuntimeException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM("URP: release unknown stub")),
+ css::uno::Reference< css::uno::XInterface >());
+ }
+ OSL_ASSERT(j->second.references > 0);
+ --j->second.references;
+ if (j->second.references == 0) {
+ obj = j->second.object;
+ i->second.erase(j);
+ if (i->second.empty()) {
+ stubs_.erase(i);
+ }
+ }
+ unused = becameUnused();
+ }
+ if (obj.is()) {
+ binaryUno_.get()->pExtEnv->revokeInterface(
+ binaryUno_.get()->pExtEnv, obj.get());
+ }
+ terminateWhenUnused(unused);
+}
+
+void Bridge::resurrectProxy(Proxy & proxy) {
+ uno_Interface * p = &proxy;
+ binaryUno_.get()->pExtEnv->registerProxyInterface(
+ binaryUno_.get()->pExtEnv,
+ reinterpret_cast< void ** >(&p), &freeProxyCallback,
+ proxy.getOid().pData,
+ reinterpret_cast< typelib_InterfaceTypeDescription * >(
+ proxy.getType().get()));
+ OSL_ASSERT(p == &proxy);
+}
+
+void Bridge::revokeProxy(Proxy & proxy) {
+ binaryUno_.get()->pExtEnv->revokeInterface(
+ binaryUno_.get()->pExtEnv, &proxy);
+}
+
+void Bridge::freeProxy(Proxy & proxy) {
+ try {
+ makeReleaseCall(proxy.getOid(), proxy.getType());
+ } catch (css::uno::RuntimeException & e) {
+ OSL_TRACE(
+ OSL_LOG_PREFIX "caught runtime exception '%s'",
+ rtl::OUStringToOString(e.Message, RTL_TEXTENCODING_UTF8).getStr());
+ } catch (std::exception & e) {
+ OSL_TRACE(OSL_LOG_PREFIX "caught C++ exception '%s'", e.what());
+ }
+ bool unused;
+ {
+ osl::MutexGuard g(mutex_);
+ OSL_ASSERT(proxies_ > 0);
+ --proxies_;
+ unused = becameUnused();
+ }
+ terminateWhenUnused(unused);
+}
+
+void Bridge::incrementCalls(bool normalCall) throw () {
+ osl::MutexGuard g(mutex_);
+ OSL_ASSERT(calls_ < std::numeric_limits< std::size_t >::max());
+ ++calls_;
+ normalCall_ |= normalCall;
+}
+
+void Bridge::decrementCalls() {
+ bool unused;
+ {
+ osl::MutexGuard g(mutex_);
+ OSL_ASSERT(calls_ > 0);
+ --calls_;
+ unused = becameUnused();
+ }
+ terminateWhenUnused(unused);
+}
+
+void Bridge::incrementActiveCalls() throw () {
+ osl::MutexGuard g(mutex_);
+ OSL_ASSERT(
+ activeCalls_ <= calls_ &&
+ activeCalls_ < std::numeric_limits< std::size_t >::max());
+ ++activeCalls_;
+ passive_.reset();
+}
+
+void Bridge::decrementActiveCalls() throw () {
+ osl::MutexGuard g(mutex_);
+ OSL_ASSERT(activeCalls_ <= calls_ && activeCalls_ > 0);
+ --activeCalls_;
+ if (activeCalls_ == 0) {
+ passive_.set();
+ }
+}
+
+bool Bridge::makeCall(
+ rtl::OUString const & oid, css::uno::TypeDescription const & member,
+ bool setter, std::vector< BinaryAny > const & inArguments,
+ BinaryAny * returnValue, std::vector< BinaryAny > * outArguments)
+{
+ std::auto_ptr< IncomingReply > resp;
+ {
+ AttachThread att(threadPool_);
+ PopOutgoingRequest pop(
+ outgoingRequests_, att.getTid(),
+ OutgoingRequest(OutgoingRequest::KIND_NORMAL, member, setter));
+ sendRequest(
+ att.getTid(), oid, css::uno::TypeDescription(), member,
+ inArguments);
+ pop.clear();
+ incrementCalls(true);
+ incrementActiveCalls();
+ void * job;
+ uno_threadpool_enter(threadPool_, &job);
+ resp.reset(static_cast< IncomingReply * >(job));
+ decrementActiveCalls();
+ decrementCalls();
+ }
+ if (resp.get() == 0) {
+ throw css::lang::DisposedException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "Binary URP bridge disposed during call")),
+ static_cast< cppu::OWeakObject * >(this));
+ }
+ *returnValue = resp->returnValue;
+ if (!resp->exception) {
+ *outArguments = resp->outArguments;
+ }
+ return resp->exception;
+}
+
+void Bridge::sendRequestChangeRequest() {
+ OSL_ASSERT(mode_ == MODE_REQUESTED);
+ random_ = random();
+ std::vector< BinaryAny > a;
+ a.push_back(
+ BinaryAny(
+ css::uno::TypeDescription(cppu::UnoType< sal_Int32 >::get()),
+ &random_));
+ sendProtPropRequest(OutgoingRequest::KIND_REQUEST_CHANGE, a);
+}
+
+void Bridge::handleRequestChangeReply(
+ bool exception, BinaryAny const & returnValue)
+{
+ throwException(exception, returnValue);
+ sal_Int32 n = *static_cast< sal_Int32 * >(
+ returnValue.getValue(
+ css::uno::TypeDescription(cppu::UnoType< sal_Int32 >::get())));
+ sal_Int32 exp = 0;
+ switch (mode_) {
+ case MODE_REQUESTED:
+ case MODE_REPLY_1:
+ exp = 1;
+ break;
+ case MODE_REPLY_MINUS1:
+ exp = -1;
+ mode_ = MODE_REQUESTED;
+ break;
+ case MODE_REPLY_0:
+ exp = 0;
+ mode_ = MODE_WAIT;
+ break;
+ default:
+ OSL_ASSERT(false); // this cannot happen
+ break;
+ }
+ if (n != exp) {
+ throw css::uno::RuntimeException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "URP: requestChange reply with unexpected return value"
+ " received")),
+ static_cast< cppu::OWeakObject * >(this));
+ }
+ decrementCalls();
+ switch (exp) {
+ case -1:
+ sendRequestChangeRequest();
+ break;
+ case 0:
+ break;
+ case 1:
+ sendCommitChangeRequest();
+ break;
+ default:
+ OSL_ASSERT(false); // this cannot happen
+ break;
+ }
+}
+
+void Bridge::handleCommitChangeReply(
+ bool exception, BinaryAny const & returnValue)
+{
+ bool ccMode = true;
+ try {
+ throwException(exception, returnValue);
+ } catch (css::bridge::InvalidProtocolChangeException &) {
+ ccMode = false;
+ }
+ if (ccMode) {
+ setCurrentContextMode();
+ }
+ OSL_ASSERT(mode_ == MODE_REQUESTED || mode_ == MODE_REPLY_1);
+ mode_ = MODE_NORMAL;
+ getWriter()->unblock();
+ decrementCalls();
+}
+
+void Bridge::handleRequestChangeRequest(
+ rtl::ByteSequence const & tid, std::vector< BinaryAny > const & inArguments)
+{
+ OSL_ASSERT(inArguments.size() == 1);
+ switch (mode_) {
+ case MODE_REQUESTED:
+ {
+ sal_Int32 n2 = *static_cast< sal_Int32 * >(
+ inArguments[0].getValue(
+ css::uno::TypeDescription(
+ cppu::UnoType< sal_Int32 >::get())));
+ sal_Int32 ret;
+ if (n2 > random_) {
+ ret = 1;
+ mode_ = MODE_REPLY_0;
+ } else if (n2 == random_) {
+ ret = -1;
+ mode_ = MODE_REPLY_MINUS1;
+ } else {
+ ret = 0;
+ mode_ = MODE_REPLY_1;
+ }
+ getWriter()->sendDirectReply(
+ tid, protPropRequest_, false,
+ BinaryAny(
+ css::uno::TypeDescription(
+ cppu::UnoType< sal_Int32 >::get()),
+ &ret),
+ std::vector< BinaryAny >());
+ break;
+ }
+ case MODE_NORMAL:
+ {
+ mode_ = MODE_NORMAL_WAIT;
+ sal_Int32 ret = 1;
+ getWriter()->queueReply(
+ tid, protPropRequest_, false, false,
+ BinaryAny(
+ css::uno::TypeDescription(
+ cppu::UnoType< sal_Int32 >::get()),
+ &ret),
+ std::vector< BinaryAny >(), false);
+ break;
+ }
+ default:
+ throw css::uno::RuntimeException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "URP: unexpected requestChange request received")),
+ static_cast< cppu::OWeakObject * >(this));
+ }
+}
+
+void Bridge::handleCommitChangeRequest(
+ rtl::ByteSequence const & tid, std::vector< BinaryAny > const & inArguments)
+{
+ bool ccMode = false;
+ bool exc = false;
+ BinaryAny ret;
+ OSL_ASSERT(inArguments.size() == 1);
+ css::uno::Sequence< css::bridge::ProtocolProperty > s;
+ OSL_VERIFY(mapBinaryToCppAny(inArguments[0]) >>= s);
+ for (sal_Int32 i = 0; i != s.getLength(); ++i) {
+ if (s[i].Name.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("CurrentContext")))
+ {
+ ccMode = true;
+ } else {
+ ccMode = false;
+ exc = true;
+ ret = mapCppToBinaryAny(
+ css::uno::makeAny(
+ css::bridge::InvalidProtocolChangeException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "InvalidProtocolChangeException")),
+ css::uno::Reference< css::uno::XInterface >(), s[i],
+ 1)));
+ break;
+ }
+ }
+ switch (mode_) {
+ case MODE_WAIT:
+ getWriter()->sendDirectReply(
+ tid, protPropCommit_, exc, ret, std::vector< BinaryAny >());
+ if (ccMode) {
+ setCurrentContextMode();
+ mode_ = MODE_NORMAL;
+ getWriter()->unblock();
+ } else {
+ mode_ = MODE_REQUESTED;
+ sendRequestChangeRequest();
+ }
+ break;
+ case MODE_NORMAL_WAIT:
+ getWriter()->queueReply(
+ tid, protPropCommit_, false, false, ret, std::vector< BinaryAny >(),
+ ccMode);
+ mode_ = MODE_NORMAL;
+ break;
+ default:
+ throw css::uno::RuntimeException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "URP: unexpected commitChange request received")),
+ static_cast< cppu::OWeakObject * >(this));
+ }
+}
+
+OutgoingRequest Bridge::lastOutgoingRequest(rtl::ByteSequence const & tid) {
+ OutgoingRequest req(outgoingRequests_.top(tid));
+ outgoingRequests_.pop(tid);
+ return req;
+}
+
+bool Bridge::isProtocolPropertiesRequest(
+ rtl::OUString const & oid, css::uno::TypeDescription const & type) const
+{
+ return oid == protPropOid_ && type.equals(protPropType_);
+}
+
+void Bridge::setCurrentContextMode() {
+ osl::MutexGuard g(mutex_);
+ currentContextMode_ = true;
+}
+
+bool Bridge::isCurrentContextMode() {
+ osl::MutexGuard g(mutex_);
+ return currentContextMode_;
+}
+
+Bridge::~Bridge() {
+ if (threadPool_ != 0) {
+ uno_threadpool_destroy(threadPool_);
+ }
+}
+
+css::uno::Reference< css::uno::XInterface > Bridge::getInstance(
+ rtl::OUString const & sInstanceName) throw (css::uno::RuntimeException)
+{
+ if (sInstanceName.getLength() == 0) {
+ throw css::uno::RuntimeException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "XBridge::getInstance sInstanceName must be non-empty")),
+ static_cast< cppu::OWeakObject * >(this));
+ }
+ for (sal_Int32 i = 0; i != sInstanceName.getLength(); ++i) {
+ if (sInstanceName[i] > 0x7F) {
+ throw css::io::IOException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "XBridge::getInstance sInstanceName contains non-ASCII"
+ " character")),
+ css::uno::Reference< css::uno::XInterface >());
+ }
+ }
+ css::uno::TypeDescription ifc(
+ cppu::UnoType< css::uno::Reference< css::uno::XInterface > >::get());
+ typelib_TypeDescription * p = ifc.get();
+ std::vector< BinaryAny > inArgs;
+ inArgs.push_back(
+ BinaryAny(
+ css::uno::TypeDescription(cppu::UnoType< css::uno::Type >::get()),
+ &p));
+ BinaryAny ret;
+ std::vector< BinaryAny> outArgs;
+ bool exc = makeCall(
+ sInstanceName,
+ css::uno::TypeDescription(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.uno.XInterface::queryInterface"))),
+ false, inArgs, &ret, &outArgs);
+ throwException(exc, ret);
+ return css::uno::Reference< css::uno::XInterface >(
+ static_cast< css::uno::XInterface * >(
+ binaryToCppMapping_.mapInterface(
+ *static_cast< uno_Interface ** >(ret.getValue(ifc)),
+ ifc.get())),
+ css::uno::UNO_REF_NO_ACQUIRE);
+}
+
+rtl::OUString Bridge::getName() throw (css::uno::RuntimeException) {
+ return name_;
+}
+
+rtl::OUString Bridge::getDescription() throw (css::uno::RuntimeException) {
+ rtl::OUStringBuffer b(name_);
+ b.append(sal_Unicode(':'));
+ b.append(connection_->getDescription());
+ return b.makeStringAndClear();
+}
+
+void Bridge::dispose() throw (css::uno::RuntimeException) {
+ terminate();
+ // OOo expects dispose to not return while there are still remote calls in
+ // progress; an external protocol must ensure that dispose is not called
+ // from within an incoming or outgoing remote call, as passive_.wait() would
+ // otherwise deadlock:
+ passive_.wait();
+}
+
+void Bridge::addEventListener(
+ css::uno::Reference< css::lang::XEventListener > const & xListener)
+ throw (css::uno::RuntimeException)
+{
+ OSL_ASSERT(xListener.is());
+ {
+ osl::MutexGuard g(mutex_);
+ if (!terminated_) {
+ listeners_.push_back(xListener);
+ return;
+ }
+ }
+ xListener->disposing(
+ css::lang::EventObject(static_cast< cppu::OWeakObject * >(this)));
+}
+
+void Bridge::removeEventListener(
+ css::uno::Reference< css::lang::XEventListener > const & aListener)
+ throw (css::uno::RuntimeException)
+{
+ osl::MutexGuard g(mutex_);
+ Listeners::iterator i(
+ std::find(listeners_.begin(), listeners_.end(), aListener));
+ if (i != listeners_.end()) {
+ listeners_.erase(i);
+ }
+}
+
+void Bridge::sendCommitChangeRequest() {
+ OSL_ASSERT(mode_ == MODE_REQUESTED || mode_ == MODE_REPLY_1);
+ css::uno::Sequence< css::bridge::ProtocolProperty > s(1);
+ s[0].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CurrentContext"));
+ std::vector< BinaryAny > a;
+ a.push_back(mapCppToBinaryAny(css::uno::makeAny(s)));
+ sendProtPropRequest(OutgoingRequest::KIND_COMMIT_CHANGE, a);
+}
+
+void Bridge::sendProtPropRequest(
+ OutgoingRequest::Kind kind, std::vector< BinaryAny > const & inArguments)
+{
+ OSL_ASSERT(
+ kind == OutgoingRequest::KIND_REQUEST_CHANGE ||
+ kind == OutgoingRequest::KIND_COMMIT_CHANGE);
+ incrementCalls(false);
+ css::uno::TypeDescription member(
+ kind == OutgoingRequest::KIND_REQUEST_CHANGE
+ ? protPropRequest_ : protPropCommit_);
+ PopOutgoingRequest pop(
+ outgoingRequests_, protPropTid_, OutgoingRequest(kind, member, false));
+ getWriter()->sendDirectRequest(
+ protPropTid_, protPropOid_, protPropType_, member, inArguments);
+ pop.clear();
+}
+
+void Bridge::makeReleaseCall(
+ rtl::OUString const & oid, css::uno::TypeDescription const & type)
+{
+ AttachThread att(threadPool_);
+ sendRequest(
+ att.getTid(), oid, type,
+ css::uno::TypeDescription(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.uno.XInterface::release"))),
+ std::vector< BinaryAny >());
+}
+
+void Bridge::sendRequest(
+ rtl::ByteSequence const & tid, rtl::OUString const & oid,
+ css::uno::TypeDescription const & type,
+ css::uno::TypeDescription const & member,
+ std::vector< BinaryAny > const & inArguments)
+{
+ getWriter()->queueRequest(tid, oid, type, member, inArguments);
+}
+
+void Bridge::throwException(bool exception, BinaryAny const & value) {
+ if (exception) {
+ cppu::throwException(mapBinaryToCppAny(value));
+ }
+}
+
+css::uno::Any Bridge::mapBinaryToCppAny(BinaryAny const & binaryAny) {
+ BinaryAny in(binaryAny);
+ css::uno::Any out;
+ out.~Any();
+ uno_copyAndConvertData(
+ &out, in.get(),
+ css::uno::TypeDescription(cppu::UnoType< css::uno::Any >::get()).get(),
+ binaryToCppMapping_.get());
+ return out;
+}
+
+bool Bridge::becameUnused() const {
+ return stubs_.empty() && proxies_ == 0 && calls_ == 0 && normalCall_;
+}
+
+void Bridge::terminateWhenUnused(bool unused) {
+ if (unused) {
+ // That the current thread considers the bridge unused implies that it
+ // is not within an incoming or outgoing remote call (so calling
+ // terminate cannot lead to deadlock):
+ terminate();
+ }
+}
+
+}
diff --git a/binaryurp/source/bridge.hxx b/binaryurp/source/bridge.hxx
new file mode 100644
index 000000000000..73e32aac0cac
--- /dev/null
+++ b/binaryurp/source/bridge.hxx
@@ -0,0 +1,287 @@
+/*************************************************************************
+*
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2000, 2011 Oracle and/or its affiliates.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+*
+************************************************************************/
+
+#ifndef INCLUDED_BINARYURP_SOURCE_BRIDGE_HXX
+#define INCLUDED_BINARYURP_SOURCE_BRIDGE_HXX
+
+#include "sal/config.h"
+
+#include <cstddef>
+#include <list>
+#include <map>
+#include <vector>
+
+#include "boost/noncopyable.hpp"
+#include "com/sun/star/bridge/XBridge.hpp"
+#include "com/sun/star/lang/XComponent.hpp"
+#include "com/sun/star/uno/Reference.hxx"
+#include "com/sun/star/uno/RuntimeException.hpp"
+#include "cppuhelper/implbase2.hxx"
+#include "osl/conditn.hxx"
+#include "osl/mutex.hxx"
+#include "rtl/ref.hxx"
+#include "rtl/ustring.hxx"
+#include "sal/types.h"
+#include "uno/environment.hxx"
+#include "uno/mapping.hxx"
+#include "uno/threadpool.h"
+
+#include "outgoingrequest.hxx"
+#include "outgoingrequests.hxx"
+#include "writer.hxx"
+
+namespace binaryurp {
+ class BinaryAny;
+ class BridgeFactory;
+ class Proxy;
+ class Reader;
+}
+namespace com { namespace sun { namespace star {
+ namespace bridge { class XInstanceProvider; }
+ namespace connection { class XConnection; }
+ namespace lang { class XEventListener; }
+ namespace uno {
+ class Any;
+ class TypeDescription;
+ class UnoInterfaceReference;
+ class XInterface;
+ }
+} } }
+namespace rtl { class ByteSequence; }
+
+namespace binaryurp {
+
+class Bridge:
+ public cppu::WeakImplHelper2<
+ com::sun::star::bridge::XBridge, com::sun::star::lang::XComponent >,
+ private boost::noncopyable
+{
+public:
+ Bridge(
+ rtl::Reference< BridgeFactory > const & factory,
+ rtl::OUString const & name,
+ com::sun::star::uno::Reference<
+ com::sun::star::connection::XConnection > const & connection,
+ com::sun::star::uno::Reference<
+ com::sun::star::bridge::XInstanceProvider > const & provider);
+
+ void start();
+
+ // Internally waits for all incoming and outgoing remote calls to terminate,
+ // so must not be called from within such a call:
+ void terminate();
+
+ com::sun::star::uno::Reference< com::sun::star::connection::XConnection >
+ getConnection() const;
+
+ com::sun::star::uno::Reference< com::sun::star::bridge::XInstanceProvider >
+ getProvider() const;
+
+ com::sun::star::uno::Mapping & getCppToBinaryMapping();
+
+ BinaryAny mapCppToBinaryAny(com::sun::star::uno::Any const & cppAny);
+
+ uno_ThreadPool getThreadPool() const;
+
+ rtl::Reference< Writer > getWriter();
+
+ com::sun::star::uno::UnoInterfaceReference registerIncomingInterface(
+ rtl::OUString const & oid,
+ com::sun::star::uno::TypeDescription const & type);
+
+ rtl::OUString registerOutgoingInterface(
+ com::sun::star::uno::UnoInterfaceReference const & object,
+ com::sun::star::uno::TypeDescription const & type);
+
+ com::sun::star::uno::UnoInterfaceReference findStub(
+ rtl::OUString const & oid,
+ com::sun::star::uno::TypeDescription const & type);
+
+ void releaseStub(
+ rtl::OUString const & oid,
+ com::sun::star::uno::TypeDescription const & type);
+
+ void resurrectProxy(Proxy & proxy);
+
+ void revokeProxy(Proxy & proxy);
+
+ void freeProxy(Proxy & proxy);
+
+ void incrementCalls(bool normalCall) throw ();
+
+ void decrementCalls();
+
+ void incrementActiveCalls() throw ();
+
+ void decrementActiveCalls() throw ();
+
+ bool makeCall(
+ rtl::OUString const & oid,
+ com::sun::star::uno::TypeDescription const & member, bool setter,
+ std::vector< BinaryAny > const & inArguments, BinaryAny * returnValue,
+ std::vector< BinaryAny > * outArguments);
+
+ // Only called from reader_ thread:
+ void sendRequestChangeRequest();
+
+ // Only called from reader_ thread:
+ void handleRequestChangeReply(
+ bool exception, BinaryAny const & returnValue);
+
+ // Only called from reader_ thread:
+ void handleCommitChangeReply(bool exception, BinaryAny const & returnValue);
+
+ // Only called from reader_ thread:
+ void handleRequestChangeRequest(
+ rtl::ByteSequence const & tid,
+ std::vector< BinaryAny > const & inArguments);
+
+ // Only called from reader_ thread:
+ void handleCommitChangeRequest(
+ rtl::ByteSequence const & tid,
+ std::vector< BinaryAny > const & inArguments);
+
+ OutgoingRequest lastOutgoingRequest(rtl::ByteSequence const & tid);
+
+ bool isProtocolPropertiesRequest(
+ rtl::OUString const & oid,
+ com::sun::star::uno::TypeDescription const & type) const;
+
+ void setCurrentContextMode();
+
+ bool isCurrentContextMode();
+
+private:
+ virtual ~Bridge();
+
+ virtual com::sun::star::uno::Reference< com::sun::star::uno::XInterface >
+ SAL_CALL getInstance(rtl::OUString const & sInstanceName)
+ throw (com::sun::star::uno::RuntimeException);
+
+ virtual rtl::OUString SAL_CALL getName()
+ throw (com::sun::star::uno::RuntimeException);
+
+ virtual rtl::OUString SAL_CALL getDescription()
+ throw (com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL dispose()
+ throw (com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL addEventListener(
+ com::sun::star::uno::Reference< com::sun::star::lang::XEventListener >
+ const & xListener)
+ throw (com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL removeEventListener(
+ com::sun::star::uno::Reference< com::sun::star::lang::XEventListener >
+ const & aListener)
+ throw (com::sun::star::uno::RuntimeException);
+
+ // Only called from reader_ thread:
+ void sendCommitChangeRequest();
+
+ // Only called from reader_ thread:
+ void sendProtPropRequest(
+ OutgoingRequest::Kind kind,
+ std::vector< BinaryAny > const & inArguments);
+
+ void makeReleaseCall(
+ rtl::OUString const & oid,
+ com::sun::star::uno::TypeDescription const & type);
+
+ void sendRequest(
+ rtl::ByteSequence const & tid, rtl::OUString const & oid,
+ com::sun::star::uno::TypeDescription const & type,
+ com::sun::star::uno::TypeDescription const & member,
+ std::vector< BinaryAny > const & inArguments);
+
+ void throwException(bool exception, BinaryAny const & value);
+
+ com::sun::star::uno::Any mapBinaryToCppAny(BinaryAny const & binaryAny);
+
+ bool becameUnused() const;
+
+ void terminateWhenUnused(bool unused);
+
+ typedef
+ std::list<
+ com::sun::star::uno::Reference<
+ com::sun::star::lang::XEventListener > >
+ Listeners;
+
+ struct SubStub;
+
+ typedef std::map< com::sun::star::uno::TypeDescription, SubStub > Stub;
+
+ typedef std::map< rtl::OUString, Stub > Stubs;
+
+ enum Mode {
+ MODE_REQUESTED, MODE_REPLY_MINUS1, MODE_REPLY_0, MODE_REPLY_1,
+ MODE_WAIT, MODE_NORMAL, MODE_NORMAL_WAIT };
+
+ rtl::Reference< BridgeFactory > factory_;
+ rtl::OUString name_;
+ com::sun::star::uno::Reference< com::sun::star::connection::XConnection >
+ connection_;
+ com::sun::star::uno::Reference< com::sun::star::bridge::XInstanceProvider >
+ provider_;
+ com::sun::star::uno::Environment binaryUno_;
+ com::sun::star::uno::Mapping cppToBinaryMapping_;
+ com::sun::star::uno::Mapping binaryToCppMapping_;
+ rtl::ByteSequence protPropTid_;
+ rtl::OUString protPropOid_;
+ com::sun::star::uno::TypeDescription protPropType_;
+ com::sun::star::uno::TypeDescription protPropRequest_;
+ com::sun::star::uno::TypeDescription protPropCommit_;
+ uno_ThreadPool threadPool_;
+ OutgoingRequests outgoingRequests_;
+
+ osl::Mutex mutex_;
+ Listeners listeners_;
+ rtl::Reference< Writer > writer_;
+ rtl::Reference< Reader > reader_;
+ bool currentContextMode_;
+ Stubs stubs_;
+ std::size_t proxies_;
+ std::size_t calls_;
+ bool normalCall_;
+ std::size_t activeCalls_;
+ osl::Condition passive_;
+ // to guarantee that passive_ is eventually set (to avoid deadlock, see
+ // dispose), activeCalls_ only counts those calls for which it can be
+ // guaranteed that incrementActiveCalls is indeed followed by
+ // decrementActiveCalls, without an intervening exception
+ bool terminated_;
+
+ // Only accessed from reader_ thread:
+ Mode mode_;
+ sal_Int32 random_;
+};
+
+}
+
+#endif
diff --git a/binaryurp/source/bridgefactory.cxx b/binaryurp/source/bridgefactory.cxx
new file mode 100644
index 000000000000..16bd9cf1b6f3
--- /dev/null
+++ b/binaryurp/source/bridgefactory.cxx
@@ -0,0 +1,232 @@
+/*************************************************************************
+*
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2000, 2011 Oracle and/or its affiliates.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+*
+************************************************************************/
+
+#include "sal/config.h"
+
+#include <algorithm>
+
+#include "com/sun/star/connection/XConnection.hpp"
+#include "com/sun/star/uno/Exception.hpp"
+#include "com/sun/star/uno/Reference.hxx"
+#include "com/sun/star/uno/RuntimeException.hpp"
+#include "com/sun/star/uno/XComponentContext.hpp"
+#include "com/sun/star/uno/XInterface.hpp"
+#include "cppuhelper/factory.hxx"
+#include "cppuhelper/implementationentry.hxx"
+#include "osl/diagnose.h"
+#include "rtl/ref.hxx"
+#include "sal/types.h"
+#include "uno/lbnames.h"
+
+#include "bridge.hxx"
+#include "bridgefactory.hxx"
+
+namespace binaryurp {
+
+namespace {
+
+namespace css = com::sun::star;
+
+}
+
+css::uno::Reference< css::uno::XInterface > BridgeFactory::static_create(
+ css::uno::Reference< css::uno::XComponentContext > const & xContext)
+ SAL_THROW((css::uno::Exception))
+{
+ return static_cast< cppu::OWeakObject * >(new BridgeFactory(xContext));
+}
+
+rtl::OUString BridgeFactory::static_getImplementationName() {
+ return rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.comp.bridge.BridgeFactory"));
+}
+
+css::uno::Sequence< rtl::OUString >
+BridgeFactory::static_getSupportedServiceNames() {
+ rtl::OUString name(
+ RTL_CONSTASCII_USTRINGPARAM("com.sun.star.bridge.BridgeFactory"));
+ return css::uno::Sequence< rtl::OUString >(&name, 1);
+}
+
+void BridgeFactory::removeBridge(
+ css::uno::Reference< css::bridge::XBridge > const & bridge)
+{
+ OSL_ASSERT(bridge.is());
+ rtl::OUString n(bridge->getName());
+ osl::MutexGuard g(*this);
+ if (n.getLength() == 0) {
+ BridgeList::iterator i(
+ std::find(unnamed_.begin(), unnamed_.end(), bridge));
+ if (i != unnamed_.end()) {
+ unnamed_.erase(i);
+ }
+ } else {
+ BridgeMap::iterator i(named_.find(n));
+ if (i != named_.end() && i->second == bridge) {
+ named_.erase(i);
+ }
+ }
+}
+
+BridgeFactory::BridgeFactory(
+ css::uno::Reference< css::uno::XComponentContext > const & context):
+ BridgeFactoryBase(*static_cast< osl::Mutex * >(this)), context_(context)
+{
+ OSL_ASSERT(context.is());
+}
+
+BridgeFactory::~BridgeFactory() {}
+
+rtl::OUString BridgeFactory::getImplementationName()
+ throw (css::uno::RuntimeException)
+{
+ return static_getImplementationName();
+}
+
+sal_Bool BridgeFactory::supportsService(rtl::OUString const & ServiceName)
+ throw (css::uno::RuntimeException)
+{
+ css::uno::Sequence< rtl::OUString > s(getSupportedServiceNames());
+ for (sal_Int32 i = 0; i != s.getLength(); ++i) {
+ if (ServiceName == s[i]) {
+ return true;
+ }
+ }
+ return false;
+}
+
+css::uno::Sequence< rtl::OUString > BridgeFactory::getSupportedServiceNames()
+ throw (css::uno::RuntimeException)
+{
+ return static_getSupportedServiceNames();
+}
+
+css::uno::Reference< css::bridge::XBridge > BridgeFactory::createBridge(
+ rtl::OUString const & sName, rtl::OUString const & sProtocol,
+ css::uno::Reference< css::connection::XConnection > const & aConnection,
+ css::uno::Reference< css::bridge::XInstanceProvider > const &
+ anInstanceProvider)
+ throw (
+ css::bridge::BridgeExistsException, css::lang::IllegalArgumentException,
+ css::uno::RuntimeException)
+{
+ rtl::Reference< Bridge > b;
+ {
+ osl::MutexGuard g(*this);
+ if (named_.find(sName) != named_.end()) {
+ throw css::bridge::BridgeExistsException(
+ sName, static_cast< cppu::OWeakObject * >(this));
+ }
+ if (!(sProtocol.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("urp")) &&
+ aConnection.is()))
+ {
+ throw css::lang::IllegalArgumentException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "BridgeFactory::createBridge: sProtocol != urp ||"
+ " aConnection == null")),
+ static_cast< cppu::OWeakObject * >(this), -1);
+ }
+ b.set(new Bridge(this, sName, aConnection, anInstanceProvider));
+ if (sName.getLength() == 0) {
+ unnamed_.push_back(
+ css::uno::Reference< css::bridge::XBridge >(b.get()));
+ } else {
+ named_[sName] = b.get();
+ }
+ }
+ b->start();
+ return css::uno::Reference< css::bridge::XBridge >(b.get());
+}
+
+css::uno::Reference< css::bridge::XBridge > BridgeFactory::getBridge(
+ rtl::OUString const & sName) throw (css::uno::RuntimeException)
+{
+ osl::MutexGuard g(*this);
+ BridgeMap::iterator i(named_.find(sName));
+ return i == named_.end()
+ ? css::uno::Reference< css::bridge::XBridge >() : i->second;
+}
+
+css::uno::Sequence< css::uno::Reference< css::bridge::XBridge > >
+BridgeFactory::getExistingBridges() throw (css::uno::RuntimeException) {
+ osl::MutexGuard g(*this);
+ if (unnamed_.size() > SAL_MAX_INT32) {
+ throw css::uno::RuntimeException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "BridgeFactory::getExistingBridges: too many")),
+ static_cast< cppu::OWeakObject * >(this));
+ }
+ sal_Int32 n = static_cast< sal_Int32 >(unnamed_.size());
+ if (named_.size() > static_cast< sal_uInt32 >(SAL_MAX_INT32 - n)) {
+ throw css::uno::RuntimeException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "BridgeFactory::getExistingBridges: too many")),
+ static_cast< cppu::OWeakObject * >(this));
+ }
+ n = static_cast< sal_Int32 >(n + named_.size());
+ css::uno::Sequence< css::uno::Reference< css::bridge::XBridge > > s(n);
+ sal_Int32 i = 0;
+ for (BridgeList::iterator j(unnamed_.begin()); j != unnamed_.end(); ++j) {
+ s[i++] = *j;
+ }
+ for (BridgeMap::iterator j(named_.begin()); j != named_.end(); ++j) {
+ s[i++] = j->second;
+ }
+ return s;
+}
+
+}
+
+namespace {
+
+static cppu::ImplementationEntry const services[] = {
+ { &binaryurp::BridgeFactory::static_create,
+ &binaryurp::BridgeFactory::static_getImplementationName,
+ &binaryurp::BridgeFactory::static_getSupportedServiceNames,
+ &cppu::createSingleComponentFactory, 0, 0 },
+ { 0, 0, 0, 0, 0, 0 }
+};
+
+}
+
+extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory(
+ char const * pImplName, void * pServiceManager, void * pRegistryKey)
+{
+ return cppu::component_getFactoryHelper(
+ pImplName, pServiceManager, pRegistryKey, services);
+}
+
+extern "C" SAL_DLLPUBLIC_EXPORT void SAL_CALL
+component_getImplementationEnvironment(
+ char const ** ppEnvTypeName, uno_Environment **)
+{
+ *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
+}
diff --git a/binaryurp/source/bridgefactory.hxx b/binaryurp/source/bridgefactory.hxx
new file mode 100755
index 000000000000..af6499d61bd0
--- /dev/null
+++ b/binaryurp/source/bridgefactory.hxx
@@ -0,0 +1,144 @@
+/*************************************************************************
+*
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2000, 2011 Oracle and/or its affiliates.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+*
+************************************************************************/
+
+#ifndef INCLUDED_BINARYURP_SOURCE_BRIDGEFACTORY_HXX
+#define INCLUDED_BINARYURP_SOURCE_BRIDGEFACTORY_HXX
+
+#include "sal/config.h"
+
+#include <list>
+#include <map>
+
+#include "boost/noncopyable.hpp"
+#include "com/sun/star/bridge/XBridgeFactory.hpp"
+#include "com/sun/star/lang/XServiceInfo.hpp"
+#include "com/sun/star/uno/Exception.hpp"
+#include "com/sun/star/uno/Reference.hxx"
+#include "com/sun/star/uno/RuntimeException.hpp"
+#include "cppuhelper/compbase2.hxx"
+#include "sal/types.h"
+
+namespace com { namespace sun { namespace star {
+ namespace connection { class XConnection; }
+ namespace uno {
+ class XComponentContext;
+ class XInterface;
+ }
+} } }
+
+namespace binaryurp {
+
+// That BridgeFactory derives from XComponent appears to be a historic mistake;
+// the implementation does not care about a disposed state:
+
+typedef
+ cppu::WeakComponentImplHelper2<
+ com::sun::star::lang::XServiceInfo,
+ com::sun::star::bridge::XBridgeFactory >
+ BridgeFactoryBase;
+
+class BridgeFactory:
+ private osl::Mutex, public BridgeFactoryBase, private boost::noncopyable
+{
+public:
+ static com::sun::star::uno::Reference< com::sun::star::uno::XInterface >
+ SAL_CALL static_create(
+ com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >
+ const & xContext)
+ SAL_THROW((com::sun::star::uno::Exception));
+
+ static rtl::OUString SAL_CALL static_getImplementationName();
+
+ static com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL
+ static_getSupportedServiceNames();
+
+ void removeBridge(
+ com::sun::star::uno::Reference< com::sun::star::bridge::XBridge >
+ const & bridge);
+
+ using BridgeFactoryBase::acquire;
+ using BridgeFactoryBase::release;
+
+private:
+ explicit BridgeFactory(
+ com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >
+ const & context);
+
+ virtual ~BridgeFactory();
+
+ 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);
+
+ virtual com::sun::star::uno::Reference< com::sun::star::bridge::XBridge >
+ SAL_CALL createBridge(
+ rtl::OUString const & sName, rtl::OUString const & sProtocol,
+ com::sun::star::uno::Reference<
+ com::sun::star::connection::XConnection > const & aConnection,
+ com::sun::star::uno::Reference<
+ com::sun::star::bridge::XInstanceProvider > const &
+ anInstanceProvider)
+ throw (
+ com::sun::star::bridge::BridgeExistsException,
+ com::sun::star::lang::IllegalArgumentException,
+ com::sun::star::uno::RuntimeException);
+
+ virtual com::sun::star::uno::Reference< com::sun::star::bridge::XBridge >
+ SAL_CALL getBridge(
+ rtl::OUString const & sName)
+ throw (com::sun::star::uno::RuntimeException);
+
+ virtual
+ com::sun::star::uno::Sequence<
+ com::sun::star::uno::Reference< com::sun::star::bridge::XBridge > >
+ SAL_CALL getExistingBridges() throw (com::sun::star::uno::RuntimeException);
+
+ typedef
+ std::list<
+ com::sun::star::uno::Reference< com::sun::star::bridge::XBridge > >
+ BridgeList;
+
+ typedef
+ std::map<
+ rtl::OUString,
+ com::sun::star::uno::Reference< com::sun::star::bridge::XBridge > >
+ BridgeMap;
+
+ com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >
+ context_;
+ BridgeList unnamed_;
+ BridgeMap named_;
+};
+
+}
+
+#endif
diff --git a/binaryurp/source/cache.hxx b/binaryurp/source/cache.hxx
new file mode 100755
index 000000000000..118b8a07b98d
--- /dev/null
+++ b/binaryurp/source/cache.hxx
@@ -0,0 +1,134 @@
+/*************************************************************************
+*
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2000, 2011 Oracle and/or its affiliates.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+*
+************************************************************************/
+
+#ifndef INCLUDED_BINARYURP_SOURCE_CACHE_HXX
+#define INCLUDED_BINARYURP_SOURCE_CACHE_HXX
+
+#include "sal/config.h"
+
+#include <cstddef>
+#include <map>
+
+#include "boost/noncopyable.hpp"
+#include "osl/diagnose.h"
+#include "sal/types.h"
+
+namespace binaryurp {
+
+namespace cache {
+
+enum { size = 256, ignore = 0xFFFF };
+
+}
+
+template< typename T > class Cache: private boost::noncopyable {
+public:
+ explicit Cache(std::size_t size):
+ size_(size), first_(map_.end()), last_(map_.end())
+ {
+ OSL_ASSERT(size < cache::ignore);
+ }
+
+ sal_uInt16 add(T const & content, bool * found) {
+ OSL_ASSERT(found != 0);
+ typename Map::iterator i(map_.find(content));
+ *found = i != map_.end();
+ if (i == map_.end()) {
+ typename Map::size_type n = map_.size();
+ if (n < size_) {
+ i =
+ (map_.insert(
+ typename Map::value_type(
+ content,
+ Entry(
+ static_cast< sal_uInt16 >(n), map_.end(),
+ first_)))).
+ first;
+ if (first_ == map_.end()) {
+ last_ = i;
+ } else {
+ first_->second.prev = i;
+ }
+ first_ = i;
+ } else if (last_ != map_.end()) {
+ i =
+ (map_.insert(
+ typename Map::value_type(
+ content,
+ Entry(last_->second.index, map_.end(), first_)))).
+ first;
+ first_->second.prev = i;
+ first_ = i;
+ typename Map::iterator j(last_);
+ last_ = last_->second.prev;
+ last_->second.next = map_.end();
+ map_.erase(j);
+ } else {
+ // Reached iff size_ == 0:
+ return cache::ignore;
+ }
+ } else if (i != first_) {
+ // Move to front (reached only if size_ > 1):
+ i->second.prev->second.next = i->second.next;
+ if (i->second.next == map_.end()) {
+ last_ = i->second.prev;
+ } else {
+ i->second.next->second.prev = i->second.prev;
+ }
+ i->second.prev = map_.end();
+ i->second.next = first_;
+ first_->second.prev = i;
+ first_ = i;
+ }
+ return i->second.index;
+ }
+
+private:
+ struct Entry;
+
+ typedef std::map< T, Entry > Map;
+
+ struct Entry {
+ sal_uInt16 index;
+ typename Map::iterator prev;
+ typename Map::iterator next;
+
+ Entry(
+ sal_uInt16 theIndex, typename Map::iterator thePrev,
+ typename Map::iterator theNext):
+ index(theIndex), prev(thePrev), next(theNext) {}
+ };
+
+ std::size_t size_;
+ Map map_;
+ typename Map::iterator first_;
+ typename Map::iterator last_;
+};
+
+}
+
+#endif
diff --git a/binaryurp/source/currentcontext.cxx b/binaryurp/source/currentcontext.cxx
new file mode 100644
index 000000000000..aed9640d84a0
--- /dev/null
+++ b/binaryurp/source/currentcontext.cxx
@@ -0,0 +1,80 @@
+/*************************************************************************
+*
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2000, 2011 Oracle and/or its affiliates.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+*
+************************************************************************/
+
+#include "sal/config.h"
+
+#include "com/sun/star/uno/Reference.hxx"
+#include "com/sun/star/uno/RuntimeException.hpp"
+#include "com/sun/star/uno/XInterface.hpp"
+#include "rtl/ustring.h"
+#include "rtl/ustring.hxx"
+#include "uno/current_context.h"
+#include "uno/dispatcher.hxx"
+#include "uno/lbnames.h"
+
+#include "currentcontext.hxx"
+
+namespace binaryurp {
+
+namespace {
+
+namespace css = com::sun::star;
+
+}
+
+namespace current_context {
+
+css::uno::UnoInterfaceReference get() {
+ css::uno::UnoInterfaceReference cc;
+ if (!uno_getCurrentContext(
+ reinterpret_cast< void ** >(&cc.m_pUnoI),
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(UNO_LB_UNO)).pData, 0))
+ {
+ throw css::uno::RuntimeException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM("uno_getCurrentContext failed")),
+ css::uno::Reference< css::uno::XInterface >());
+ }
+ return cc;
+}
+
+void set(css::uno::UnoInterfaceReference const & value) {
+ css::uno::UnoInterfaceReference cc(value);
+ if (!uno_setCurrentContext(
+ cc.m_pUnoI,
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(UNO_LB_UNO)).pData, 0))
+ {
+ throw css::uno::RuntimeException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM("uno_setCurrentContext failed")),
+ css::uno::Reference< css::uno::XInterface >());
+ }
+}
+
+}
+
+}
diff --git a/binaryurp/source/currentcontext.hxx b/binaryurp/source/currentcontext.hxx
new file mode 100644
index 000000000000..558d9ac04d5c
--- /dev/null
+++ b/binaryurp/source/currentcontext.hxx
@@ -0,0 +1,49 @@
+/*************************************************************************
+*
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2000, 2011 Oracle and/or its affiliates.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+*
+************************************************************************/
+
+#ifndef INCLUDED_BINARYURP_SOURCE_CURRENTCONTEXT_HXX
+#define INCLUDED_BINARYURP_SOURCE_CURRENTCONTEXT_HXX
+
+#include "sal/config.h"
+
+namespace com { namespace sun { namespace star { namespace uno {
+ class UnoInterfaceReference;
+} } } }
+
+namespace binaryurp {
+
+namespace current_context {
+
+com::sun::star::uno::UnoInterfaceReference get();
+
+void set(com::sun::star::uno::UnoInterfaceReference const & value);
+
+}
+
+}
+
+#endif
diff --git a/binaryurp/source/incomingreply.hxx b/binaryurp/source/incomingreply.hxx
new file mode 100644
index 000000000000..654542f701fa
--- /dev/null
+++ b/binaryurp/source/incomingreply.hxx
@@ -0,0 +1,58 @@
+/*************************************************************************
+*
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2000, 2011 Oracle and/or its affiliates.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+*
+************************************************************************/
+
+#ifndef INCLUDED_BINARYURP_SOURCE_INCOMINGREPLY_HXX
+#define INCLUDED_BINARYURP_SOURCE_INCOMINGREPLY_HXX
+
+#include "sal/config.h"
+
+#include <vector>
+
+#include "boost/noncopyable.hpp"
+
+#include "binaryany.hxx"
+
+namespace binaryurp {
+
+struct IncomingReply: private boost::noncopyable {
+ IncomingReply(
+ bool theException, BinaryAny const & theReturnValue,
+ std::vector< BinaryAny > const & theOutArguments):
+ exception(theException), returnValue(theReturnValue),
+ outArguments(theOutArguments)
+ {}
+
+ bool exception;
+
+ BinaryAny returnValue;
+
+ std::vector< BinaryAny > outArguments;
+};
+
+}
+
+#endif
diff --git a/binaryurp/source/incomingrequest.cxx b/binaryurp/source/incomingrequest.cxx
new file mode 100644
index 000000000000..646a868f66fd
--- /dev/null
+++ b/binaryurp/source/incomingrequest.cxx
@@ -0,0 +1,300 @@
+/*************************************************************************
+*
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2000, 2011 Oracle and/or its affiliates.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+*
+************************************************************************/
+
+#include "sal/config.h"
+
+#include <list>
+#include <vector>
+
+#include "boost/noncopyable.hpp"
+#include "com/sun/star/bridge/XInstanceProvider.hpp"
+#include "cppuhelper/exc_hlp.hxx"
+#include "rtl/byteseq.hxx"
+#include "rtl/ref.hxx"
+#include "rtl/ustring.hxx"
+#include "sal/types.h"
+#include "typelib/typedescription.hxx"
+#include "uno/dispatcher.hxx"
+
+#include "binaryany.hxx"
+#include "bridge.hxx"
+#include "currentcontext.hxx"
+#include "incomingrequest.hxx"
+#include "specialfunctionids.hxx"
+
+namespace binaryurp {
+
+namespace {
+
+namespace css = com::sun::star;
+
+}
+
+IncomingRequest::IncomingRequest(
+ rtl::Reference< Bridge > const & bridge, rtl::ByteSequence const & tid,
+ rtl::OUString const & oid, css::uno::UnoInterfaceReference const & object,
+ css::uno::TypeDescription const & type, sal_uInt16 functionId,
+ bool synchronous, css::uno::TypeDescription const & member, bool setter,
+ std::vector< BinaryAny > const & inArguments, bool currentContextMode,
+ css::uno::UnoInterfaceReference const & currentContext):
+ bridge_(bridge), tid_(tid), oid_(oid), object_(object), type_(type),
+ functionId_(functionId), synchronous_(synchronous), member_(member),
+ setter_(setter), inArguments_(inArguments),
+ currentContextMode_(currentContextMode), currentContext_(currentContext)
+{
+ OSL_ASSERT(bridge.is() && member.is() && member.get()->bComplete);
+}
+
+IncomingRequest::~IncomingRequest() {}
+
+void IncomingRequest::execute() const {
+ BinaryAny ret;
+ std::vector< BinaryAny > outArgs;
+ bool isExc;
+ try {
+ bool resetCc = false;
+ css::uno::UnoInterfaceReference oldCc;
+ if (currentContextMode_) {
+ oldCc = current_context::get();
+ current_context::set(currentContext_);
+ resetCc = true;
+ }
+ try {
+ try {
+ isExc = !execute_throw(&ret, &outArgs);
+ } catch (std::exception & e) {
+ throw css::uno::RuntimeException(
+ (rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM("caught C++ exception: ")) +
+ rtl::OStringToOUString(
+ rtl::OString(e.what()), RTL_TEXTENCODING_ASCII_US)),
+ css::uno::Reference< css::uno::XInterface >());
+ // best-effort string conversion
+ }
+ } catch (css::uno::RuntimeException &) {
+ css::uno::Any exc(cppu::getCaughtException());
+ ret = bridge_->mapCppToBinaryAny(exc);
+ isExc = true;
+ }
+ if (resetCc) {
+ current_context::set(oldCc);
+ }
+ } catch (css::uno::RuntimeException &) {
+ css::uno::Any exc(cppu::getCaughtException());
+ ret = bridge_->mapCppToBinaryAny(exc);
+ isExc = true;
+ }
+ if (synchronous_) {
+ bridge_->decrementActiveCalls();
+ try {
+ bridge_->getWriter()->queueReply(
+ tid_, member_, setter_, isExc, ret, outArgs, false);
+ return;
+ } catch (css::uno::RuntimeException & e) {
+ OSL_TRACE(
+ OSL_LOG_PREFIX "caught UNO runtime exception '%s'",
+ (rtl::OUStringToOString(e.Message, RTL_TEXTENCODING_UTF8).
+ getStr()));
+ } catch (std::exception & e) {
+ OSL_TRACE(OSL_LOG_PREFIX "caught C++ exception '%s'", e.what());
+ }
+ bridge_->terminate();
+ } else {
+ if (isExc) {
+ OSL_TRACE(OSL_LOG_PREFIX "oneway method raised exception");
+ }
+ bridge_->decrementCalls();
+ }
+}
+
+bool IncomingRequest::execute_throw(
+ BinaryAny * returnValue, std::vector< BinaryAny > * outArguments) const
+{
+ OSL_ASSERT(
+ returnValue != 0 &&
+ returnValue->getType().equals(
+ css::uno::TypeDescription(
+ cppu::UnoType< cppu::UnoVoidType >::get())) &&
+ outArguments != 0 && outArguments->empty());
+ bool isExc = false;
+ switch (functionId_) {
+ case SPECIAL_FUNCTION_ID_RESERVED:
+ OSL_ASSERT(false); // this cannot happen
+ break;
+ case SPECIAL_FUNCTION_ID_RELEASE:
+ bridge_->releaseStub(oid_, type_);
+ break;
+ case SPECIAL_FUNCTION_ID_QUERY_INTERFACE:
+ if (!object_.is()) {
+ css::uno::Reference< css::uno::XInterface > ifc;
+ css::uno::Reference< css::bridge::XInstanceProvider > prov(
+ bridge_->getProvider());
+ if (prov.is()) {
+ try {
+ ifc = prov->getInstance(oid_);
+ } catch (css::container::NoSuchElementException & e) {
+ OSL_TRACE(
+ (OSL_LOG_PREFIX "initial element '%s':"
+ " NoSuchElementException '%s'"),
+ (rtl::OUStringToOString(oid_, RTL_TEXTENCODING_UTF8).
+ getStr()),
+ (rtl::OUStringToOString(
+ e.Message, RTL_TEXTENCODING_UTF8).
+ getStr()));
+ }
+ }
+ if (ifc.is()) {
+ css::uno::UnoInterfaceReference unoIfc(
+ static_cast< uno_Interface * >(
+ bridge_->getCppToBinaryMapping().mapInterface(
+ ifc.get(),
+ (css::uno::TypeDescription(
+ cppu::UnoType<
+ css::uno::Reference<
+ css::uno::XInterface > >::get()).
+ get()))),
+ SAL_NO_ACQUIRE);
+ *returnValue = BinaryAny(
+ css::uno::TypeDescription(
+ cppu::UnoType<
+ css::uno::Reference<
+ css::uno::XInterface > >::get()),
+ &unoIfc.m_pUnoI);
+ }
+ break;
+ }
+ // fall through
+ default:
+ {
+ OSL_ASSERT(object_.is());
+ css::uno::TypeDescription retType;
+ std::list< std::vector< char > > outBufs;
+ std::vector< void * > args;
+ switch (member_.get()->eTypeClass) {
+ case typelib_TypeClass_INTERFACE_ATTRIBUTE:
+ {
+ css::uno::TypeDescription t(
+ reinterpret_cast<
+ typelib_InterfaceAttributeTypeDescription * >(
+ member_.get())->
+ pAttributeTypeRef);
+ if (setter_) {
+ OSL_ASSERT(inArguments_.size() == 1);
+ args.push_back(inArguments_[0].getValue(t));
+ } else {
+ OSL_ASSERT(inArguments_.empty());
+ retType = t;
+ }
+ break;
+ }
+ case typelib_TypeClass_INTERFACE_METHOD:
+ {
+ typelib_InterfaceMethodTypeDescription * mtd =
+ reinterpret_cast<
+ typelib_InterfaceMethodTypeDescription * >(
+ member_.get());
+ retType = css::uno::TypeDescription(mtd->pReturnTypeRef);
+ std::vector< BinaryAny >::const_iterator i(
+ inArguments_.begin());
+ for (sal_Int32 j = 0; j != mtd->nParams; ++j) {
+ void * p;
+ if (mtd->pParams[j].bIn) {
+ p = i++->getValue(
+ css::uno::TypeDescription(
+ mtd->pParams[j].pTypeRef));
+ } else {
+ outBufs.push_back(
+ std::vector< char >(
+ css::uno::TypeDescription(
+ mtd->pParams[j].pTypeRef).
+ get()->nSize));
+ p = &outBufs.back()[0];
+ }
+ args.push_back(p);
+ if (mtd->pParams[j].bOut) {
+ outArguments->push_back(BinaryAny());
+ }
+ }
+ OSL_ASSERT(i == inArguments_.end());
+ break;
+ }
+ default:
+ OSL_ASSERT(false); // this cannot happen
+ break;
+ }
+ std::vector< char > retBuf(retType.is() ? retType.get()->nSize : 0);
+ uno_Any exc;
+ uno_Any * pexc = &exc;
+ (*object_.get()->pDispatcher)(
+ object_.get(), member_.get(), retBuf.empty() ? 0 : &retBuf[0],
+ args.empty() ? 0 : &args[0], &pexc);
+ isExc = pexc != 0;
+ if (isExc) {
+ *returnValue = BinaryAny(
+ css::uno::TypeDescription(
+ cppu::UnoType< css::uno::Any >::get()),
+ &exc);
+ uno_any_destruct(&exc, 0);
+ } else {
+ if (!retBuf.empty()) {
+ *returnValue = BinaryAny(retType, &retBuf[0]);
+ uno_destructData(&retBuf[0], retType.get(), 0);
+ }
+ if (!outArguments->empty()) {
+ OSL_ASSERT(
+ member_.get()->eTypeClass ==
+ typelib_TypeClass_INTERFACE_METHOD);
+ typelib_InterfaceMethodTypeDescription * mtd =
+ reinterpret_cast<
+ typelib_InterfaceMethodTypeDescription * >(
+ member_.get());
+ std::vector< BinaryAny >::iterator i(outArguments->begin());
+ std::list< std::vector< char > >::iterator j(
+ outBufs.begin());
+ for (sal_Int32 k = 0; k != mtd->nParams; ++k) {
+ if (mtd->pParams[k].bOut) {
+ *i++ = BinaryAny(
+ css::uno::TypeDescription(
+ mtd->pParams[k].pTypeRef),
+ args[k]);
+ }
+ if (!mtd->pParams[k].bIn) {
+ uno_type_destructData(
+ &(*j++)[0], mtd->pParams[k].pTypeRef, 0);
+ }
+ }
+ OSL_ASSERT(i == outArguments->end());
+ OSL_ASSERT(j == outBufs.end());
+ }
+ }
+ break;
+ }
+ }
+ return !isExc;
+}
+
+}
diff --git a/binaryurp/source/incomingrequest.hxx b/binaryurp/source/incomingrequest.hxx
new file mode 100644
index 000000000000..ead7067f8ae9
--- /dev/null
+++ b/binaryurp/source/incomingrequest.hxx
@@ -0,0 +1,86 @@
+/*************************************************************************
+*
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2000, 2011 Oracle and/or its affiliates.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+*
+************************************************************************/
+
+#ifndef INCLUDED_BINARYURP_SOURCE_INCOMINGREQUEST_HXX
+#define INCLUDED_BINARYURP_SOURCE_INCOMINGREQUEST_HXX
+
+#include "sal/config.h"
+
+#include <vector>
+
+#include "boost/noncopyable.hpp"
+#include "rtl/byteseq.hxx"
+#include "rtl/ref.hxx"
+#include "rtl/ustring.hxx"
+#include "sal/types.h"
+#include "typelib/typedescription.hxx"
+#include "uno/dispatcher.hxx"
+
+namespace binaryurp {
+ class BinaryAny;
+ class Bridge;
+}
+
+namespace binaryurp {
+
+class IncomingRequest: private boost::noncopyable {
+public:
+ IncomingRequest(
+ rtl::Reference< Bridge > const & bridge, rtl::ByteSequence const & tid,
+ rtl::OUString const & oid,
+ com::sun::star::uno::UnoInterfaceReference const & object,
+ com::sun::star::uno::TypeDescription const & type,
+ sal_uInt16 functionId, bool synchronous,
+ com::sun::star::uno::TypeDescription const & member, bool setter,
+ std::vector< BinaryAny > const & inArguments, bool currentContextMode,
+ com::sun::star::uno::UnoInterfaceReference const & currentContext);
+
+ ~IncomingRequest();
+
+ void execute() const;
+
+private:
+ bool execute_throw(
+ BinaryAny * returnValue, std::vector< BinaryAny > * outArguments) const;
+
+ rtl::Reference< Bridge > bridge_;
+ rtl::ByteSequence tid_;
+ rtl::OUString oid_; // initial object queryInterface; release
+ com::sun::star::uno::UnoInterfaceReference object_;
+ com::sun::star::uno::TypeDescription type_;
+ sal_uInt16 functionId_;
+ bool synchronous_;
+ com::sun::star::uno::TypeDescription member_;
+ bool setter_;
+ std::vector< BinaryAny > inArguments_;
+ bool currentContextMode_;
+ com::sun::star::uno::UnoInterfaceReference currentContext_;
+};
+
+}
+
+#endif
diff --git a/binaryurp/source/lessoperators.cxx b/binaryurp/source/lessoperators.cxx
new file mode 100644
index 000000000000..354118625ce8
--- /dev/null
+++ b/binaryurp/source/lessoperators.cxx
@@ -0,0 +1,71 @@
+/*************************************************************************
+*
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2000, 2011 Oracle and/or its affiliates.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+*
+************************************************************************/
+
+#include "sal/config.h"
+
+#include <algorithm>
+
+#include "osl/diagnose.h"
+#include "rtl/byteseq.hxx"
+#include "rtl/ustring.hxx"
+#include "sal/types.h"
+#include "typelib/typeclass.h"
+#include "typelib/typedescription.hxx"
+
+#include "lessoperators.hxx"
+
+namespace com { namespace sun { namespace star { namespace uno {
+
+bool operator <(TypeDescription const & left, TypeDescription const & right) {
+ OSL_ASSERT(left.is() && right.is());
+ typelib_TypeClass tc1 = left.get()->eTypeClass;
+ typelib_TypeClass tc2 = right.get()->eTypeClass;
+ return tc1 < tc2 ||
+ (tc1 == tc2 &&
+ (rtl::OUString(left.get()->pTypeName) <
+ rtl::OUString(right.get()->pTypeName)));
+}
+
+} } } }
+
+namespace rtl {
+
+bool operator <(ByteSequence const & left, ByteSequence const & right) {
+ for (sal_Int32 i = 0; i != std::min(left.getLength(), right.getLength());
+ ++i)
+ {
+ if (left[i] < right[i]) {
+ return true;
+ }
+ if (right[i] < left[i]) {
+ return false;
+ }
+ }
+ return left.getLength() < right.getLength();
+}
+
+}
diff --git a/binaryurp/source/lessoperators.hxx b/binaryurp/source/lessoperators.hxx
new file mode 100644
index 000000000000..014f0f4d56bf
--- /dev/null
+++ b/binaryurp/source/lessoperators.hxx
@@ -0,0 +1,50 @@
+/*************************************************************************
+*
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2000, 2011 Oracle and/or its affiliates.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+*
+************************************************************************/
+
+#ifndef INCLUDED_BINARYURP_SOURCE_LESSOPERATORS_HXX
+#define INCLUDED_BINARYURP_SOURCE_LESSOPERATORS_HXX
+
+#include "sal/config.h"
+
+namespace com { namespace sun { namespace star { namespace uno {
+ class TypeDescription;
+} } } }
+namespace rtl { class ByteSequence; }
+
+namespace com { namespace sun { namespace star { namespace uno {
+
+bool operator <(TypeDescription const & left, TypeDescription const & right);
+
+} } } }
+
+namespace rtl {
+
+bool operator <(ByteSequence const & left, ByteSequence const & right);
+
+}
+
+#endif
diff --git a/remotebridges/source/factory/makefile.mk b/binaryurp/source/makefile.mk
index b47207077fff..ca9e7c72b65d 100644
--- a/remotebridges/source/factory/makefile.mk
+++ b/binaryurp/source/makefile.mk
@@ -1,8 +1,8 @@
#*************************************************************************
#
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# Copyright 2000, 2011 Oracle and/or its affiliates.
#
# OpenOffice.org - a multi-platform office productivity suite
#
@@ -23,51 +23,47 @@
# <http://www.openoffice.org/license.html>
# for a copy of the LGPLv3 License.
#
-#*************************************************************************
+#***********************************************************************/
-PRJ=..$/..
+PRJ = ..
+PRJNAME = binaryurp
+TARGET = binaryurp
-PRJNAME=remotebridges
-TARGET = bridgefac.uno
-ENABLE_EXCEPTIONS=TRUE
-COMP1TYPELIST = brdgfctr
-
-# --- Settings -----------------------------------------------------
-.INCLUDE : settings.mk
-.IF "$(L10N_framework)"==""
-DLLPRE =
-# ------------------------------------------------------------------
+ENABLE_EXCEPTIONS = TRUE
+VISIBILITY_HIDDEN = TRUE
-SLOFILES= \
- $(SLO)$/bridgefactory.obj\
- $(SLO)$/bridgeimpl.obj
+.INCLUDE: settings.mk
-SHL1TARGET= $(TARGET)
-SHL1VERSIONMAP = $(SOLARENV)/src/unloadablecomponent.map
-
-SHL1STDLIBS= \
- $(SALLIB) \
- $(CPPULIB) \
- $(CPPUHELPERLIB) \
- $(RMCXTLIB)
-
-#SHL1DEPN=
-SHL1IMPLIB= i$(TARGET)
-SHL1LIBS= $(SLB)$/$(TARGET).lib
-SHL1DEF= $(MISC)$/$(SHL1TARGET).def
-SHL1RPATH= URELIB
+DLLPRE =
-DEF1NAME= $(SHL1TARGET)
-.ENDIF # L10N_framework
+SLOFILES = \
+ $(SLO)/binaryany.obj \
+ $(SLO)/bridge.obj \
+ $(SLO)/bridgefactory.obj \
+ $(SLO)/currentcontext.obj \
+ $(SLO)/incomingrequest.obj \
+ $(SLO)/lessoperators.obj \
+ $(SLO)/marshal.obj \
+ $(SLO)/outgoingrequests.obj \
+ $(SLO)/proxy.obj \
+ $(SLO)/reader.obj \
+ $(SLO)/unmarshal.obj \
+ $(SLO)/writer.obj
-# --- Targets ------------------------------------------------------
+SHL1IMPLIB = i$(SHL1TARGET)
+SHL1OBJS = $(SLOFILES)
+SHL1RPATH = URELIB
+SHL1STDLIBS = $(CPPUHELPERLIB) $(CPPULIB) $(SALHELPERLIB) $(SALLIB)
+SHL1TARGET = binaryurp.uno
+SHL1USE_EXPORTS = name
+DEF1NAME = $(SHL1TARGET)
-.INCLUDE : target.mk
+.INCLUDE: target.mk
-ALLTAR : $(MISC)/bridgefac.component
+ALLTAR : $(MISC)/binaryurp.component
-$(MISC)/bridgefac.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \
- bridgefac.component
+$(MISC)/binaryurp.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \
+ binaryurp.component
$(XSLTPROC) --nonet --stringparam uri \
'$(COMPONENTPREFIX_URE_NATIVE)$(SHL1TARGETN:f)' -o $@ \
- $(SOLARENV)/bin/createcomponent.xslt bridgefac.component
+ $(SOLARENV)/bin/createcomponent.xslt binaryurp.component
diff --git a/binaryurp/source/marshal.cxx b/binaryurp/source/marshal.cxx
new file mode 100644
index 000000000000..ce520382efac
--- /dev/null
+++ b/binaryurp/source/marshal.cxx
@@ -0,0 +1,314 @@
+/*************************************************************************
+*
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2000, 2011 Oracle and/or its affiliates.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+*
+************************************************************************/
+
+#include "sal/config.h"
+
+#include <vector>
+
+#include "boost/noncopyable.hpp"
+#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/XInterface.hpp"
+#include "cppu/unotype.hxx"
+#include "osl/diagnose.h"
+#include "rtl/byteseq.hxx"
+#include "rtl/string.hxx"
+#include "rtl/textcvt.h"
+#include "rtl/textenc.h"
+#include "rtl/ustring.h"
+#include "rtl/ustring.hxx"
+#include "sal/types.h"
+#include "typelib/typeclass.h"
+#include "typelib/typedescription.h"
+#include "typelib/typedescription.hxx"
+#include "uno/dispatcher.hxx"
+
+#include "binaryany.hxx"
+#include "bridge.hxx"
+#include "cache.hxx"
+#include "lessoperators.hxx"
+#include "marshal.hxx"
+
+namespace binaryurp {
+
+namespace {
+
+namespace css = com::sun::star;
+
+void write64(std::vector< unsigned char > * buffer, sal_uInt64 value) {
+ Marshal::write8(buffer, value >> 56);
+ Marshal::write8(buffer, (value >> 48) & 0xFF);
+ Marshal::write8(buffer, (value >> 40) & 0xFF);
+ Marshal::write8(buffer, (value >> 32) & 0xFF);
+ Marshal::write8(buffer, (value >> 24) & 0xFF);
+ Marshal::write8(buffer, (value >> 16) & 0xFF);
+ Marshal::write8(buffer, (value >> 8) & 0xFF);
+ Marshal::write8(buffer, value & 0xFF);
+}
+
+void writeCompressed(std::vector< unsigned char > * buffer, sal_uInt32 value) {
+ if (value < 0xFF) {
+ Marshal::write8(buffer, static_cast< sal_uInt8 >(value));
+ } else {
+ Marshal::write8(buffer, 0xFF);
+ Marshal::write32(buffer, value);
+ }
+}
+
+void writeString(
+ std::vector< unsigned char > * buffer, rtl::OUString const & value)
+{
+ OSL_ASSERT(buffer != 0);
+ rtl::OString v;
+ if (!value.convertToString(
+ &v, RTL_TEXTENCODING_UTF8,
+ (RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR |
+ RTL_UNICODETOTEXT_FLAGS_INVALID_ERROR)))
+ {
+ throw css::uno::RuntimeException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "UNO string contains invalid UTF-16 sequence")),
+ css::uno::Reference< css::uno::XInterface >());
+ }
+ writeCompressed(buffer, static_cast< sal_uInt32 >(v.getLength()));
+ buffer->insert(buffer->end(), v.getStr(), v.getStr() + v.getLength());
+}
+
+}
+
+Marshal::Marshal(rtl::Reference< Bridge > const & bridge, WriterState & state):
+ bridge_(bridge), state_(state)
+{
+ OSL_ASSERT(bridge.is());
+}
+
+Marshal::~Marshal() {}
+
+void Marshal::write8(std::vector< unsigned char > * buffer, sal_uInt8 value) {
+ OSL_ASSERT(buffer != 0);
+ buffer->push_back(value);
+}
+
+void Marshal::write16(std::vector< unsigned char > * buffer, sal_uInt16 value) {
+ write8(buffer, value >> 8);
+ write8(buffer, value & 0xFF);
+}
+
+void Marshal::write32(std::vector< unsigned char > * buffer, sal_uInt32 value) {
+ write8(buffer, value >> 24);
+ write8(buffer, (value >> 16) & 0xFF);
+ write8(buffer, (value >> 8) & 0xFF);
+ write8(buffer, value & 0xFF);
+}
+
+void Marshal::writeValue(
+ std::vector< unsigned char > * buffer,
+ css::uno::TypeDescription const & type, BinaryAny const & value)
+{
+ OSL_ASSERT(
+ type.is() &&
+ (type.get()->eTypeClass == typelib_TypeClass_ANY ||
+ value.getType().equals(type)));
+ writeValue(buffer, type, value.getValue(type));
+}
+
+void Marshal::writeType(
+ std::vector< unsigned char > * buffer,
+ css::uno::TypeDescription const & value)
+{
+ value.makeComplete();
+ OSL_ASSERT(value.is());
+ typelib_TypeClass tc = value.get()->eTypeClass;
+ if (tc <= typelib_TypeClass_ANY) {
+ write8(buffer, static_cast< sal_uInt8 >(tc));
+ } else {
+ bool found;
+ sal_uInt16 idx = state_.typeCache.add(value, &found);
+ if (found) {
+ write8(buffer, static_cast< sal_uInt8 >(tc));
+ write16(buffer, idx);
+ } else {
+ write8(buffer, static_cast< sal_uInt8 >(tc) | 0x80);
+ write16(buffer, idx);
+ writeString(buffer, rtl::OUString(value.get()->pTypeName));
+ }
+ }
+}
+
+void Marshal::writeOid(
+ std::vector< unsigned char > * buffer, rtl::OUString const & oid)
+{
+ bool found;
+ sal_uInt16 idx;
+ if (oid.getLength() == 0) {
+ found = true;
+ idx = cache::ignore;
+ } else {
+ idx = state_.oidCache.add(oid, &found);
+ }
+ if (found) {
+ write8(buffer, 0);
+ } else {
+ writeString(buffer, oid);
+ }
+ write16(buffer, idx);
+}
+
+void Marshal::writeTid(
+ std::vector< unsigned char > * buffer, rtl::ByteSequence const & tid)
+{
+ bool found;
+ sal_uInt16 idx = state_.tidCache.add(tid, &found);
+ if (found) {
+ write8(buffer, 0);
+ } else {
+ sal_Sequence * p = tid.getHandle();
+ writeValue(
+ buffer,
+ css::uno::TypeDescription(
+ cppu::UnoType< css::uno::Sequence< sal_Int8 > >::get()), &p);
+ }
+ write16(buffer, idx);
+}
+
+void Marshal::writeValue(
+ std::vector< unsigned char > * buffer,
+ css::uno::TypeDescription const & type, void const * value)
+{
+ OSL_ASSERT(buffer != 0 && type.is());
+ type.makeComplete();
+ switch (type.get()->eTypeClass) {
+ case typelib_TypeClass_VOID:
+ break;
+ case typelib_TypeClass_BOOLEAN:
+ OSL_ASSERT(*static_cast< sal_uInt8 const * >(value) <= 1);
+ // fall through
+ case typelib_TypeClass_BYTE:
+ write8(buffer, *static_cast< sal_uInt8 const * >(value));
+ break;
+ case typelib_TypeClass_SHORT:
+ case typelib_TypeClass_UNSIGNED_SHORT:
+ case typelib_TypeClass_CHAR:
+ write16(buffer, *static_cast< sal_uInt16 const * >(value));
+ break;
+ case typelib_TypeClass_LONG:
+ case typelib_TypeClass_UNSIGNED_LONG:
+ case typelib_TypeClass_FLOAT:
+ case typelib_TypeClass_ENUM:
+ write32(buffer, *static_cast< sal_uInt32 const * >(value));
+ break;
+ case typelib_TypeClass_HYPER:
+ case typelib_TypeClass_UNSIGNED_HYPER:
+ case typelib_TypeClass_DOUBLE:
+ write64(buffer, *static_cast< sal_uInt64 const * >(value));
+ break;
+ case typelib_TypeClass_STRING:
+ writeString(
+ buffer,
+ rtl::OUString(*static_cast< rtl_uString * const * >(value)));
+ break;
+ case typelib_TypeClass_TYPE:
+ writeType(
+ buffer,
+ css::uno::TypeDescription(
+ *static_cast< typelib_TypeDescriptionReference * const * >(
+ value)));
+ break;
+ case typelib_TypeClass_ANY:
+ {
+ uno_Any const * p = static_cast< uno_Any const * >(value);
+ css::uno::TypeDescription t(p->pType);
+ writeType(buffer, t);
+ writeValue(buffer, t, p->pData);
+ break;
+ }
+ case typelib_TypeClass_SEQUENCE:
+ {
+ sal_Sequence * p = *static_cast< sal_Sequence * const * >(value);
+ writeCompressed(buffer, static_cast< sal_uInt32 >(p->nElements));
+ css::uno::TypeDescription ctd(
+ reinterpret_cast< typelib_IndirectTypeDescription * >(
+ type.get())->
+ pType);
+ OSL_ASSERT(ctd.is());
+ if (ctd.get()->eTypeClass == typelib_TypeClass_BYTE) {
+ buffer->insert(
+ buffer->end(), p->elements, p->elements + p->nElements);
+ } else {
+ for (sal_Int32 i = 0; i != p->nElements; ++i) {
+ writeValue(buffer, ctd, p->elements + i * ctd.get()->nSize);
+ }
+ }
+ break;
+ }
+ case typelib_TypeClass_STRUCT:
+ case typelib_TypeClass_EXCEPTION:
+ writeMemberValues(buffer, type, value);
+ break;
+ case typelib_TypeClass_INTERFACE:
+ writeOid(
+ buffer,
+ bridge_->registerOutgoingInterface(
+ css::uno::UnoInterfaceReference(
+ *static_cast< uno_Interface * const * >(value)),
+ type));
+ break;
+ default:
+ OSL_ASSERT(false); // this cannot happen
+ break;
+ }
+}
+
+void Marshal::writeMemberValues(
+ std::vector< unsigned char > * buffer,
+ css::uno::TypeDescription const & type, void const * aggregateValue)
+{
+ OSL_ASSERT(
+ type.is() &&
+ (type.get()->eTypeClass == typelib_TypeClass_STRUCT ||
+ type.get()->eTypeClass == typelib_TypeClass_EXCEPTION) &&
+ aggregateValue != 0);
+ type.makeComplete();
+ typelib_CompoundTypeDescription * ctd =
+ reinterpret_cast< typelib_CompoundTypeDescription * >(type.get());
+ if (ctd->pBaseTypeDescription != 0) {
+ writeMemberValues(
+ buffer,
+ css::uno::TypeDescription(&ctd->pBaseTypeDescription->aBase),
+ aggregateValue);
+ }
+ for (sal_Int32 i = 0; i != ctd->nMembers; ++i) {
+ writeValue(
+ buffer, css::uno::TypeDescription(ctd->ppTypeRefs[i]),
+ (static_cast< char const * >(aggregateValue) +
+ ctd->pMemberOffsets[i]));
+ }
+}
+
+}
diff --git a/binaryurp/source/marshal.hxx b/binaryurp/source/marshal.hxx
new file mode 100755
index 000000000000..a922ec1008f6
--- /dev/null
+++ b/binaryurp/source/marshal.hxx
@@ -0,0 +1,95 @@
+/*************************************************************************
+*
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2000, 2011 Oracle and/or its affiliates.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+*
+************************************************************************/
+
+#ifndef INCLUDED_BINARYURP_SOURCE_MARSHAL_HXX
+#define INCLUDED_BINARYURP_SOURCE_MARSHAL_HXX
+
+#include "sal/config.h"
+
+#include <vector>
+
+#include "boost/noncopyable.hpp"
+#include "rtl/byteseq.hxx"
+#include "rtl/ref.hxx"
+#include "rtl/ustring.hxx"
+#include "sal/types.h"
+#include "typelib/typedescription.hxx"
+
+namespace binaryurp {
+ class BinaryAny;
+ class Bridge;
+ struct WriterState;
+}
+
+namespace binaryurp {
+
+class Marshal: private boost::noncopyable {
+public:
+ Marshal(rtl::Reference< Bridge > const & bridge, WriterState & state);
+
+ ~Marshal();
+
+ static void write8(std::vector< unsigned char > * buffer, sal_uInt8 value);
+
+ static void write16(
+ std::vector< unsigned char > * buffer, sal_uInt16 value);
+
+ static void write32(
+ std::vector< unsigned char > * buffer, sal_uInt32 value);
+
+ void writeValue(
+ std::vector< unsigned char > * buffer,
+ com::sun::star::uno::TypeDescription const & type,
+ BinaryAny const & value);
+
+ void writeType(
+ std::vector< unsigned char > * buffer,
+ com::sun::star::uno::TypeDescription const & value);
+
+ void writeOid(
+ std::vector< unsigned char > * buffer, rtl::OUString const & oid);
+
+ void writeTid(
+ std::vector< unsigned char > * buffer, rtl::ByteSequence const & tid);
+
+private:
+ void writeValue(
+ std::vector< unsigned char > * buffer,
+ com::sun::star::uno::TypeDescription const & type, void const * value);
+
+ void writeMemberValues(
+ std::vector< unsigned char > * buffer,
+ com::sun::star::uno::TypeDescription const & type,
+ void const * aggregateValue);
+
+ rtl::Reference< Bridge > bridge_;
+ WriterState & state_;
+};
+
+}
+
+#endif
diff --git a/binaryurp/source/outgoingrequest.hxx b/binaryurp/source/outgoingrequest.hxx
new file mode 100644
index 000000000000..7fe67bf96a3b
--- /dev/null
+++ b/binaryurp/source/outgoingrequest.hxx
@@ -0,0 +1,55 @@
+/*************************************************************************
+*
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2000, 2011 Oracle and/or its affiliates.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+*
+************************************************************************/
+
+#ifndef INCLUDED_BINARYURP_SOURCE_OUTGOINGREQUEST_HXX
+#define INCLUDED_BINARYURP_SOURCE_OUTGOINGREQUEST_HXX
+
+#include "sal/config.h"
+
+#include "typelib/typedescription.hxx"
+
+namespace binaryurp {
+
+struct OutgoingRequest {
+ enum Kind { KIND_NORMAL, KIND_REQUEST_CHANGE, KIND_COMMIT_CHANGE };
+
+ OutgoingRequest(
+ Kind theKind, com::sun::star::uno::TypeDescription const & theMember,
+ bool theSetter):
+ kind(theKind), member(theMember), setter(theSetter)
+ {}
+
+ Kind kind;
+
+ com::sun::star::uno::TypeDescription member;
+
+ bool setter;
+};
+
+}
+
+#endif
diff --git a/binaryurp/source/outgoingrequests.cxx b/binaryurp/source/outgoingrequests.cxx
new file mode 100644
index 000000000000..388b7755466f
--- /dev/null
+++ b/binaryurp/source/outgoingrequests.cxx
@@ -0,0 +1,80 @@
+/*************************************************************************
+*
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2000, 2011 Oracle and/or its affiliates.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+*
+************************************************************************/
+
+#include "sal/config.h"
+
+#include "com/sun/star/uno/RuntimeException.hpp"
+#include "rtl/byteseq.hxx"
+#include "osl/mutex.hxx"
+
+#include "lessoperators.hxx"
+#include "outgoingrequest.hxx"
+#include "outgoingrequests.hxx"
+
+namespace binaryurp {
+
+namespace {
+
+namespace css = com::sun::star;
+
+}
+
+OutgoingRequests::OutgoingRequests() {}
+
+OutgoingRequests::~OutgoingRequests() {}
+
+void OutgoingRequests::push(
+ rtl::ByteSequence const & tid, OutgoingRequest const & request)
+{
+ osl::MutexGuard g(mutex_);
+ map_[tid].push_back(request);
+}
+
+OutgoingRequest OutgoingRequests::top(rtl::ByteSequence const & tid) {
+ osl::MutexGuard g(mutex_);
+ Map::iterator i(map_.find(tid));
+ if (i == map_.end()) {
+ throw css::uno::RuntimeException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM("URP: reply for unknown TID")),
+ css::uno::Reference< css::uno::XInterface >());
+ }
+ OSL_ASSERT(!i->second.empty());
+ return i->second.back();
+}
+
+void OutgoingRequests::pop(rtl::ByteSequence const & tid) throw () {
+ osl::MutexGuard g(mutex_);
+ Map::iterator i(map_.find(tid));
+ OSL_ASSERT(i != map_.end());
+ i->second.pop_back();
+ if (i->second.empty()) {
+ map_.erase(i);
+ }
+}
+
+}
diff --git a/binaryurp/source/outgoingrequests.hxx b/binaryurp/source/outgoingrequests.hxx
new file mode 100644
index 000000000000..92ee622bf682
--- /dev/null
+++ b/binaryurp/source/outgoingrequests.hxx
@@ -0,0 +1,65 @@
+/*************************************************************************
+*
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2000, 2011 Oracle and/or its affiliates.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+*
+************************************************************************/
+
+#ifndef INCLUDED_BINARYURP_SOURCE_OUTGOINGREQUESTS_HXX
+#define INCLUDED_BINARYURP_SOURCE_OUTGOINGREQUESTS_HXX
+
+#include "sal/config.h"
+
+#include <map>
+#include <vector>
+
+#include "boost/noncopyable.hpp"
+#include "osl/mutex.hxx"
+
+namespace binaryurp { struct OutgoingRequest; }
+namespace rtl { class ByteSequence; }
+
+namespace binaryurp {
+
+class OutgoingRequests: private boost::noncopyable {
+public:
+ OutgoingRequests();
+
+ ~OutgoingRequests();
+
+ void push(rtl::ByteSequence const & tid, OutgoingRequest const & request);
+
+ OutgoingRequest top(rtl::ByteSequence const & tid);
+
+ void pop(rtl::ByteSequence const & tid) throw ();
+
+private:
+ typedef std::map< rtl::ByteSequence, std::vector< OutgoingRequest > > Map;
+
+ osl::Mutex mutex_;
+ Map map_;
+};
+
+}
+
+#endif
diff --git a/binaryurp/source/proxy.cxx b/binaryurp/source/proxy.cxx
new file mode 100644
index 000000000000..876199e7bc17
--- /dev/null
+++ b/binaryurp/source/proxy.cxx
@@ -0,0 +1,260 @@
+/*************************************************************************
+*
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2000, 2011 Oracle and/or its affiliates.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+*
+************************************************************************/
+
+#include "sal/config.h"
+
+#include <exception>
+#include <vector>
+
+#include "cppuhelper/exc_hlp.hxx"
+#include "osl/diagnose.h"
+#include "rtl/ref.hxx"
+#include "rtl/ustring.hxx"
+#include "sal/types.h"
+#include "typelib/typedescription.h"
+#include "typelib/typedescription.hxx"
+#include "uno/any2.h"
+#include "uno/dispatcher.h"
+#include "uno/dispatcher.hxx"
+
+#include "binaryany.hxx"
+#include "bridge.hxx"
+#include "proxy.hxx"
+
+namespace binaryurp {
+
+namespace {
+
+namespace css = com::sun::star;
+
+extern "C" void SAL_CALL proxy_acquireInterface(uno_Interface * pInterface) {
+ OSL_ASSERT(pInterface != 0);
+ static_cast< Proxy * >(pInterface)->do_acquire();
+}
+
+extern "C" void SAL_CALL proxy_releaseInterface(uno_Interface * pInterface) {
+ OSL_ASSERT(pInterface != 0);
+ static_cast< Proxy * >(pInterface)->do_release();
+}
+
+extern "C" void SAL_CALL proxy_dispatchInterface(
+ uno_Interface * pUnoI, typelib_TypeDescription const * pMemberType,
+ void * pReturn, void ** pArgs, uno_Any ** ppException)
+{
+ OSL_ASSERT(pUnoI != 0);
+ static_cast< Proxy * >(pUnoI)->do_dispatch(
+ pMemberType, pReturn, pArgs, ppException);
+}
+
+}
+
+Proxy::Proxy(
+ rtl::Reference< Bridge > const & bridge, rtl::OUString const & oid,
+ css::uno::TypeDescription const & type):
+ bridge_(bridge), oid_(oid), type_(type), references_(1)
+{
+ OSL_ASSERT(bridge.is());
+ acquire = &proxy_acquireInterface;
+ release = &proxy_releaseInterface;
+ pDispatcher = &proxy_dispatchInterface;
+}
+
+rtl::OUString Proxy::getOid() const {
+ return oid_;
+}
+
+css::uno::TypeDescription Proxy::getType() const {
+ return type_;
+}
+
+void Proxy::do_acquire() {
+ if (osl_incrementInterlockedCount(&references_) == 1) {
+ bridge_->resurrectProxy(*this);
+ }
+}
+
+void Proxy::do_release() {
+ if (osl_decrementInterlockedCount(&references_) == 0) {
+ bridge_->revokeProxy(*this);
+ }
+}
+
+void Proxy::do_free() {
+ bridge_->freeProxy(*this);
+ delete this;
+}
+
+void Proxy::do_dispatch(
+ typelib_TypeDescription const * member, void * returnValue,
+ void ** arguments, uno_Any ** exception) const
+{
+ try {
+ try {
+ do_dispatch_throw(member, returnValue, arguments, exception);
+ } catch (std::exception & e) {
+ throw css::uno::RuntimeException(
+ (rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM("caught C++ exception: ")) +
+ rtl::OStringToOUString(
+ rtl::OString(e.what()), RTL_TEXTENCODING_ASCII_US)),
+ css::uno::Reference< css::uno::XInterface >());
+ // best-effort string conversion
+ }
+ } catch (css::uno::RuntimeException &) {
+ css::uno::Any exc(cppu::getCaughtException());
+ uno_copyAndConvertData(
+ *exception, &exc,
+ (css::uno::TypeDescription(cppu::UnoType< css::uno::Any >::get()).
+ get()),
+ bridge_->getCppToBinaryMapping().get());
+ }
+}
+
+bool Proxy::isProxy(
+ rtl::Reference< Bridge > const & bridge,
+ css::uno::UnoInterfaceReference const & object, rtl::OUString * oid)
+{
+ OSL_ASSERT(object.is());
+ return object.m_pUnoI->acquire == &proxy_acquireInterface &&
+ static_cast< Proxy * >(object.m_pUnoI)->isProxy(bridge, oid);
+}
+
+Proxy::~Proxy() {}
+
+void Proxy::do_dispatch_throw(
+ typelib_TypeDescription const * member, void * returnValue,
+ void ** arguments, uno_Any ** exception) const
+{
+ //TODO: Optimize queryInterface:
+ OSL_ASSERT(member != 0);
+ bool setter = false;
+ std::vector< BinaryAny > inArgs;
+ switch (member->eTypeClass) {
+ case typelib_TypeClass_INTERFACE_ATTRIBUTE:
+ setter = returnValue == 0;
+ if (setter) {
+ inArgs.push_back(
+ BinaryAny(
+ css::uno::TypeDescription(
+ reinterpret_cast<
+ typelib_InterfaceAttributeTypeDescription const * >(
+ member)->
+ pAttributeTypeRef),
+ arguments[0]));
+ }
+ break;
+ case typelib_TypeClass_INTERFACE_METHOD:
+ {
+ typelib_InterfaceMethodTypeDescription const * mtd =
+ reinterpret_cast<
+ typelib_InterfaceMethodTypeDescription const * >(member);
+ for (sal_Int32 i = 0; i != mtd->nParams; ++i) {
+ if (mtd->pParams[i].bIn) {
+ inArgs.push_back(
+ BinaryAny(
+ css::uno::TypeDescription(mtd->pParams[i].pTypeRef),
+ arguments[i]));
+ }
+ }
+ break;
+ }
+ default:
+ OSL_ASSERT(false); // this cannot happen
+ break;
+ }
+ BinaryAny ret;
+ std::vector< BinaryAny > outArgs;
+ if (bridge_->makeCall(
+ oid_,
+ css::uno::TypeDescription(
+ const_cast< typelib_TypeDescription * >(member)),
+ setter, inArgs, &ret, &outArgs))
+ {
+ OSL_ASSERT(
+ ret.getType().get()->eTypeClass == typelib_TypeClass_EXCEPTION);
+ uno_any_construct(
+ *exception, ret.getValue(ret.getType()), ret.getType().get(), 0);
+ } else {
+ switch (member->eTypeClass) {
+ case typelib_TypeClass_INTERFACE_ATTRIBUTE:
+ if (!setter) {
+ css::uno::TypeDescription t(
+ reinterpret_cast<
+ typelib_InterfaceAttributeTypeDescription const * >(
+ member)->
+ pAttributeTypeRef);
+ uno_copyData(returnValue, ret.getValue(t), t.get(), 0);
+ }
+ break;
+ case typelib_TypeClass_INTERFACE_METHOD:
+ {
+ typelib_InterfaceMethodTypeDescription const * mtd =
+ reinterpret_cast<
+ typelib_InterfaceMethodTypeDescription const * >(
+ member);
+ css::uno::TypeDescription t(mtd->pReturnTypeRef);
+ if (t.get()->eTypeClass != typelib_TypeClass_VOID) {
+ uno_copyData(returnValue, ret.getValue(t), t.get(), 0);
+ }
+ std::vector< BinaryAny >::iterator i(outArgs.begin());
+ for (sal_Int32 j = 0; j != mtd->nParams; ++j) {
+ if (mtd->pParams[j].bOut) {
+ css::uno::TypeDescription pt(mtd->pParams[j].pTypeRef);
+ if (mtd->pParams[j].bIn) {
+ uno_assignData(
+ arguments[j], pt.get(), i++->getValue(pt),
+ pt.get(), 0, 0, 0);
+ } else {
+ uno_copyData(
+ arguments[j], i++->getValue(pt), pt.get(), 0);
+ }
+ }
+ }
+ OSL_ASSERT(i == outArgs.end());
+ break;
+ }
+ default:
+ OSL_ASSERT(false); // this cannot happen
+ break;
+ }
+ *exception = 0;
+ }
+}
+
+bool Proxy::isProxy(
+ rtl::Reference< Bridge > const & bridge, rtl::OUString * oid) const
+{
+ OSL_ASSERT(oid != 0);
+ if (bridge == bridge_) {
+ *oid = oid_;
+ return true;
+ } else {
+ return false;
+ }
+}
+
+}
diff --git a/binaryurp/source/proxy.hxx b/binaryurp/source/proxy.hxx
new file mode 100644
index 000000000000..c67ab4eb522a
--- /dev/null
+++ b/binaryurp/source/proxy.hxx
@@ -0,0 +1,92 @@
+/*************************************************************************
+*
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2000, 2011 Oracle and/or its affiliates.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+*
+************************************************************************/
+
+#ifndef INCLUDED_BINARYURP_SOURCE_PROXY_HXX
+#define INCLUDED_BINARYURP_SOURCE_PROXY_HXX
+
+#include "sal/config.h"
+
+#include "boost/noncopyable.hpp"
+#include "osl/interlck.h"
+#include "rtl/ref.hxx"
+#include "rtl/ustring.hxx"
+#include "typelib/typedescription.h"
+#include "typelib/typedescription.hxx"
+#include "uno/any2.h"
+#include "uno/dispatcher.h"
+
+namespace binaryurp { class Bridge; }
+namespace com { namespace sun { namespace star { namespace uno {
+ class UnoInterfaceReference;
+} } } }
+
+namespace binaryurp {
+
+class Proxy: public uno_Interface, private boost::noncopyable {
+public:
+ Proxy(
+ rtl::Reference< Bridge > const & bridge, rtl::OUString const & oid,
+ com::sun::star::uno::TypeDescription const & type);
+
+ rtl::OUString getOid() const;
+
+ com::sun::star::uno::TypeDescription getType() const;
+
+ void do_acquire();
+
+ void do_release();
+
+ void do_free();
+
+ void do_dispatch(
+ typelib_TypeDescription const * member, void * returnValue,
+ void ** arguments, uno_Any ** exception) const;
+
+ static bool isProxy(
+ rtl::Reference< Bridge > const & bridge,
+ com::sun::star::uno::UnoInterfaceReference const & object,
+ rtl::OUString * oid);
+
+private:
+ ~Proxy();
+
+ void do_dispatch_throw(
+ typelib_TypeDescription const * member, void * returnValue,
+ void ** arguments, uno_Any ** exception) const;
+
+ bool isProxy(rtl::Reference< Bridge > const & bridge, rtl::OUString * oid)
+ const;
+
+ rtl::Reference< Bridge > bridge_;
+ rtl::OUString oid_;
+ com::sun::star::uno::TypeDescription type_;
+ oslInterlockedCount references_;
+};
+
+}
+
+#endif
diff --git a/binaryurp/source/reader.cxx b/binaryurp/source/reader.cxx
new file mode 100755
index 000000000000..f622fb5b0c42
--- /dev/null
+++ b/binaryurp/source/reader.cxx
@@ -0,0 +1,553 @@
+/*************************************************************************
+*
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2000, 2011 Oracle and/or its affiliates.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+*
+************************************************************************/
+
+#include "sal/config.h"
+
+#include <exception>
+#include <memory>
+#include <vector>
+
+#include "com/sun/star/connection/XConnection.hpp"
+#include "com/sun/star/io/IOException.hpp"
+#include "com/sun/star/uno/Any.hxx"
+#include "com/sun/star/uno/Exception.hpp"
+#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/XCurrentContext.hpp"
+#include "com/sun/star/uno/XInterface.hpp"
+#include "cppu/unotype.hxx"
+#include "osl/diagnose.h"
+#include "rtl/byteseq.h"
+#include "rtl/string.h"
+#include "rtl/textenc.h"
+#include "rtl/ustring.h"
+#include "rtl/ustring.hxx"
+#include "sal/types.h"
+#include "typelib/typeclass.h"
+#include "typelib/typedescription.h"
+#include "typelib/typedescription.hxx"
+#include "uno/lbnames.h"
+
+#include "binaryany.hxx"
+#include "bridge.hxx"
+#include "incomingreply.hxx"
+#include "incomingrequest.hxx"
+#include "outgoingrequest.hxx"
+#include "reader.hxx"
+#include "specialfunctionids.hxx"
+#include "unmarshal.hxx"
+
+namespace binaryurp {
+
+namespace {
+
+namespace css = com::sun::star;
+
+css::uno::Sequence< sal_Int8 > read(
+ css::uno::Reference< css::connection::XConnection > const & connection,
+ sal_uInt32 size, bool eofOk)
+{
+ OSL_ASSERT(connection.is());
+ if (size > SAL_MAX_INT32) {
+ throw css::uno::RuntimeException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "binaryurp::Reader: block size too large")),
+ css::uno::Reference< css::uno::XInterface >());
+ }
+ css::uno::Sequence< sal_Int8 > buf;
+ sal_Int32 n = connection->read(buf, static_cast< sal_Int32 >(size));
+ if (n == 0 && eofOk) {
+ return css::uno::Sequence< sal_Int8 >();
+ }
+ if (n != static_cast< sal_Int32 >(size)) {
+ throw css::io::IOException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "binaryurp::Reader: premature end of input")),
+ css::uno::Reference< css::uno::XInterface >());
+ }
+ OSL_ASSERT(buf.getLength() == static_cast< sal_Int32 >(size));
+ return buf;
+}
+
+extern "C" void SAL_CALL request(void * pThreadSpecificData) {
+ OSL_ASSERT(pThreadSpecificData != 0);
+ std::auto_ptr< IncomingRequest >(
+ static_cast< IncomingRequest * >(pThreadSpecificData))->
+ execute();
+}
+
+}
+
+Reader::Reader(rtl::Reference< Bridge > const & bridge): bridge_(bridge) {
+ OSL_ASSERT(bridge.is());
+ acquire();
+}
+
+Reader::~Reader() {}
+
+void Reader::run() {
+ setName("binaryurpReader");
+ try {
+ bridge_->sendRequestChangeRequest();
+ css::uno::Reference< css::connection::XConnection > con(
+ bridge_->getConnection());
+ for (;;) {
+ css::uno::Sequence< sal_Int8 > s(read(con, 8, true));
+ if (s.getLength() == 0) {
+ break;
+ }
+ Unmarshal header(bridge_, state_, s);
+ sal_uInt32 size = header.read32();
+ sal_uInt32 count = header.read32();
+ header.done();
+ if (count == 0) {
+ throw css::io::IOException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "binaryurp::Reader: block with zero message count"
+ " received")),
+ css::uno::Reference< css::uno::XInterface >());
+ }
+ Unmarshal block(bridge_, state_, read(con, size, false));
+ for (sal_uInt32 i = 0; i != count; ++i) {
+ readMessage(block);
+ }
+ block.done();
+ }
+ } catch (css::uno::Exception & e) {
+ OSL_TRACE(
+ OSL_LOG_PREFIX "caught UNO exception '%s'",
+ rtl::OUStringToOString(e.Message, RTL_TEXTENCODING_UTF8).getStr());
+ } catch (std::exception & e) {
+ OSL_TRACE(OSL_LOG_PREFIX "caught C++ exception '%s'", e.what());
+ }
+ bridge_->terminate();
+}
+
+void Reader::onTerminated() {
+ release();
+}
+
+void Reader::readMessage(Unmarshal & unmarshal) {
+ sal_uInt8 flags1 = unmarshal.read8();
+ bool newType;
+ bool newOid;
+ bool newTid;
+ bool forceSynchronous;
+ sal_uInt16 functionId;
+ if ((flags1 & 0x80) != 0) { // bit 7: LONGHEADER
+ if ((flags1 & 0x40) == 0) { // bit 6: REQUEST
+ readReplyMessage(unmarshal, flags1);
+ return;
+ }
+ newType = (flags1 & 0x20) != 0; // bit 5: NEWTYPE
+ newOid = (flags1 & 0x10) != 0; // bit 4: NEWOID
+ newTid = (flags1 & 0x08) != 0; // bit 3: NEWTID
+ if ((flags1 & 0x01) != 0) { // bit 0: MOREFLAGSS
+ sal_uInt8 flags2 = unmarshal.read8();
+ forceSynchronous = (flags2 & 0x80) != 0; // bit 7: MUSTREPLY
+ if (((flags2 & 0x40) != 0) != forceSynchronous) {
+ // bit 6: SYNCHRONOUS
+ throw css::uno::RuntimeException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "URP: request message with MUSTREPLY != SYNCHRONOUS"
+ " received")),
+ css::uno::Reference< css::uno::XInterface >());
+ }
+ } else {
+ forceSynchronous = false;
+ }
+ functionId = ((flags1 & 0x04) != 0) // bit 2: FUNCTIONID16
+ ? unmarshal.read16() : unmarshal.read8();
+ } else {
+ newType = false;
+ newOid = false;
+ newTid = false;
+ forceSynchronous = false;
+ functionId = ((flags1 & 0x40) != 0) // bit 6: FUNCTIONID14
+ ? ((flags1 & 0x3F) << 8) | unmarshal.read8() : flags1 & 0x3F;
+ }
+ css::uno::TypeDescription type;
+ if (newType) {
+ type = unmarshal.readType();
+ lastType_ = type;
+ } else {
+ if (!lastType_.is()) {
+ throw css::uno::RuntimeException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "URP: request message with NEWTYPE received when last"
+ " interface type has not yet been set")),
+ css::uno::Reference< css::uno::XInterface >());
+ }
+ type = lastType_;
+ }
+ rtl::OUString oid;
+ if (newOid) {
+ oid = unmarshal.readOid();
+ if (oid.getLength() == 0) {
+ throw css::io::IOException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "binaryurp::Unmarshal: emtpy OID")),
+ css::uno::Reference< css::uno::XInterface >());
+ }
+ lastOid_ = oid;
+ } else {
+ if (lastOid_.getLength() == 0) {
+ throw css::uno::RuntimeException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "URP: request message with NEWOID received when last"
+ " OID has not yet been set")),
+ css::uno::Reference< css::uno::XInterface >());
+ }
+ oid = lastOid_;
+ }
+ rtl::ByteSequence tid(getTid(unmarshal, newTid));
+ lastTid_ = tid;
+ type.makeComplete();
+ if (type.get()->eTypeClass != typelib_TypeClass_INTERFACE) {
+ throw css::uno::RuntimeException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "URP: request message with non-interface interface type"
+ " received")),
+ css::uno::Reference< css::uno::XInterface >());
+ }
+ typelib_InterfaceTypeDescription * itd =
+ reinterpret_cast< typelib_InterfaceTypeDescription * >(type.get());
+ if (functionId >= itd->nMapFunctionIndexToMemberIndex) {
+ throw css::uno::RuntimeException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "URP: request message with unknown function ID received")),
+ css::uno::Reference< css::uno::XInterface >());
+ }
+ sal_Int32 memberId = itd->pMapFunctionIndexToMemberIndex[functionId];
+ css::uno::TypeDescription memberTd(itd->ppAllMembers[memberId]);
+ memberTd.makeComplete();
+ OSL_ASSERT(memberTd.is());
+ bool protProps = bridge_->isProtocolPropertiesRequest(oid, type);
+ bool ccMode = !protProps && functionId != SPECIAL_FUNCTION_ID_RELEASE &&
+ bridge_->isCurrentContextMode();
+ css::uno::UnoInterfaceReference cc;
+ if (ccMode) {
+ css::uno::TypeDescription t(
+ cppu::UnoType< css::uno::Reference< css::uno::XCurrentContext > >::
+ get());
+ cc.set(
+ *static_cast< uno_Interface ** >(
+ unmarshal.readValue(t).getValue(t)));
+ }
+ bool synchronous;
+ if (memberTd.get()->eTypeClass == typelib_TypeClass_INTERFACE_METHOD &&
+ (reinterpret_cast< typelib_InterfaceMethodTypeDescription * >(
+ memberTd.get())->
+ bOneWay))
+ {
+ synchronous = forceSynchronous;
+ } else {
+ if (forceSynchronous) {
+ throw css::uno::RuntimeException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "URP: synchronous request message with non-oneway"
+ " function ID received")),
+ css::uno::Reference< css::uno::XInterface >());
+ }
+ synchronous = true;
+ }
+ bool setter = false;
+ std::vector< BinaryAny > inArgs;
+ switch (memberTd.get()->eTypeClass) {
+ case typelib_TypeClass_INTERFACE_ATTRIBUTE:
+ setter = itd->pMapMemberIndexToFunctionIndex[memberId] != functionId;
+ // pMapMemberIndexToFunctionIndex contains function index of
+ // attribute getter
+ if (setter) {
+ inArgs.push_back(
+ unmarshal.readValue(
+ css::uno::TypeDescription(
+ reinterpret_cast<
+ typelib_InterfaceAttributeTypeDescription * >(
+ memberTd.get())->
+ pAttributeTypeRef)));
+ }
+ break;
+ case typelib_TypeClass_INTERFACE_METHOD:
+ {
+ typelib_InterfaceMethodTypeDescription * mtd =
+ reinterpret_cast< typelib_InterfaceMethodTypeDescription * >(
+ memberTd.get());
+ for (sal_Int32 i = 0; i != mtd->nParams; ++i) {
+ if (mtd->pParams[i].bIn) {
+ inArgs.push_back(
+ unmarshal.readValue(
+ css::uno::TypeDescription(
+ mtd->pParams[i].pTypeRef)));
+ }
+ }
+ break;
+ }
+ default:
+ OSL_ASSERT(false); // this cannot happen
+ break;
+ }
+ bridge_->incrementCalls(
+ !protProps && functionId != SPECIAL_FUNCTION_ID_RELEASE);
+ if (protProps) {
+ switch (functionId) {
+ case SPECIAL_FUNCTION_ID_REQUEST_CHANGE:
+ bridge_->handleRequestChangeRequest(tid, inArgs);
+ break;
+ case SPECIAL_FUNCTION_ID_COMMIT_CHANGE:
+ bridge_->handleCommitChangeRequest(tid, inArgs);
+ break;
+ default:
+ throw css::uno::RuntimeException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "URP: request message with UrpProtocolProperties OID"
+ " and unknown function ID received")),
+ css::uno::Reference< css::uno::XInterface >());
+ }
+ } else {
+ css::uno::UnoInterfaceReference obj;
+ switch (functionId) {
+ case SPECIAL_FUNCTION_ID_QUERY_INTERFACE:
+ obj = bridge_->findStub(oid, type);
+ if (!obj.is()) {
+ OSL_ASSERT(
+ inArgs.size() == 1
+ && inArgs[0].getType().equals(
+ css::uno::TypeDescription(
+ cppu::UnoType< css::uno::Type >::get())));
+ if (!(type.equals(
+ css::uno::TypeDescription(
+ cppu::UnoType<
+ css::uno::Reference<
+ css::uno::XInterface > >::get()))
+ && (css::uno::TypeDescription(
+ *static_cast<
+ typelib_TypeDescriptionReference ** >(
+ inArgs[0].getValue(inArgs[0].getType()))).
+ equals(
+ css::uno::TypeDescription(
+ cppu::UnoType<
+ css::uno::Reference<
+ css::uno::XInterface > >::get())))))
+ {
+ throw css::uno::RuntimeException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "URP: queryInterface request message with"
+ " unknown OID received")),
+ css::uno::Reference< css::uno::XInterface >());
+ }
+ }
+ break;
+ case SPECIAL_FUNCTION_ID_RESERVED:
+ throw css::uno::RuntimeException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "URP: request message with unknown function ID 1"
+ " received")),
+ css::uno::Reference< css::uno::XInterface >());
+ case SPECIAL_FUNCTION_ID_RELEASE:
+ break;
+ default:
+ obj = bridge_->findStub(oid, type);
+ if (!obj.is()) {
+ throw css::uno::RuntimeException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "URP: request message with unknown OID received")),
+ css::uno::Reference< css::uno::XInterface >());
+ }
+ break;
+ }
+ std::auto_ptr< IncomingRequest > req(
+ new IncomingRequest(
+ bridge_, tid, oid, obj, type, functionId, synchronous, memberTd,
+ setter, inArgs, ccMode, cc));
+ if (synchronous) {
+ bridge_->incrementActiveCalls();
+ }
+ uno_threadpool_putJob(
+ bridge_->getThreadPool(), tid.getHandle(), req.get(), &request,
+ !synchronous);
+ req.release();
+ }
+}
+
+void Reader::readReplyMessage(Unmarshal & unmarshal, sal_uInt8 flags1) {
+ rtl::ByteSequence tid(getTid(unmarshal, (flags1 & 0x08) != 0));
+ // bit 3: NEWTID
+ lastTid_ = tid;
+ OutgoingRequest req(bridge_->lastOutgoingRequest(tid));
+ bool exc = (flags1 & 0x20) != 0; // bit 5: EXCEPTION
+ BinaryAny ret;
+ std::vector< BinaryAny > outArgs;
+ if (exc) {
+ ret = unmarshal.readValue(
+ css::uno::TypeDescription(cppu::UnoType< css::uno::Any >::get()));
+ if (!typelib_typedescription_isAssignableFrom(
+ (css::uno::TypeDescription(
+ cppu::UnoType< css::uno::RuntimeException >::get()).
+ get()),
+ ret.getType().get()))
+ {
+ sal_Int32 n = 0;
+ typelib_TypeDescriptionReference ** p = 0;
+ switch (req.member.get()->eTypeClass) {
+ case typelib_TypeClass_INTERFACE_ATTRIBUTE:
+ {
+ typelib_InterfaceAttributeTypeDescription * atd =
+ reinterpret_cast<
+ typelib_InterfaceAttributeTypeDescription * >(
+ req.member.get());
+ n = req.setter ? atd->nSetExceptions : atd->nGetExceptions;
+ p = req.setter
+ ? atd->ppSetExceptions : atd->ppGetExceptions;
+ break;
+ }
+ case typelib_TypeClass_INTERFACE_METHOD:
+ {
+ typelib_InterfaceMethodTypeDescription * mtd =
+ reinterpret_cast<
+ typelib_InterfaceMethodTypeDescription * >(
+ req.member.get());
+ n = mtd->nExceptions;
+ p = mtd->ppExceptions;
+ break;
+ }
+ default:
+ OSL_ASSERT(false); // this cannot happen
+ break;
+ }
+ bool ok = false;
+ for (sal_Int32 i = 0; i != n; ++i) {
+ if (typelib_typedescriptionreference_isAssignableFrom(
+ p[i],
+ reinterpret_cast< typelib_TypeDescriptionReference * >(
+ ret.getType().get())))
+ {
+ ok = true;
+ break;
+ }
+ }
+ if (!ok) {
+ throw css::uno::RuntimeException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "URP: reply message with bad exception type"
+ " received")),
+ css::uno::Reference< css::uno::XInterface >());
+ }
+ }
+ } else {
+ switch (req.member.get()->eTypeClass) {
+ case typelib_TypeClass_INTERFACE_ATTRIBUTE:
+ if (!req.setter) {
+ ret = unmarshal.readValue(
+ css::uno::TypeDescription(
+ reinterpret_cast<
+ typelib_InterfaceAttributeTypeDescription * >(
+ req.member.get())->
+ pAttributeTypeRef));
+ }
+ break;
+ case typelib_TypeClass_INTERFACE_METHOD:
+ {
+ typelib_InterfaceMethodTypeDescription * mtd =
+ reinterpret_cast<
+ typelib_InterfaceMethodTypeDescription * >(
+ req.member.get());
+ ret = unmarshal.readValue(
+ css::uno::TypeDescription(mtd->pReturnTypeRef));
+ for (sal_Int32 i = 0; i != mtd->nParams; ++i) {
+ if (mtd->pParams[i].bOut) {
+ outArgs.push_back(
+ unmarshal.readValue(
+ css::uno::TypeDescription(
+ mtd->pParams[i].pTypeRef)));
+ }
+ }
+ break;
+ }
+ default:
+ OSL_ASSERT(false); // this cannot happen
+ break;
+ }
+ }
+ switch (req.kind) {
+ case OutgoingRequest::KIND_NORMAL:
+ {
+ std::auto_ptr< IncomingReply > resp(
+ new IncomingReply(exc, ret, outArgs));
+ uno_threadpool_putJob(
+ bridge_->getThreadPool(), tid.getHandle(), resp.get(), 0,
+ false);
+ resp.release();
+ break;
+ }
+ case OutgoingRequest::KIND_REQUEST_CHANGE:
+ OSL_ASSERT(outArgs.empty());
+ bridge_->handleRequestChangeReply(exc, ret);
+ break;
+ case OutgoingRequest::KIND_COMMIT_CHANGE:
+ OSL_ASSERT(outArgs.empty());
+ bridge_->handleCommitChangeReply(exc, ret);
+ break;
+ default:
+ OSL_ASSERT(false); // this cannot happen
+ break;
+ }
+}
+
+rtl::ByteSequence Reader::getTid(Unmarshal & unmarshal, bool newTid) const {
+ if (newTid) {
+ return unmarshal.readTid();
+ }
+ if (lastTid_.getLength() == 0) {
+ throw css::uno::RuntimeException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "URP: message with NEWTID received when last TID has not"
+ " yet been set")),
+ css::uno::Reference< css::uno::XInterface >());
+ }
+ return lastTid_;
+}
+
+}
diff --git a/binaryurp/source/reader.hxx b/binaryurp/source/reader.hxx
new file mode 100644
index 000000000000..37d0b9462ae4
--- /dev/null
+++ b/binaryurp/source/reader.hxx
@@ -0,0 +1,89 @@
+/*************************************************************************
+*
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2000, 2011 Oracle and/or its affiliates.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+*
+************************************************************************/
+
+#ifndef INCLUDED_BINARYURP_SOURCE_READER_HXX
+#define INCLUDED_BINARYURP_SOURCE_READER_HXX
+
+#include "sal/config.h"
+
+#include <cstddef>
+
+#include "boost/noncopyable.hpp"
+#include "osl/thread.hxx"
+#include "rtl/byteseq.hxx"
+#include "rtl/ref.hxx"
+#include "rtl/ustring.hxx"
+#include "sal/types.h"
+#include "salhelper/simplereferenceobject.hxx"
+#include "typelib/typedescription.hxx"
+
+#include "readerstate.hxx"
+
+namespace binaryurp {
+ class BinaryAny;
+ class Bridge;
+ class Unmarshal;
+}
+
+namespace binaryurp {
+
+class Reader:
+ public osl::Thread, public salhelper::SimpleReferenceObject,
+ private boost::noncopyable
+{
+public:
+ static void * operator new(std::size_t size)
+ { return Thread::operator new(size); }
+
+ static void operator delete(void * pointer)
+ { Thread::operator delete(pointer); }
+
+ explicit Reader(rtl::Reference< Bridge > const & bridge);
+
+private:
+ virtual ~Reader();
+
+ virtual void SAL_CALL run();
+
+ virtual void SAL_CALL onTerminated();
+
+ void readMessage(Unmarshal & unmarshal);
+
+ void readReplyMessage(Unmarshal & unmarshal, sal_uInt8 flags1);
+
+ rtl::ByteSequence getTid(Unmarshal & unmarshal, bool newTid) const;
+
+ rtl::Reference< Bridge > bridge_;
+ com::sun::star::uno::TypeDescription lastType_;
+ rtl::OUString lastOid_;
+ rtl::ByteSequence lastTid_;
+ ReaderState state_;
+};
+
+}
+
+#endif
diff --git a/binaryurp/source/readerstate.hxx b/binaryurp/source/readerstate.hxx
new file mode 100644
index 000000000000..ef7ed4d7196f
--- /dev/null
+++ b/binaryurp/source/readerstate.hxx
@@ -0,0 +1,52 @@
+/*************************************************************************
+*
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2000, 2011 Oracle and/or its affiliates.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+*
+************************************************************************/
+
+#ifndef INCLUDED_BINARYURP_SOURCE_READERSTATE_HXX
+#define INCLUDED_BINARYURP_SOURCE_READERSTATE_HXX
+
+#include "sal/config.h"
+
+#include "boost/noncopyable.hpp"
+#include "rtl/byteseq.hxx"
+#include "rtl/ustring.hxx"
+#include "typelib/typedescription.hxx"
+
+#include "cache.hxx"
+
+namespace binaryurp {
+
+struct ReaderState: private boost::noncopyable {
+ com::sun::star::uno::TypeDescription typeCache[cache::size];
+
+ rtl::OUString oidCache[cache::size];
+
+ rtl::ByteSequence tidCache[cache::size];
+};
+
+}
+
+#endif
diff --git a/remotebridges/source/bridge/remotebridge.component b/binaryurp/source/specialfunctionids.hxx
index bbc6bede1360..a2a59791ba09 100644
--- a/remotebridges/source/bridge/remotebridge.component
+++ b/binaryurp/source/specialfunctionids.hxx
@@ -1,9 +1,8 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--**********************************************************************
+/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
-* Copyright 2000, 2010 Oracle and/or its affiliates.
+* Copyright 2000, 2011 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
@@ -24,13 +23,27 @@
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
-**********************************************************************-->
+************************************************************************/
-<component loader="com.sun.star.loader.SharedLibrary"
- xmlns="http://openoffice.org/2010/uno-components">
- <implementation name="com.sun.star.comp.remotebridges.Bridge.various">
- <service name="com.sun.star.bridge.Bridge"/>
- <service name="com.sun.star.bridge.IiopBridge"/>
- <service name="com.sun.star.bridge.UrpBridge"/>
- </implementation>
-</component>
+#ifndef INCLUDED_BINARYURP_SOURCE_SPECIALFUNCTIONIDS_HXX
+#define INCLUDED_BINARYURP_SOURCE_SPECIALFUNCTIONIDS_HXX
+
+#include "sal/config.h"
+
+namespace binaryurp {
+
+enum SpecialFunctionIds {
+ SPECIAL_FUNCTION_ID_QUERY_INTERFACE = 0,
+
+ SPECIAL_FUNCTION_ID_RESERVED = 1,
+
+ SPECIAL_FUNCTION_ID_RELEASE = 2,
+
+ SPECIAL_FUNCTION_ID_REQUEST_CHANGE = 4,
+
+ SPECIAL_FUNCTION_ID_COMMIT_CHANGE = 5
+};
+
+}
+
+#endif
diff --git a/binaryurp/source/unmarshal.cxx b/binaryurp/source/unmarshal.cxx
new file mode 100755
index 000000000000..62f8683e33ad
--- /dev/null
+++ b/binaryurp/source/unmarshal.cxx
@@ -0,0 +1,563 @@
+/*************************************************************************
+*
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2000, 2011 Oracle and/or its affiliates.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+*
+************************************************************************/
+
+#include "sal/config.h"
+
+#include <cstdlib>
+#include <new>
+#include <vector>
+
+#include "boost/noncopyable.hpp"
+#include "com/sun/star/io/IOException.hpp"
+#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/XInterface.hpp"
+#include "cppu/unotype.hxx"
+#include "osl/diagnose.h"
+#include "rtl/byteseq.hxx"
+#include "rtl/ref.hxx"
+#include "rtl/textcvt.h"
+#include "rtl/textenc.h"
+#include "rtl/ustring.h"
+#include "rtl/ustring.hxx"
+#include "sal/types.h"
+#include "typelib/typeclass.h"
+#include "typelib/typedescription.h"
+#include "typelib/typedescription.hxx"
+#include "uno/any2.h"
+#include "uno/data.h"
+#include "uno/dispatcher.hxx"
+
+#include "binaryany.hxx"
+#include "bridge.hxx"
+#include "cache.hxx"
+#include "readerstate.hxx"
+#include "unmarshal.hxx"
+
+namespace binaryurp {
+
+namespace {
+
+namespace css = com::sun::star;
+
+void * allocate(sal_Size size) {
+ void * p = rtl_allocateMemory(size);
+ if (p == 0) {
+ throw std::bad_alloc();
+ }
+ return p;
+}
+
+std::vector< BinaryAny >::iterator copyMemberValues(
+ css::uno::TypeDescription const & type,
+ std::vector< BinaryAny >::iterator const & it, void * buffer) throw ()
+{
+ OSL_ASSERT(
+ type.is() &&
+ (type.get()->eTypeClass == typelib_TypeClass_STRUCT ||
+ type.get()->eTypeClass == typelib_TypeClass_EXCEPTION) &&
+ buffer != 0);
+ type.makeComplete();
+ std::vector< BinaryAny >::iterator i(it);
+ typelib_CompoundTypeDescription * ctd =
+ reinterpret_cast< typelib_CompoundTypeDescription * >(type.get());
+ if (ctd->pBaseTypeDescription != 0) {
+ i = copyMemberValues(
+ css::uno::TypeDescription(&ctd->pBaseTypeDescription->aBase), i,
+ buffer);
+ }
+ for (sal_Int32 j = 0; j != ctd->nMembers; ++j) {
+ uno_type_copyData(
+ static_cast< char * >(buffer) + ctd->pMemberOffsets[j],
+ const_cast< void * >(
+ i++->getValue(css::uno::TypeDescription(ctd->ppTypeRefs[j]))),
+ ctd->ppTypeRefs[j], 0);
+ }
+ return i;
+}
+
+}
+
+Unmarshal::Unmarshal(
+ rtl::Reference< Bridge > const & bridge, ReaderState & state,
+ css::uno::Sequence< sal_Int8 > const & buffer):
+ bridge_(bridge), state_(state), buffer_(buffer)
+{
+ data_ = reinterpret_cast< sal_uInt8 const * >(buffer_.getConstArray());
+ end_ = data_ + buffer_.getLength();
+}
+
+Unmarshal::~Unmarshal() {}
+
+sal_uInt8 Unmarshal::read8() {
+ check(1);
+ return *data_++;
+}
+
+sal_uInt16 Unmarshal::read16() {
+ check(2);
+ sal_uInt16 n = static_cast< sal_uInt16 >(*data_++) << 8;
+ return n | *data_++;
+}
+
+sal_uInt32 Unmarshal::read32() {
+ check(4);
+ sal_uInt32 n = static_cast< sal_uInt32 >(*data_++) << 24;
+ n |= static_cast< sal_uInt32 >(*data_++) << 16;
+ n |= static_cast< sal_uInt32 >(*data_++) << 8;
+ return n | *data_++;
+}
+
+css::uno::TypeDescription Unmarshal::readType() {
+ sal_uInt8 flags = read8();
+ typelib_TypeClass tc = static_cast< typelib_TypeClass >(flags & 0x7F);
+ switch (tc) {
+ case typelib_TypeClass_VOID:
+ case typelib_TypeClass_BOOLEAN:
+ case typelib_TypeClass_BYTE:
+ case typelib_TypeClass_SHORT:
+ case typelib_TypeClass_UNSIGNED_SHORT:
+ case typelib_TypeClass_LONG:
+ case typelib_TypeClass_UNSIGNED_LONG:
+ case typelib_TypeClass_HYPER:
+ case typelib_TypeClass_UNSIGNED_HYPER:
+ case typelib_TypeClass_FLOAT:
+ case typelib_TypeClass_DOUBLE:
+ case typelib_TypeClass_CHAR:
+ case typelib_TypeClass_STRING:
+ case typelib_TypeClass_TYPE:
+ case typelib_TypeClass_ANY:
+ if ((flags & 0x80) != 0) {
+ throw css::io::IOException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "binaryurp::Unmarshal: cache flag of simple type is"
+ " set")),
+ css::uno::Reference< css::uno::XInterface >());
+ }
+ return css::uno::TypeDescription(
+ *typelib_static_type_getByTypeClass(
+ static_cast< typelib_TypeClass >(tc)));
+ case typelib_TypeClass_SEQUENCE:
+ case typelib_TypeClass_ENUM:
+ case typelib_TypeClass_STRUCT:
+ case typelib_TypeClass_EXCEPTION:
+ case typelib_TypeClass_INTERFACE:
+ {
+ sal_uInt16 idx = readCacheIndex();
+ if ((flags & 0x80) == 0) {
+ if (idx == cache::ignore || !state_.typeCache[idx].is()) {
+ throw css::io::IOException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "binaryurp::Unmarshal: unknown type cache"
+ " index")),
+ css::uno::Reference< css::uno::XInterface >());
+ }
+ return state_.typeCache[idx];
+ } else {
+ css::uno::TypeDescription t(readString());
+ if (!t.is() ||
+ t.get()->eTypeClass != static_cast< typelib_TypeClass >(tc))
+ {
+ throw css::io::IOException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "binaryurp::Unmarshal: type with unknown"
+ " name")),
+ css::uno::Reference< css::uno::XInterface >());
+ }
+ for (css::uno::TypeDescription t2(t);
+ t2.get()->eTypeClass == typelib_TypeClass_SEQUENCE;)
+ {
+ t2.makeComplete();
+ t2 = css::uno::TypeDescription(
+ reinterpret_cast< typelib_IndirectTypeDescription * >(
+ t2.get())->pType);
+ if (!t2.is()) {
+ throw css::io::IOException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "binaryurp::Unmarshal: sequence type with"
+ " unknown component type")),
+ css::uno::Reference< css::uno::XInterface >());
+ }
+ switch (t2.get()->eTypeClass) {
+ case typelib_TypeClass_VOID:
+ case typelib_TypeClass_EXCEPTION:
+ throw css::io::IOException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "binaryurp::Unmarshal: sequence type with"
+ " bad component type")),
+ css::uno::Reference< css::uno::XInterface >());
+ default:
+ break;
+ }
+ }
+ if (idx != cache::ignore) {
+ state_.typeCache[idx] = t;
+ }
+ return t;
+ }
+ }
+ default:
+ throw css::io::IOException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "binaryurp::Unmarshal: type of unknown type class")),
+ css::uno::Reference< css::uno::XInterface >());
+ }
+}
+
+rtl::OUString Unmarshal::readOid() {
+ rtl::OUString oid(readString());
+ for (sal_Int32 i = 0; i != oid.getLength(); ++i) {
+ if (oid[i] > 0x7F) {
+ throw css::io::IOException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "binaryurp::Unmarshal: OID contains non-ASCII"
+ " character")),
+ css::uno::Reference< css::uno::XInterface >());
+ }
+ }
+ sal_uInt16 idx = readCacheIndex();
+ if (oid.getLength() == 0 && idx != cache::ignore) {
+ if (state_.oidCache[idx].getLength() == 0) {
+ throw css::io::IOException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "binaryurp::Unmarshal: unknown OID cache index")),
+ css::uno::Reference< css::uno::XInterface >());
+ }
+ return state_.oidCache[idx];
+ }
+ if (idx != cache::ignore) {
+ state_.oidCache[idx] = oid;
+ }
+ return oid;
+}
+
+rtl::ByteSequence Unmarshal::readTid() {
+ rtl::ByteSequence tid(
+ *static_cast< sal_Sequence * const * >(
+ readSequence(
+ css::uno::TypeDescription(
+ cppu::UnoType< css::uno::Sequence< sal_Int8 > >::get())).
+ getValue(
+ css::uno::TypeDescription(
+ cppu::UnoType< css::uno::Sequence< sal_Int8 > >::get()))));
+ sal_uInt16 idx = readCacheIndex();
+ if (tid.getLength() == 0) {
+ if (idx == cache::ignore || state_.tidCache[idx].getLength() == 0) {
+ throw css::io::IOException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "binaryurp::Unmarshal: unknown TID cache index")),
+ css::uno::Reference< css::uno::XInterface >());
+ }
+ return state_.tidCache[idx];
+ }
+ if (idx != cache::ignore) {
+ state_.tidCache[idx] = tid;
+ }
+ return tid;
+}
+
+BinaryAny Unmarshal::readValue(css::uno::TypeDescription const & type) {
+ OSL_ASSERT(type.is());
+ switch (type.get()->eTypeClass) {
+ default:
+ std::abort(); // this cannot happen
+ // pseudo fall-through to avoid compiler warnings
+ case typelib_TypeClass_VOID:
+ return BinaryAny();
+ case typelib_TypeClass_BOOLEAN:
+ {
+ sal_uInt8 v = read8();
+ if (v > 1) {
+ throw css::io::IOException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "binaryurp::Unmarshal: boolean of unknown value")),
+ css::uno::Reference< css::uno::XInterface >());
+ }
+ return BinaryAny(type, &v);
+ }
+ case typelib_TypeClass_BYTE:
+ {
+ sal_uInt8 v = read8();
+ return BinaryAny(type, &v);
+ }
+ case typelib_TypeClass_SHORT:
+ case typelib_TypeClass_UNSIGNED_SHORT:
+ case typelib_TypeClass_CHAR:
+ {
+ sal_uInt16 v = read16();
+ return BinaryAny(type, &v);
+ }
+ case typelib_TypeClass_LONG:
+ case typelib_TypeClass_UNSIGNED_LONG:
+ case typelib_TypeClass_FLOAT:
+ {
+ sal_uInt32 v = read32();
+ return BinaryAny(type, &v);
+ }
+ case typelib_TypeClass_HYPER:
+ case typelib_TypeClass_UNSIGNED_HYPER:
+ case typelib_TypeClass_DOUBLE:
+ {
+ sal_uInt64 v = read64();
+ return BinaryAny(type, &v);
+ }
+ case typelib_TypeClass_STRING:
+ {
+ rtl::OUString v(readString());
+ return BinaryAny(type, &v.pData);
+ }
+ case typelib_TypeClass_TYPE:
+ {
+ css::uno::TypeDescription v(readType());
+ typelib_TypeDescription * p = v.get();
+ return BinaryAny(type, &p);
+ }
+ case typelib_TypeClass_ANY:
+ {
+ css::uno::TypeDescription t(readType());
+ if (t.get()->eTypeClass == typelib_TypeClass_ANY) {
+ throw css::io::IOException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "binaryurp::Unmarshal: any of type ANY")),
+ css::uno::Reference< css::uno::XInterface >());
+ }
+ return readValue(t);
+ }
+ case typelib_TypeClass_SEQUENCE:
+ type.makeComplete();
+ return readSequence(type);
+ case typelib_TypeClass_ENUM:
+ {
+ sal_Int32 v = static_cast< sal_Int32 >(read32());
+ type.makeComplete();
+ typelib_EnumTypeDescription * etd =
+ reinterpret_cast< typelib_EnumTypeDescription * >(type.get());
+ bool found = false;
+ for (sal_Int32 i = 0; i != etd->nEnumValues; ++i) {
+ if (etd->pEnumValues[i] == v) {
+ found = true;
+ break;
+ }
+ }
+ if (!found) {
+ throw css::io::IOException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "binaryurp::Unmarshal: unknown enum value")),
+ css::uno::Reference< css::uno::XInterface >());
+ }
+ return BinaryAny(type, &v);
+ }
+ case typelib_TypeClass_STRUCT:
+ case typelib_TypeClass_EXCEPTION:
+ {
+ std::vector< BinaryAny > as;
+ readMemberValues(type, &as);
+ void * buf = allocate(type.get()->nSize);
+ copyMemberValues(type, as.begin(), buf);
+ uno_Any raw;
+ raw.pType = reinterpret_cast< typelib_TypeDescriptionReference * >(
+ type.get());
+ raw.pData = buf;
+ raw.pReserved = 0;
+ return BinaryAny(raw);
+ }
+ case typelib_TypeClass_INTERFACE:
+ {
+ css::uno::UnoInterfaceReference obj(
+ bridge_->registerIncomingInterface(readOid(), type));
+ return BinaryAny(type, &obj.m_pUnoI);
+ }
+ }
+}
+
+void Unmarshal::done() const {
+ if (data_ != end_) {
+ throw css::io::IOException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "binaryurp::Unmarshal: block contains excess data")),
+ css::uno::Reference< css::uno::XInterface >());
+ }
+}
+
+void Unmarshal::check(sal_Int32 size) const {
+ if (end_ - data_ < size) {
+ throw css::io::IOException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "binaryurp::Unmarshal: trying to read past end of block")),
+ css::uno::Reference< css::uno::XInterface >());
+ }
+}
+
+sal_uInt32 Unmarshal::readCompressed() {
+ sal_uInt8 n = read8();
+ return n == 0xFF ? read32() : n;
+}
+
+sal_uInt16 Unmarshal::readCacheIndex() {
+ sal_uInt16 idx = read16();
+ if (idx >= cache::size && idx != cache::ignore) {
+ throw css::io::IOException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "binaryurp::Unmarshal: cache index out of range")),
+ css::uno::Reference< css::uno::XInterface >());
+ }
+ return idx;
+}
+
+sal_uInt64 Unmarshal::read64() {
+ check(8);
+ sal_uInt64 n = static_cast< sal_uInt64 >(*data_++) << 56;
+ n |= static_cast< sal_uInt64 >(*data_++) << 48;
+ n |= static_cast< sal_uInt64 >(*data_++) << 40;
+ n |= static_cast< sal_uInt64 >(*data_++) << 32;
+ n |= static_cast< sal_uInt64 >(*data_++) << 24;
+ n |= static_cast< sal_uInt64 >(*data_++) << 16;
+ n |= static_cast< sal_uInt64 >(*data_++) << 8;
+ return n | *data_++;
+}
+
+rtl::OUString Unmarshal::readString() {
+ sal_uInt32 n = readCompressed();
+ if (n > SAL_MAX_INT32) {
+ throw css::uno::RuntimeException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "binaryurp::Unmarshal: string size too large")),
+ css::uno::Reference< css::uno::XInterface >());
+ }
+ check(static_cast< sal_Int32 >(n));
+ rtl::OUString s;
+ if (!rtl_convertStringToUString(
+ &s.pData, reinterpret_cast< char const * >(data_),
+ static_cast< sal_Int32 >(n), RTL_TEXTENCODING_UTF8,
+ (RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_ERROR |
+ RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_ERROR |
+ RTL_TEXTTOUNICODE_FLAGS_INVALID_ERROR)))
+ {
+ throw css::io::IOException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "binaryurp::Unmarshal: string does not contain UTF-8")),
+ css::uno::Reference< css::uno::XInterface >());
+ }
+ data_ += n;
+ return s;
+}
+
+BinaryAny Unmarshal::readSequence(css::uno::TypeDescription const & type) {
+ OSL_ASSERT(
+ type.is() && type.get()->eTypeClass == typelib_TypeClass_SEQUENCE);
+ sal_uInt32 n = readCompressed();
+ if (n > SAL_MAX_INT32) {
+ throw css::uno::RuntimeException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "binaryurp::Unmarshal: sequence size too large")),
+ css::uno::Reference< css::uno::XInterface >());
+ }
+ if (n == 0) {
+ return BinaryAny(type, 0);
+ }
+ css::uno::TypeDescription ctd(
+ reinterpret_cast< typelib_IndirectTypeDescription * >(
+ type.get())->pType);
+ if (ctd.get()->eTypeClass == typelib_TypeClass_BYTE) {
+ check(static_cast< sal_Int32 >(n));
+ rtl::ByteSequence s(
+ reinterpret_cast< sal_Int8 const * >(data_),
+ static_cast< sal_Int32 >(n));
+ data_ += n;
+ sal_Sequence * p = s.getHandle();
+ return BinaryAny(type, &p);
+ }
+ std::vector< BinaryAny > as;
+ for (sal_uInt32 i = 0; i != n; ++i) {
+ as.push_back(readValue(ctd));
+ }
+ OSL_ASSERT(ctd.get()->nSize >= 0);
+ sal_uInt64 size = static_cast< sal_uInt64 >(n) *
+ static_cast< sal_uInt64 >(ctd.get()->nSize);
+ // sal_uInt32 * sal_Int32 -> sal_uInt64 cannot overflow
+ if (size > SAL_MAX_SIZE - SAL_SEQUENCE_HEADER_SIZE) {
+ throw css::uno::RuntimeException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "binaryurp::Unmarshal: sequence size too large")),
+ css::uno::Reference< css::uno::XInterface >());
+ }
+ void * buf = allocate(
+ SAL_SEQUENCE_HEADER_SIZE + static_cast< sal_Size >(size));
+ static_cast< sal_Sequence * >(buf)->nRefCount = 0;
+ static_cast< sal_Sequence * >(buf)->nElements =
+ static_cast< sal_Int32 >(n);
+ for (sal_uInt32 i = 0; i != n; ++i) {
+ uno_copyData(
+ static_cast< sal_Sequence * >(buf)->elements + i * ctd.get()->nSize,
+ const_cast< void * >(as[i].getValue(ctd)), ctd.get(), 0);
+ }
+ return BinaryAny(type, reinterpret_cast< sal_Sequence ** >(&buf));
+}
+
+void Unmarshal::readMemberValues(
+ css::uno::TypeDescription const & type, std::vector< BinaryAny > * values)
+{
+ OSL_ASSERT(
+ type.is() &&
+ (type.get()->eTypeClass == typelib_TypeClass_STRUCT ||
+ type.get()->eTypeClass == typelib_TypeClass_EXCEPTION) &&
+ values != 0);
+ type.makeComplete();
+ typelib_CompoundTypeDescription * ctd =
+ reinterpret_cast< typelib_CompoundTypeDescription * >(type.get());
+ if (ctd->pBaseTypeDescription != 0) {
+ readMemberValues(
+ css::uno::TypeDescription(&ctd->pBaseTypeDescription->aBase),
+ values);
+ }
+ for (sal_Int32 i = 0; i != ctd->nMembers; ++i) {
+ values->push_back(
+ readValue(css::uno::TypeDescription(ctd->ppTypeRefs[i])));
+ }
+}
+
+}
diff --git a/binaryurp/source/unmarshal.hxx b/binaryurp/source/unmarshal.hxx
new file mode 100644
index 000000000000..33a4aafec75e
--- /dev/null
+++ b/binaryurp/source/unmarshal.hxx
@@ -0,0 +1,106 @@
+/*************************************************************************
+*
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2000, 2011 Oracle and/or its affiliates.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+*
+************************************************************************/
+
+#ifndef INCLUDED_BINARYURP_SOURCE_UNMARSHAL_HXX
+#define INCLUDED_BINARYURP_SOURCE_UNMARSHAL_HXX
+
+#include "sal/config.h"
+
+#include <vector>
+
+#include "boost/noncopyable.hpp"
+#include "com/sun/star/uno/Sequence.hxx"
+#include "rtl/ref.hxx"
+#include "sal/types.h"
+#include "typelib/typedescription.hxx"
+
+namespace binaryurp {
+ class BinaryAny;
+ class Bridge;
+ struct ReaderState;
+}
+namespace com { namespace sun { namespace star { namespace uno {
+ class TypeDescription;
+} } } }
+namespace rtl {
+ class ByteSequecne;
+ class OUString;
+}
+
+namespace binaryurp {
+
+class Unmarshal: private boost::noncopyable {
+public:
+ Unmarshal(
+ rtl::Reference< Bridge > const & bridge, ReaderState & state,
+ com::sun::star::uno::Sequence< sal_Int8 > const & buffer);
+
+ ~Unmarshal();
+
+ sal_uInt8 read8();
+
+ sal_uInt16 read16();
+
+ sal_uInt32 read32();
+
+ com::sun::star::uno::TypeDescription readType();
+
+ rtl::OUString readOid();
+
+ rtl::ByteSequence readTid();
+
+ BinaryAny readValue(com::sun::star::uno::TypeDescription const & type);
+
+ void done() const;
+
+private:
+ void check(sal_Int32 size) const;
+
+ sal_uInt32 readCompressed();
+
+ sal_uInt16 readCacheIndex();
+
+ sal_uInt64 read64();
+
+ rtl::OUString readString();
+
+ BinaryAny readSequence(com::sun::star::uno::TypeDescription const & type);
+
+ void readMemberValues(
+ com::sun::star::uno::TypeDescription const & type,
+ std::vector< BinaryAny > * values);
+
+ rtl::Reference< Bridge > bridge_;
+ ReaderState & state_;
+ com::sun::star::uno::Sequence< sal_Int8 > buffer_;
+ sal_uInt8 const * data_;
+ sal_uInt8 const * end_;
+};
+
+}
+
+#endif
diff --git a/binaryurp/source/writer.cxx b/binaryurp/source/writer.cxx
new file mode 100755
index 000000000000..97a60157eb6f
--- /dev/null
+++ b/binaryurp/source/writer.cxx
@@ -0,0 +1,476 @@
+/*************************************************************************
+*
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2000, 2011 Oracle and/or its affiliates.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+*
+************************************************************************/
+
+#include "sal/config.h"
+
+#include <exception>
+#include <vector>
+
+#include "com/sun/star/connection/XConnection.hpp"
+#include "com/sun/star/lang/WrappedTargetRuntimeException.hpp"
+#include "com/sun/star/uno/XCurrentContext.hpp"
+#include "cppuhelper/exc_hlp.hxx"
+#include "osl/mutex.hxx"
+#include "rtl/memory.h"
+#include "uno/dispatcher.hxx"
+
+#include "binaryany.hxx"
+#include "bridge.hxx"
+#include "currentcontext.hxx"
+#include "specialfunctionids.hxx"
+#include "writer.hxx"
+
+namespace binaryurp {
+
+namespace {
+
+namespace css = com::sun::star;
+
+bool isProtocolPropertyMessage(rtl::OUString const & oid) {
+ return oid.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("UrpProtocolProperties"));
+}
+
+}
+
+Writer::Item::Item() {}
+
+Writer::Item::Item(
+ rtl::ByteSequence const & theTid, rtl::OUString const & theOid,
+ css::uno::TypeDescription const & theType,
+ css::uno::TypeDescription const & theMember,
+ std::vector< BinaryAny > const & inArguments,
+ css::uno::UnoInterfaceReference const & theCurrentContext):
+ request(true), tid(theTid), oid(theOid), type(theType), member(theMember),
+ arguments(inArguments), currentContext(theCurrentContext)
+{}
+
+Writer::Item::Item(
+ rtl::ByteSequence const & theTid,
+ css::uno::TypeDescription const & theMember, bool theSetter,
+ bool theException, BinaryAny const & theReturnValue,
+ std::vector< BinaryAny > const & outArguments,
+ bool theSetCurrentContextMode):
+ request(false), tid(theTid), member(theMember), setter(theSetter),
+ arguments(outArguments), exception(theException),
+ returnValue(theReturnValue), setCurrentContextMode(theSetCurrentContextMode)
+{}
+
+Writer::Writer(rtl::Reference< Bridge > const & bridge):
+ bridge_(bridge), marshal_(bridge, state_), stop_(false)
+{
+ OSL_ASSERT(bridge.is());
+ acquire();
+}
+
+void Writer::sendDirectRequest(
+ rtl::ByteSequence const & tid, rtl::OUString const & oid,
+ css::uno::TypeDescription const & type,
+ css::uno::TypeDescription const & member,
+ std::vector< BinaryAny > const & inArguments)
+{
+ OSL_ASSERT(!unblocked_.check());
+ sendRequest(
+ tid, oid, type, member, inArguments, false,
+ css::uno::UnoInterfaceReference());
+}
+
+void Writer::sendDirectReply(
+ rtl::ByteSequence const & tid, css::uno::TypeDescription const & member,
+ bool exception, BinaryAny const & returnValue,
+ std::vector< BinaryAny > const & outArguments)
+{
+ OSL_ASSERT(!unblocked_.check());
+ sendReply(tid, member, false, exception, returnValue,outArguments);
+}
+
+void Writer::queueRequest(
+ rtl::ByteSequence const & tid, rtl::OUString const & oid,
+ css::uno::TypeDescription const & type,
+ css::uno::TypeDescription const & member,
+ std::vector< BinaryAny > const & inArguments)
+{
+ css::uno::UnoInterfaceReference cc(current_context::get());
+ osl::MutexGuard g(mutex_);
+ queue_.push_back(Item(tid, oid, type, member, inArguments, cc));
+ items_.set();
+}
+
+void Writer::queueReply(
+ rtl::ByteSequence const & tid,
+ com::sun::star::uno::TypeDescription const & member, bool setter,
+ bool exception, BinaryAny const & returnValue,
+ std::vector< BinaryAny > const & outArguments, bool setCurrentContextMode)
+{
+ osl::MutexGuard g(mutex_);
+ queue_.push_back(
+ Item(
+ tid, member, setter, exception, returnValue, outArguments,
+ setCurrentContextMode));
+ items_.set();
+}
+
+void Writer::unblock() {
+ // Assumes that osl::Condition::set works as a memory barrier, so that
+ // changes made by preceeding sendDirectRequest/Reply calls are visible to
+ // subsequent sendRequest/Reply calls:
+ unblocked_.set();
+}
+
+void Writer::stop() {
+ {
+ osl::MutexGuard g(mutex_);
+ stop_ = true;
+ }
+ unblocked_.set();
+ items_.set();
+}
+
+Writer::~Writer() {}
+
+void Writer::run() {
+ setName("binaryurpWriter");
+ try {
+ unblocked_.wait();
+ for (;;) {
+ items_.wait();
+ Item item;
+ {
+ osl::MutexGuard g(mutex_);
+ if (stop_) {
+ return;
+ }
+ OSL_ASSERT(!queue_.empty());
+ item = queue_.front();
+ queue_.pop_front();
+ if (queue_.empty()) {
+ items_.reset();
+ }
+ }
+ if (item.request) {
+ sendRequest(
+ item.tid, item.oid, item.type, item.member, item.arguments,
+ (!item.oid.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("UrpProtocolProperties")) &&
+ !item.member.equals(
+ css::uno::TypeDescription(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.uno.XInterface::"
+ "release")))) &&
+ bridge_->isCurrentContextMode()),
+ item.currentContext);
+ } else {
+ sendReply(
+ item.tid, item.member, item.setter, item.exception,
+ item.returnValue, item.arguments);
+ if (item.setCurrentContextMode) {
+ bridge_->setCurrentContextMode();
+ }
+ }
+ }
+ } catch (css::uno::Exception & e) {
+ OSL_TRACE(
+ OSL_LOG_PREFIX "caught UNO exception '%s'",
+ rtl::OUStringToOString(e.Message, RTL_TEXTENCODING_UTF8).getStr());
+ } catch (std::exception & e) {
+ OSL_TRACE(OSL_LOG_PREFIX "caught C++ exception '%s'", e.what());
+ }
+ bridge_->terminate();
+}
+
+void Writer::onTerminated() {
+ release();
+}
+
+void Writer::sendRequest(
+ rtl::ByteSequence const & tid, rtl::OUString const & oid,
+ css::uno::TypeDescription const & type,
+ css::uno::TypeDescription const & member,
+ std::vector< BinaryAny > const & inArguments, bool currentContextMode,
+ css::uno::UnoInterfaceReference const & currentContext)
+{
+ OSL_ASSERT(tid.getLength() != 0 && oid.getLength() != 0 && member.is());
+ css::uno::TypeDescription t(type);
+ sal_Int32 functionId = 0;
+ bool forceSynchronous = false;
+ member.makeComplete();
+ switch (member.get()->eTypeClass) {
+ case typelib_TypeClass_INTERFACE_ATTRIBUTE:
+ {
+ typelib_InterfaceAttributeTypeDescription * atd =
+ reinterpret_cast< typelib_InterfaceAttributeTypeDescription * >(
+ member.get());
+ OSL_ASSERT(atd->pInterface != 0);
+ if (!t.is()) {
+ t = css::uno::TypeDescription(&atd->pInterface->aBase);
+ }
+ t.makeComplete();
+ functionId = atd->pInterface->pMapMemberIndexToFunctionIndex[
+ atd->aBase.nPosition];
+ if (!inArguments.empty()) { // setter
+ ++functionId;
+ }
+ break;
+ }
+ case typelib_TypeClass_INTERFACE_METHOD:
+ {
+ typelib_InterfaceMethodTypeDescription * mtd =
+ reinterpret_cast< typelib_InterfaceMethodTypeDescription * >(
+ member.get());
+ OSL_ASSERT(mtd->pInterface != 0);
+ if (!t.is()) {
+ t = css::uno::TypeDescription(&mtd->pInterface->aBase);
+ }
+ t.makeComplete();
+ functionId = mtd->pInterface->pMapMemberIndexToFunctionIndex[
+ mtd->aBase.nPosition];
+ forceSynchronous = mtd->bOneWay &&
+ functionId != SPECIAL_FUNCTION_ID_RELEASE;
+ break;
+ }
+ default:
+ OSL_ASSERT(false); // this cannot happen
+ break;
+ }
+ OSL_ASSERT(functionId >= 0);
+ if (functionId > SAL_MAX_UINT16) {
+ throw css::uno::RuntimeException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM("function ID too large for URP")),
+ css::uno::Reference< css::uno::XInterface >());
+ }
+ std::vector< unsigned char > buf;
+ bool newType = !(lastType_.is() && t.equals(lastType_));
+ bool newOid = oid != lastOid_;
+ bool newTid = tid != lastTid_;
+ if (newType || newOid || newTid || forceSynchronous || functionId > 0x3FFF)
+ // > 14 bit function ID
+ {
+ Marshal::write8(
+ &buf,
+ (0xC0 | (newType ? 0x20 : 0) | (newOid ? 0x10 : 0) |
+ (newTid ? 0x08 : 0) | (functionId > 0xFF ? 0x04 : 0) |
+ (forceSynchronous ? 0x01 : 0)));
+ // bit 7: LONGHEADER, bit 6: REQUEST, bit 5: NEWTYPE, bit 4: NEWOID,
+ // bit 3: NEWTID, bit 2: FUNCTIONID16, bit 0: MOREFLAGS
+ if (forceSynchronous) {
+ Marshal::write8(&buf, 0xC0); // bit 7: MUSTREPLY, bit 6: SYNCHRONOUS
+ }
+ if (functionId <= 0xFF) {
+ Marshal::write8(&buf, static_cast< sal_uInt8 >(functionId));
+ } else {
+ Marshal::write16(&buf, static_cast< sal_uInt16 >(functionId));
+ }
+ if (newType) {
+ marshal_.writeType(&buf, t);
+ }
+ if (newOid) {
+ marshal_.writeOid(&buf, oid);
+ }
+ if (newTid) {
+ marshal_.writeTid(&buf, tid);
+ }
+ } else if (functionId <= 0x3F) { // <= 6 bit function ID
+ Marshal::write8(&buf, static_cast< sal_uInt8 >(functionId));
+ // bit 7: !LONGHEADER, bit 6: !FUNCTIONID14
+ } else {
+ Marshal::write8(
+ &buf, static_cast< sal_uInt8 >(0x40 | (functionId >> 8)));
+ // bit 7: !LONGHEADER, bit 6: FUNCTIONID14
+ Marshal::write8(&buf, functionId & 0xFF);
+ }
+ if (currentContextMode) {
+ css::uno::UnoInterfaceReference cc(currentContext);
+ marshal_.writeValue(
+ &buf,
+ css::uno::TypeDescription(
+ cppu::UnoType<
+ css::uno::Reference< css::uno::XCurrentContext > >::get()),
+ BinaryAny(
+ css::uno::TypeDescription(
+ cppu::UnoType<
+ css::uno::Reference<
+ css::uno::XCurrentContext > >::get()),
+ &cc.m_pUnoI));
+ }
+ switch (member.get()->eTypeClass) {
+ case typelib_TypeClass_INTERFACE_ATTRIBUTE:
+ if (!inArguments.empty()) { // setter
+ OSL_ASSERT(inArguments.size() == 1);
+ marshal_.writeValue(
+ &buf,
+ css::uno::TypeDescription(
+ reinterpret_cast<
+ typelib_InterfaceAttributeTypeDescription * >(
+ member.get())->
+ pAttributeTypeRef),
+ inArguments.front());
+ }
+ break;
+ case typelib_TypeClass_INTERFACE_METHOD:
+ {
+ typelib_InterfaceMethodTypeDescription * mtd =
+ reinterpret_cast< typelib_InterfaceMethodTypeDescription * >(
+ member.get());
+ std::vector< BinaryAny >::const_iterator i(inArguments.begin());
+ for (sal_Int32 j = 0; j != mtd->nParams; ++j) {
+ if (mtd->pParams[j].bIn) {
+ marshal_.writeValue(
+ &buf,
+ css::uno::TypeDescription(mtd->pParams[j].pTypeRef),
+ *i++);
+ }
+ }
+ OSL_ASSERT(i == inArguments.end());
+ break;
+ }
+ default:
+ OSL_ASSERT(false); // this cannot happen
+ break;
+ }
+ sendMessage(buf);
+ lastType_ = t;
+ lastOid_ = oid;
+ lastTid_ = tid;
+}
+
+void Writer::sendReply(
+ rtl::ByteSequence const & tid,
+ com::sun::star::uno::TypeDescription const & member, bool setter,
+ bool exception, BinaryAny const & returnValue,
+ std::vector< BinaryAny > const & outArguments)
+{
+ OSL_ASSERT(tid.getLength() != 0 && member.is() && member.get()->bComplete);
+ std::vector< unsigned char > buf;
+ bool newTid = tid != lastTid_;
+ Marshal::write8(&buf, 0x80 | (exception ? 0x20 : 0) | (newTid ? 0x08 : 0));
+ // bit 7: LONGHEADER; bit 6: !REQUEST; bit 5: EXCEPTION; bit 3: NEWTID
+ if (newTid) {
+ marshal_.writeTid(&buf, tid);
+ }
+ if (exception) {
+ marshal_.writeValue(
+ &buf,
+ css::uno::TypeDescription(cppu::UnoType< css::uno::Any >::get()),
+ returnValue);
+ } else {
+ switch (member.get()->eTypeClass) {
+ case typelib_TypeClass_INTERFACE_ATTRIBUTE:
+ if (!setter) {
+ marshal_.writeValue(
+ &buf,
+ css::uno::TypeDescription(
+ reinterpret_cast<
+ typelib_InterfaceAttributeTypeDescription * >(
+ member.get())->
+ pAttributeTypeRef),
+ returnValue);
+ }
+ break;
+ case typelib_TypeClass_INTERFACE_METHOD:
+ {
+ typelib_InterfaceMethodTypeDescription * mtd =
+ reinterpret_cast<
+ typelib_InterfaceMethodTypeDescription * >(
+ member.get());
+ marshal_.writeValue(
+ &buf, css::uno::TypeDescription(mtd->pReturnTypeRef),
+ returnValue);
+ std::vector< BinaryAny >::const_iterator i(
+ outArguments.begin());
+ for (sal_Int32 j = 0; j != mtd->nParams; ++j) {
+ if (mtd->pParams[j].bOut) {
+ marshal_.writeValue(
+ &buf,
+ css::uno::TypeDescription(mtd->pParams[j].pTypeRef),
+ *i++);
+ }
+ }
+ OSL_ASSERT(i == outArguments.end());
+ break;
+ }
+ default:
+ OSL_ASSERT(false); // this cannot happen
+ break;
+ }
+ }
+ sendMessage(buf);
+ lastTid_ = tid;
+ bridge_->decrementCalls();
+}
+
+void Writer::sendMessage(std::vector< unsigned char > const & buffer) {
+ std::vector< unsigned char > header;
+ if (buffer.size() > SAL_MAX_UINT32) {
+ throw css::uno::RuntimeException(
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM("message too large for URP")),
+ css::uno::Reference< css::uno::XInterface >());
+ }
+ Marshal::write32(&header, static_cast< sal_uInt32 >(buffer.size()));
+ Marshal::write32(&header, 1);
+ OSL_ASSERT(!buffer.empty());
+ unsigned char const * p = &buffer[0];
+ std::vector< unsigned char >::size_type n = buffer.size();
+ OSL_ASSERT(header.size() <= SAL_MAX_INT32 && SAL_MAX_INT32 <= SAL_MAX_SIZE);
+ sal_Size k = SAL_MAX_INT32 - header.size();
+ if (n < k) {
+ k = static_cast< sal_Size >(n);
+ }
+ css::uno::Sequence< sal_Int8 > s(
+ static_cast< sal_Int32 >(header.size() + k));
+ OSL_ASSERT(!header.empty());
+ rtl_copyMemory(
+ s.getArray(), &header[0], static_cast< sal_Size >(header.size()));
+ for (;;) {
+ rtl_copyMemory(s.getArray() + s.getLength() - k, p, k);
+ try {
+ bridge_->getConnection()->write(s);
+ } catch (css::io::IOException & e) {
+ css::uno::Any exc(cppu::getCaughtException());
+ throw css::lang::WrappedTargetRuntimeException(
+ (rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "Binary URP write raised IO exception: ")) +
+ e.Message),
+ css::uno::Reference< css::uno::XInterface >(), exc);
+ }
+ n = static_cast< std::vector< unsigned char >::size_type >(n - k);
+ if (n == 0) {
+ break;
+ }
+ p += k;
+ k = SAL_MAX_INT32;
+ if (n < k) {
+ k = static_cast< sal_Size >(n);
+ }
+ s.realloc(k);
+ }
+}
+
+}
diff --git a/binaryurp/source/writer.hxx b/binaryurp/source/writer.hxx
new file mode 100644
index 000000000000..fe5dba2cc1d9
--- /dev/null
+++ b/binaryurp/source/writer.hxx
@@ -0,0 +1,185 @@
+/*************************************************************************
+*
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2000, 2011 Oracle and/or its affiliates.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+*
+************************************************************************/
+
+#ifndef INCLUDED_BINARYURP_SOURCE_WRITER_HXX
+#define INCLUDED_BINARYURP_SOURCE_WRITER_HXX
+
+#include "sal/config.h"
+
+#include <cstddef>
+#include <deque>
+#include <vector>
+
+#include "boost/noncopyable.hpp"
+#include "osl/conditn.hxx"
+#include "osl/mutex.hxx"
+#include "osl/thread.hxx"
+#include "rtl/byteseq.hxx"
+#include "rtl/ref.hxx"
+#include "rtl/ustring.hxx"
+#include "sal/types.h"
+#include "salhelper/simplereferenceobject.hxx"
+#include "typelib/typedescription.hxx"
+#include "uno/dispatcher.hxx"
+
+#include "binaryany.hxx"
+#include "marshal.hxx"
+#include "writerstate.hxx"
+
+namespace binaryurp { class Bridge; }
+
+namespace binaryurp {
+
+class Writer:
+ public osl::Thread, public salhelper::SimpleReferenceObject,
+ private boost::noncopyable
+{
+public:
+ static void * operator new(std::size_t size)
+ { return Thread::operator new(size); }
+
+ static void operator delete(void * pointer)
+ { Thread::operator delete(pointer); }
+
+ explicit Writer(rtl::Reference< Bridge > const & bridge);
+
+ // Only called from Bridge::reader_ thread, and only before Bridge::writer_
+ // thread is unblocked:
+ void sendDirectRequest(
+ rtl::ByteSequence const & tid, rtl::OUString const & oid,
+ com::sun::star::uno::TypeDescription const & type,
+ com::sun::star::uno::TypeDescription const & member,
+ std::vector< BinaryAny > const & inArguments);
+
+ // Only called from Bridge::reader_ thread, and only before Bridge::writer_
+ // thread is unblocked:
+ void sendDirectReply(
+ rtl::ByteSequence const & tid,
+ com::sun::star::uno::TypeDescription const & member,
+ bool exception, BinaryAny const & returnValue,
+ std::vector< BinaryAny > const & outArguments);
+
+ void queueRequest(
+ rtl::ByteSequence const & tid, rtl::OUString const & oid,
+ com::sun::star::uno::TypeDescription const & type,
+ com::sun::star::uno::TypeDescription const & member,
+ std::vector< BinaryAny > const & inArguments);
+
+ void queueReply(
+ rtl::ByteSequence const & tid,
+ com::sun::star::uno::TypeDescription const & member, bool setter,
+ bool exception, BinaryAny const & returnValue,
+ std::vector< BinaryAny > const & outArguments,
+ bool setCurrentContextMode);
+
+ void unblock();
+
+ void stop();
+
+private:
+ virtual ~Writer();
+
+ virtual void SAL_CALL run();
+
+ virtual void SAL_CALL onTerminated();
+
+ void sendRequest(
+ rtl::ByteSequence const & tid, rtl::OUString const & oid,
+ com::sun::star::uno::TypeDescription const & type,
+ com::sun::star::uno::TypeDescription const & member,
+ std::vector< BinaryAny > const & inArguments, bool currentContextMode,
+ com::sun::star::uno::UnoInterfaceReference const & currentContext);
+
+ void sendReply(
+ rtl::ByteSequence const & tid,
+ com::sun::star::uno::TypeDescription const & member, bool setter,
+ bool exception, BinaryAny const & returnValue,
+ std::vector< BinaryAny > const & outArguments);
+
+ void sendMessage(std::vector< unsigned char > const & buffer);
+
+ struct Item {
+ Item();
+
+ // Request:
+ Item(
+ rtl::ByteSequence const & theTid, rtl::OUString const & theOid,
+ com::sun::star::uno::TypeDescription const & theType,
+ com::sun::star::uno::TypeDescription const & theMember,
+ std::vector< BinaryAny > const & inArguments,
+ com::sun::star::uno::UnoInterfaceReference const &
+ theCurrentContext);
+
+ // Reply:
+ Item(
+ rtl::ByteSequence const & theTid,
+ com::sun::star::uno::TypeDescription const & theMember,
+ bool theSetter, bool theException, BinaryAny const & theReturnValue,
+ std::vector< BinaryAny > const & outArguments,
+ bool theSetCurrentContextMode);
+
+ bool request;
+
+ rtl::ByteSequence tid; // request + reply
+
+ rtl::OUString oid; // request
+
+ com::sun::star::uno::TypeDescription type; // request
+
+ com::sun::star::uno::TypeDescription member; // request + reply
+
+ bool setter; // reply
+
+ std::vector< BinaryAny > arguments;
+ // request: inArguments; reply: outArguments
+
+ bool exception; // reply
+
+ BinaryAny returnValue; // reply
+
+ com::sun::star::uno::UnoInterfaceReference currentContext; // request
+
+ bool setCurrentContextMode; // reply
+ };
+
+ rtl::Reference< Bridge > bridge_;
+ WriterState state_;
+ Marshal marshal_;
+ com::sun::star::uno::TypeDescription lastType_;
+ rtl::OUString lastOid_;
+ rtl::ByteSequence lastTid_;
+ osl::Condition unblocked_;
+ osl::Condition items_;
+
+ osl::Mutex mutex_;
+ std::deque< Item > queue_;
+ bool stop_;
+};
+
+}
+
+#endif
diff --git a/binaryurp/source/writerstate.hxx b/binaryurp/source/writerstate.hxx
new file mode 100644
index 000000000000..cbb0208ba019
--- /dev/null
+++ b/binaryurp/source/writerstate.hxx
@@ -0,0 +1,55 @@
+/*************************************************************************
+*
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2000, 2011 Oracle and/or its affiliates.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+*
+************************************************************************/
+
+#ifndef INCLUDED_BINARYURP_SOURCE_WRITERSTATE_HXX
+#define INCLUDED_BINARYURP_SOURCE_WRITERSTATE_HXX
+
+#include "sal/config.h"
+
+#include "boost/noncopyable.hpp"
+#include "rtl/byteseq.hxx"
+#include "rtl/ustring.hxx"
+#include "typelib/typedescription.hxx"
+
+#include "cache.hxx"
+
+namespace binaryurp {
+
+struct WriterState: private boost::noncopyable {
+ WriterState():
+ typeCache(cache::size), oidCache(cache::size), tidCache(cache::size) {}
+
+ Cache< com::sun::star::uno::TypeDescription > typeCache;
+
+ Cache< rtl::OUString > oidCache;
+
+ Cache< rtl::ByteSequence > tidCache;
+};
+
+}
+
+#endif
diff --git a/bridges/inc/bridges/remote/bridgeimpl.hxx b/bridges/inc/bridges/remote/bridgeimpl.hxx
deleted file mode 100644
index 0257dd5f879a..000000000000
--- a/bridges/inc/bridges/remote/bridgeimpl.hxx
+++ /dev/null
@@ -1,94 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef _BRIDGES_REMOTE_BRIDGEIMPL_HXX_
-#define _BRIDGES_REMOTE_BRIDGEIMPL_HXX_
-#include <osl/interlck.h>
-
-#include <uno/environment.h>
-
-#include <bridges/remote/context.h>
-#include <bridges/remote/remote.h>
-
-
-struct remote_BridgeImpl
-{
- void (SAL_CALL * m_allThreadsAreGone ) ( uno_Environment * );
- requestClientSideDispatcher m_sendRequest;
- oslInterlockedCount m_nRemoteThreads;
- sal_Bool m_bDisposed;
- sal_Bool m_bReleaseStubsCalled;
-};
-
-namespace bridges_remote {
-
- enum RemoteThreadCounter_HoldEnvWeak
- {
- RTC_HOLDENVWEAK = 0x1
- };
-
- class RemoteThreadCounter
- {
- public:
- // performance optimization. In some cases, it is not necessary to acquire the
- // environment.
- RemoteThreadCounter( uno_Environment *pEnvRemote, RemoteThreadCounter_HoldEnvWeak )
- : m_bReleaseEnvironment( sal_False )
- , m_pEnvRemote( pEnvRemote )
- {
- remote_Context *pContext = ((remote_Context *) m_pEnvRemote->pContext );
- osl_incrementInterlockedCount( &( pContext->m_pBridgeImpl->m_nRemoteThreads ) );
- }
-
- RemoteThreadCounter( uno_Environment *pEnvRemote )
- : m_bReleaseEnvironment( sal_True )
- , m_pEnvRemote( pEnvRemote )
- {
- m_pEnvRemote->acquire( m_pEnvRemote );
-
- remote_Context *pContext = ((remote_Context *) m_pEnvRemote->pContext );
- osl_incrementInterlockedCount( &( pContext->m_pBridgeImpl->m_nRemoteThreads ) );
- }
-
- ~RemoteThreadCounter( )
- {
- remote_Context *pContext = ((remote_Context *) m_pEnvRemote->pContext );
- if( 0 == osl_decrementInterlockedCount( &( pContext->m_pBridgeImpl->m_nRemoteThreads)) &&
- pContext->m_pBridgeImpl->m_bDisposed &&
- ! pContext->m_pBridgeImpl->m_bReleaseStubsCalled )
- {
- pContext->m_pBridgeImpl->m_allThreadsAreGone( m_pEnvRemote );
- }
- if( m_bReleaseEnvironment )
- m_pEnvRemote->release( m_pEnvRemote );
- }
-
- sal_Bool m_bReleaseEnvironment;
- uno_Environment *m_pEnvRemote;
- };
-}
-
-#endif
diff --git a/bridges/inc/bridges/remote/connection.h b/bridges/inc/bridges/remote/connection.h
deleted file mode 100644
index b374b73bc8cf..000000000000
--- a/bridges/inc/bridges/remote/connection.h
+++ /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
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef _BRIDGES_REMOTE_CONNECTION_H_
-#define _BRIDGES_REMOTE_CONNECTION_H_
-#include <sal/types.h>
-
-/** Specfies a C-interface for a bidirectional bytestream,
- which is used by a UNO remote environment.
- */
-struct remote_Connection
-{
- void ( SAL_CALL * acquire ) ( remote_Connection *);
-
- void ( SAL_CALL * release ) ( remote_Connection *);
-
- /**
- reads nSize bytes from the connection. This method blocks, until
- all bytes are available or an error occurs.
- @return Number of bytes read.
- If the return value is less than nSize, an unrecoverable
- i/o error has occured or the connection was closed.
-
- */
- sal_Int32 (SAL_CALL * read)(remote_Connection *, sal_Int8 *pDest, sal_Int32 nSize );
-
- /**
- @return Number of bytes written.
- if the return value is less than nSize an unrecoverable
- i/o error has occured or the connection was closed.
- */
- sal_Int32 (SAL_CALL * write)(remote_Connection *, const sal_Int8 *pSource, sal_Int32 nSize );
-
- void ( SAL_CALL * flush ) ( remote_Connection * );
-
- /** closes the connection.
- Any read or write operation after this call shall not be served
- anymore. Any ongoing read or write operation must return immeadiatly after this call.
- The implementation should cope with multiple calls to this method.
- */
- void (SAL_CALL * close) ( remote_Connection * );
-};
-
-#endif
diff --git a/bridges/inc/bridges/remote/context.h b/bridges/inc/bridges/remote/context.h
deleted file mode 100644
index e03310ce5e27..000000000000
--- a/bridges/inc/bridges/remote/context.h
+++ /dev/null
@@ -1,260 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _BRIDGES_REMOTE_CONTEXT_H_
-#define _BRIDGES_REMOTE_CONTEXT_H_
-#include <osl/interlck.h>
-#include <osl/conditn.h>
-
-#include <typelib/typedescription.h>
-
-#include <uno/environment.h>
-#include <uno/any2.h>
-
-
-/** Interface for refcounted contexts of uno-environments.
-
- Not all uno_Contexts need to be refcounted, in case they are,
- they should be 'derived' from this struct.
- This is used as a base class for the remote_Context.
- @see uno_Environment
- @see uno_getEnvironment()
- @see remote_Context
- */
-struct uno_Context
-{
- /** increase the refcount of the context
- */
- void (SAL_CALL * acquire)( uno_Context *pContext );
-
- /** decrements the recount of the context. In case the recount drops to zero,
- the context gets destroye.
- */
- void (SAL_CALL * release)( uno_Context *pContext);
-
- /** Allows to query for a different interface of the uno_Context.
- The result of the void pointer is unspecified and depends on the concrete context.
- */
- void * (SAL_CALL *query ) ( uno_Context *pContext , rtl_uString *pId);
-};
-
-struct remote_Connection;
-struct remote_Context;
-struct remote_Interface;
-
-
-
-/** performs a query-interface for a certain interface via the remote connection !
-
- @param pEnvRemote The environment, that shall perform the call.
- @param ppRemoteI in/out parameter contains the interface returned by queryInterface
- @param pOid the oid of the 'ghost' object on which the call must be done.
- ***/
-typedef void ( SAL_CALL * remote_getInstanceFunc ) (
- uno_Environment *pEnvRemote,
- remote_Interface **ppRemoteI,
- rtl_uString *pOid,
- typelib_TypeDescriptionReference *pInterfaceTypeRef,
- uno_Any **ppException );
-
-
-/** refcounted C-interface, which provides object by name.
- */
-struct remote_InstanceProvider
-{
- void (SAL_CALL * acquire ) ( remote_InstanceProvider * pProvider );
- void (SAL_CALL * release ) ( remote_InstanceProvider * pProvider );
- void (SAL_CALL * getInstance ) ( remote_InstanceProvider * pProvider ,
- uno_Environment *pEnvRemote,
- remote_Interface **ppRemoteI,
- rtl_uString *pInstanceName,
- typelib_InterfaceTypeDescription *pType,
- uno_Any **ppException );
-};
-
-/** refcounted C-interface, which allows to register a listener to an
- remote bridge to be informed when the bridge gets disposed.
-
- @see remote_Context
- */
-struct remote_DisposingListener
-{
- void (SAL_CALL * acquire ) ( remote_DisposingListener * pProvider );
- void (SAL_CALL * release ) ( remote_DisposingListener * pProvider );
- void (SAL_CALL * disposing ) ( remote_DisposingListener * pProvider,
- rtl_uString *pBridgeName );
-};
-
-
-/**
- Try to get an existing context characterized by the pIdString. Each ID-String must
- uniquely charcterize a certain connection. The context can't be retrieved via this
- function anymore, after it got disposed.
-
- @return 0 when such a context does not exist, otherwise
- a pointer to an acquired remote_Context.
- **/
-extern "C" remote_Context * SAL_CALL
-remote_getContext( rtl_uString *pIdString );
-
-/**
- Create an acquired remote context. The Context is weakly held by the context administration
- and can be accessed later through remote_getContext() (using the same id-string).
-
- @param pIdString A string, that uniquely describes the connection. For e.g. a socket connection,
- host and port of the local and remote host should be in the string.
-
- @param pDescription
- Description of the connection, that may brought up to the user.
-
- @param pProtocol
- The protocol, that the environment uses for
- communicating with the remote process.
- The format of the protocol string is : "protocolname,para1=para1value,..."
- @return 0, when a context with this name already exists.
-
- @see remote_getContext()
- @see remote_Context
- */
-extern "C" remote_Context * SAL_CALL
-remote_createContext( remote_Connection *pConnection,
- rtl_uString *pIdStr,
- rtl_uString *pDescription,
- rtl_uString *pProtocol,
- remote_InstanceProvider *);
-
-const sal_Int32 REMOTE_CONTEXT_CREATE = 1;
-const sal_Int32 REMOTE_CONTEXT_DESTROY = 2;
-
-typedef void ( SAL_CALL * remote_contextListenerFunc ) (
- void *pThis,
- sal_Int32 nRemoteContextMode,
- rtl_uString *sName,
- rtl_uString *sDescription
- );
-
-/** Registers a listener at the context administration, which allows to keep
- track of existing remote connections.
- @param pObject object which is handed to the listener function, when called.
- */
-extern "C" void SAL_CALL
-remote_addContextListener( remote_contextListenerFunc listener, void *pObject );
-
-
-/** Removes a listener from the context administration.
- */
-extern "C" void SAL_CALL
-remote_removeContextListener( remote_contextListenerFunc listener , void *pObject );
-
-/** Allows to retrieve all existing context strings.
-
- @param pnStringCount out parameter. Contains the number of rtl_uStrings in the array
- @param memAlloc a memory allocation function for the array of pointers to rtl_uStrings
-
- @return array of rtl strings. The caller must call release on all rtl_uString s and must free
- the pointer array.
- */
-extern "C" rtl_uString ** SAL_CALL
-remote_getContextList(
- sal_Int32 *pnStringCount,
- void * ( SAL_CALL * memAlloc ) ( sal_Size nBytesToAlloc ) );
-
-
-struct remote_BridgeImpl;
-
-/** The context structure for a remote bridge.
-
- @see uno_getEnvironment()
- */
-struct remote_Context
-{
- struct uno_Context aBase;
-
- /**
- These methods are implemented by context administration
- */
- void ( SAL_CALL * addDisposingListener ) ( remote_Context *,
- remote_DisposingListener * );
- void ( SAL_CALL * removeDisposingListener ) ( remote_Context *,
- remote_DisposingListener * );
- /**
- will be called by the environment when it gets disposed
- */
- void ( SAL_CALL * dispose ) ( remote_Context * );
-
- /** The method is set by the remote-environment during environment initialization.
- @see remote_getInstanceFunc
- */
- remote_getInstanceFunc getRemoteInstance;
-
- /**
- The protocol, that the environment uses for communicating with the remote process.
- The format of the protocol string is : "protocolname,para1=para1value,..."
- The parameters are protocol dependend
- */
- rtl_uString *m_pProtocol;
-
- /**
- It may be the same as m_pName.
- Livetime is handled by the context administration.
- */
- rtl_uString *m_pDescription;
-
- /**
- The name of this context at context administration.
- A string, that uniquely describes this environment.
- Livetime is handled by the context administration.
- */
- rtl_uString *m_pName;
-
- /** The instance-provider, which is used to look up unknown object identifiers.
- Is usually called on server side, when the first client request comes in.
- Maybe 0. Livetime is handled by the context administration.
- */
- remote_InstanceProvider *m_pInstanceProvider;
-
- /**
- The connection of this context.
- Livetime is handled by the context administration.
- */
- remote_Connection *m_pConnection;
-
- /**
- Here arbitrary data may be stored. It may be used by a connection
- service to store environment specific data. The bridge does not
- use it.
- */
- void *m_pAdditionalInformation;
-
- /**
- here the bridge stores its private per environment data.
- */
- struct remote_BridgeImpl *m_pBridgeImpl;
-};
-
-#endif
-
diff --git a/bridges/inc/bridges/remote/counter.hxx b/bridges/inc/bridges/remote/counter.hxx
deleted file mode 100644
index deead1d2cb1e..000000000000
--- a/bridges/inc/bridges/remote/counter.hxx
+++ /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