summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--configmgr/prj/build.lst2
-rw-r--r--configmgr/qa/unit/makefile.mk3
-rw-r--r--configmgr/qa/unit/performance.cxx34
-rw-r--r--configmgr/qa/unit/threading.cxx11
-rw-r--r--configmgr/source/api/confeventhelpers.cxx362
-rw-r--r--configmgr/source/api/confeventhelpers.hxx204
-rw-r--r--configmgr/source/api/confevents.cxx299
-rw-r--r--configmgr/source/api/confsvccomponent.cxx11
-rw-r--r--configmgr/source/api/makefile.mk1
-rw-r--r--configmgr/source/api2/accessimpl.cxx360
-rw-r--r--configmgr/source/api2/accessimpl.hxx27
-rw-r--r--configmgr/source/api2/apiaccessobj.hxx85
-rw-r--r--configmgr/source/api2/apiaccessobj.inl24
-rw-r--r--configmgr/source/api2/apifactory.cxx136
-rw-r--r--configmgr/source/api2/apifactory.hxx50
-rw-r--r--configmgr/source/api2/apifactoryimpl.cxx104
-rw-r--r--configmgr/source/api2/apifactoryimpl.hxx18
-rw-r--r--configmgr/source/api2/apinodeaccess.cxx59
-rw-r--r--configmgr/source/api2/apinodeaccess.hxx93
-rw-r--r--configmgr/source/api2/apinodeupdate.cxx31
-rw-r--r--configmgr/source/api2/apinodeupdate.hxx35
-rw-r--r--configmgr/source/api2/apinotifierimpl.cxx112
-rw-r--r--configmgr/source/api2/apinotifierimpl.hxx11
-rw-r--r--configmgr/source/api2/apiserviceinfo.cxx34
-rw-r--r--configmgr/source/api2/apiserviceinfo.hxx4
-rw-r--r--configmgr/source/api2/apitreeaccess.cxx47
-rw-r--r--configmgr/source/api2/apitreeaccess.hxx78
-rw-r--r--configmgr/source/api2/apitreeimplobj.cxx212
-rw-r--r--configmgr/source/api2/apitreeimplobj.hxx76
-rw-r--r--configmgr/source/api2/broadcaster.cxx534
-rw-r--r--configmgr/source/api2/broadcaster.hxx25
-rw-r--r--configmgr/source/api2/committer.cxx20
-rw-r--r--configmgr/source/api2/committer.hxx4
-rw-r--r--configmgr/source/api2/confignotifier.cxx82
-rw-r--r--configmgr/source/api2/confignotifier.hxx58
-rw-r--r--configmgr/source/api2/confprovider2.cxx607
-rw-r--r--configmgr/source/api2/confprovider2.hxx141
-rw-r--r--configmgr/source/api2/confproviderimpl2.cxx132
-rw-r--r--configmgr/source/api2/confproviderimpl2.hxx67
-rw-r--r--configmgr/source/api2/elementaccess.cxx142
-rw-r--r--configmgr/source/api2/elementaccess.hxx91
-rw-r--r--configmgr/source/api2/elementimpl.cxx171
-rw-r--r--configmgr/source/api2/elementimpl.hxx15
-rw-r--r--configmgr/source/api2/groupaccess.cxx39
-rw-r--r--configmgr/source/api2/groupaccess.hxx19
-rw-r--r--configmgr/source/api2/groupobjects.cxx48
-rw-r--r--configmgr/source/api2/groupobjects.hxx87
-rw-r--r--configmgr/source/api2/groupupdate.cxx13
-rw-r--r--configmgr/source/api2/groupupdate.hxx8
-rw-r--r--configmgr/source/api2/listenercontainer.cxx6
-rw-r--r--configmgr/source/api2/listenercontainer.hxx112
-rw-r--r--configmgr/source/api2/makefile.mk2
-rw-r--r--configmgr/source/api2/notifierimpl.hxx99
-rw-r--r--configmgr/source/api2/objectregistry.hxx17
-rw-r--r--configmgr/source/api2/propertiesfilterednotifier.cxx26
-rw-r--r--configmgr/source/api2/propertyinfohelper.cxx4
-rw-r--r--configmgr/source/api2/propertyinfohelper.hxx3
-rw-r--r--configmgr/source/api2/propertysetaccess.cxx49
-rw-r--r--configmgr/source/api2/propertysetaccess.hxx43
-rw-r--r--configmgr/source/api2/propsetaccessimpl.cxx704
-rw-r--r--configmgr/source/api2/propsetaccessimpl.hxx31
-rw-r--r--configmgr/source/api2/provider.cxx531
-rw-r--r--configmgr/source/api2/provider.hxx95
-rw-r--r--configmgr/source/api2/providerimpl.cxx264
-rw-r--r--configmgr/source/api2/providerimpl.hxx122
-rw-r--r--configmgr/source/api2/setaccess.cxx61
-rw-r--r--configmgr/source/api2/setaccess.hxx35
-rw-r--r--configmgr/source/api2/setobjects.cxx66
-rw-r--r--configmgr/source/api2/setobjects.hxx120
-rw-r--r--configmgr/source/api2/setupdate.cxx27
-rw-r--r--configmgr/source/api2/setupdate.hxx24
-rw-r--r--configmgr/source/api2/translatechanges.cxx71
-rw-r--r--configmgr/source/api2/translatechanges.hxx12
-rw-r--r--configmgr/source/api2/treeiterators.cxx29
-rw-r--r--configmgr/source/api2/treeiterators.hxx27
-rw-r--r--configmgr/source/api2/updateimpl.cxx329
-rw-r--r--configmgr/source/api2/updateimpl.hxx15
-rw-r--r--configmgr/source/backend/backendaccess.cxx145
-rw-r--r--configmgr/source/backend/backendaccess.hxx35
-rw-r--r--configmgr/source/backend/backendfactory.cxx67
-rw-r--r--configmgr/source/backend/backendnotifier.cxx18
-rw-r--r--configmgr/source/backend/backendnotifier.hxx14
-rw-r--r--configmgr/source/backend/backendstratalistener.hxx4
-rw-r--r--configmgr/source/backend/basicimporthandler.cxx16
-rw-r--r--configmgr/source/backend/basicimporthandler.hxx25
-rw-r--r--configmgr/source/backend/basicupdatemerger.cxx64
-rw-r--r--configmgr/source/backend/basicupdatemerger.hxx65
-rw-r--r--configmgr/source/backend/binarycache.cxx48
-rw-r--r--configmgr/source/backend/binarycache.hxx11
-rw-r--r--configmgr/source/backend/binaryreader.cxx26
-rw-r--r--configmgr/source/backend/binaryreader.hxx9
-rw-r--r--configmgr/source/backend/binaryreadhandler.cxx135
-rw-r--r--configmgr/source/backend/binaryreadhandler.hxx14
-rw-r--r--configmgr/source/backend/binarytype.hxx2
-rw-r--r--configmgr/source/backend/binarywritehandler.cxx68
-rw-r--r--configmgr/source/backend/binarywritehandler.hxx10
-rw-r--r--configmgr/source/backend/binarywriter.cxx4
-rw-r--r--configmgr/source/backend/binarywriter.hxx4
-rw-r--r--configmgr/source/backend/componentdatahelper.cxx158
-rw-r--r--configmgr/source/backend/componentdatahelper.hxx119
-rw-r--r--configmgr/source/backend/emptylayer.cxx20
-rw-r--r--configmgr/source/backend/emptylayerimpl.hxx17
-rw-r--r--configmgr/source/backend/importmergehandler.cxx66
-rw-r--r--configmgr/source/backend/importmergehandler.hxx57
-rw-r--r--configmgr/source/backend/importsvc.cxx58
-rw-r--r--configmgr/source/backend/importsvc.hxx42
-rw-r--r--configmgr/source/backend/layerdefaultremover.cxx50
-rw-r--r--configmgr/source/backend/layerdefaultremover.hxx55
-rw-r--r--configmgr/source/backend/layermerge.cxx105
-rw-r--r--configmgr/source/backend/layermerge.hxx85
-rw-r--r--configmgr/source/backend/layerupdate.cxx15
-rw-r--r--configmgr/source/backend/layerupdate.hxx19
-rw-r--r--configmgr/source/backend/layerupdatebuilder.cxx34
-rw-r--r--configmgr/source/backend/layerupdatebuilder.hxx19
-rw-r--r--configmgr/source/backend/layerupdatehandler.cxx70
-rw-r--r--configmgr/source/backend/layerupdatehandler.hxx68
-rw-r--r--configmgr/source/backend/layerupdatemerger.cxx72
-rw-r--r--configmgr/source/backend/layerupdatemerger.hxx54
-rw-r--r--configmgr/source/backend/mergedcomponentdata.cxx12
-rw-r--r--configmgr/source/backend/mergedcomponentdata.hxx16
-rw-r--r--configmgr/source/backend/multistratumbackend.cxx78
-rw-r--r--configmgr/source/backend/multistratumbackend.hxx19
-rw-r--r--configmgr/source/backend/schemabuilder.cxx93
-rw-r--r--configmgr/source/backend/schemabuilder.hxx60
-rw-r--r--configmgr/source/backend/singlebackendadapter.cxx12
-rw-r--r--configmgr/source/backend/singlebackendadapter.hxx7
-rw-r--r--configmgr/source/backend/updatedata.cxx70
-rw-r--r--configmgr/source/backend/updatedata.hxx95
-rw-r--r--configmgr/source/backend/updatedispatch.cxx136
-rw-r--r--configmgr/source/backend/updatedispatch.hxx22
-rw-r--r--configmgr/source/backend/updatesvc.cxx22
-rw-r--r--configmgr/source/backend/updatesvc.hxx24
-rw-r--r--configmgr/source/backendhelper/backendlayerhelper.cxx2
-rw-r--r--configmgr/source/backendhelper/backendlayerhelper.hxx8
-rw-r--r--configmgr/source/backendhelper/componentdf.cxx13
-rw-r--r--configmgr/source/data/anydata.cxx43
-rw-r--r--configmgr/source/data/makefile.mk2
-rw-r--r--configmgr/source/data/sequence.cxx103
-rw-r--r--configmgr/source/inc/anydata.hxx21
-rw-r--r--configmgr/source/inc/anynoderef.hxx39
-rw-r--r--configmgr/source/inc/anypair.hxx22
-rw-r--r--configmgr/source/inc/autoobject.hxx20
-rw-r--r--configmgr/source/inc/autoreferencemap.hxx30
-rw-r--r--configmgr/source/inc/backendfactory.hxx14
-rw-r--r--configmgr/source/inc/bootstrap.hxx57
-rw-r--r--configmgr/source/inc/bootstrapcontext.hxx48
-rw-r--r--configmgr/source/inc/bufferedfile.hxx7
-rw-r--r--configmgr/source/inc/builddata.hxx14
-rw-r--r--configmgr/source/inc/cacheddataprovider.hxx264
-rw-r--r--configmgr/source/inc/cachefactory.hxx5
-rw-r--r--configmgr/source/inc/change.hxx59
-rw-r--r--configmgr/source/inc/commontypes.hxx68
-rw-r--r--configmgr/source/inc/confapifactory.hxx48
-rw-r--r--configmgr/source/inc/confevents.hxx186
-rw-r--r--configmgr/source/inc/configdefaultprovider.hxx11
-rw-r--r--configmgr/source/inc/configexcept.hxx23
-rw-r--r--configmgr/source/inc/configgroup.hxx37
-rw-r--r--configmgr/source/inc/configpath.hxx219
-rw-r--r--configmgr/source/inc/configset.hxx153
-rw-r--r--configmgr/source/inc/confsvccomponent.hxx14
-rw-r--r--configmgr/source/inc/datalock.hxx8
-rw-r--r--configmgr/source/inc/defaultprovider.hxx49
-rw-r--r--configmgr/source/inc/filehelper.hxx2
-rw-r--r--configmgr/source/inc/flags.hxx3
-rw-r--r--configmgr/source/inc/groupnodeaccess.hxx111
-rw-r--r--configmgr/source/inc/interactionrequest.hxx6
-rw-r--r--configmgr/source/inc/localizedtreeactions.hxx4
-rw-r--r--configmgr/source/inc/logger.hxx25
-rw-r--r--configmgr/source/inc/matchlocale.hxx62
-rw-r--r--configmgr/source/inc/mergeddataprovider.hxx124
-rw-r--r--configmgr/source/inc/namecreator.hxx18
-rw-r--r--configmgr/source/inc/node.hxx108
-rw-r--r--configmgr/source/inc/nodeaccess.hxx77
-rw-r--r--configmgr/source/inc/nodechange.hxx27
-rw-r--r--configmgr/source/inc/nodechangeinfo.hxx36
-rw-r--r--configmgr/source/inc/noderef.hxx443
-rw-r--r--configmgr/source/inc/nodevisitor.hxx144
-rw-r--r--configmgr/source/inc/options.hxx20
-rw-r--r--configmgr/source/inc/oslstream.hxx12
-rw-r--r--configmgr/source/inc/pointer.hxx29
-rw-r--r--configmgr/source/inc/request.hxx43
-rw-r--r--configmgr/source/inc/requestoptions.hxx24
-rw-r--r--configmgr/source/inc/requesttypes.hxx99
-rw-r--r--configmgr/source/inc/roottree.hxx47
-rw-r--r--configmgr/source/inc/rttimacros.hxx58
-rw-r--r--configmgr/source/inc/sequence.hxx29
-rw-r--r--configmgr/source/inc/serviceinfohelper.hxx30
-rw-r--r--configmgr/source/inc/setnodeaccess.hxx140
-rw-r--r--configmgr/source/inc/simpleinteractionrequest.hxx17
-rw-r--r--configmgr/source/inc/template.hxx40
-rw-r--r--configmgr/source/inc/tree.hxx666
-rw-r--r--configmgr/source/inc/treeaccessor.hxx88
-rw-r--r--configmgr/source/inc/treeactions.hxx7
-rw-r--r--configmgr/source/inc/treechangefactory.hxx29
-rw-r--r--configmgr/source/inc/treechangelist.hxx36
-rw-r--r--configmgr/source/inc/treefragment.hxx25
-rw-r--r--configmgr/source/inc/treemanager.hxx131
-rw-r--r--configmgr/source/inc/treenodefactory.hxx5
-rw-r--r--configmgr/source/inc/treeprovider.hxx187
-rw-r--r--configmgr/source/inc/treesegment.hxx105
-rw-r--r--configmgr/source/inc/typeconverter.hxx4
-rw-r--r--configmgr/source/inc/types.hxx81
-rw-r--r--configmgr/source/inc/updatehelper.hxx23
-rw-r--r--configmgr/source/inc/utility.hxx111
-rw-r--r--configmgr/source/inc/valuenode.hxx45
-rw-r--r--configmgr/source/inc/valuenodeaccess.hxx128
-rw-r--r--configmgr/source/inc/valueref.hxx42
-rw-r--r--configmgr/source/inc/valuetypeconverter.hxx39
-rw-r--r--configmgr/source/localbe/localdataimportsvc.cxx30
-rw-r--r--configmgr/source/localbe/localdataimportsvc.hxx17
-rw-r--r--configmgr/source/localbe/localfilehelper.cxx33
-rw-r--r--configmgr/source/localbe/localfilehelper.hxx2
-rw-r--r--configmgr/source/localbe/localfilelayer.cxx25
-rw-r--r--configmgr/source/localbe/localfilelayer.hxx12
-rw-r--r--configmgr/source/localbe/localhierarchybrowsersvc.cxx125
-rw-r--r--configmgr/source/localbe/localhierarchybrowsersvc.hxx21
-rw-r--r--configmgr/source/localbe/localmultistratum.cxx47
-rw-r--r--configmgr/source/localbe/localmultistratum.hxx6
-rw-r--r--configmgr/source/localbe/localschemasupplier.cxx12
-rw-r--r--configmgr/source/localbe/localschemasupplier.hxx6
-rw-r--r--configmgr/source/localbe/localsinglebackend.cxx38
-rw-r--r--configmgr/source/localbe/localsinglebackend.hxx8
-rw-r--r--configmgr/source/localbe/localsinglestratum.cxx18
-rw-r--r--configmgr/source/localbe/localsinglestratum.hxx6
-rw-r--r--configmgr/source/localbe/localstratumbase.cxx16
-rw-r--r--configmgr/source/localbe/localstratumbase.hxx7
-rw-r--r--configmgr/source/misc/anypair.cxx62
-rw-r--r--configmgr/source/misc/bootstrap.cxx98
-rw-r--r--configmgr/source/misc/bootstrapcontext.cxx59
-rw-r--r--configmgr/source/misc/configunoreg.cxx63
-rw-r--r--configmgr/source/misc/filehelper.cxx124
-rw-r--r--configmgr/source/misc/logger.cxx8
-rw-r--r--configmgr/source/misc/mergechange.cxx126
-rw-r--r--configmgr/source/misc/oslstream.cxx42
-rw-r--r--configmgr/source/misc/providerfactory.cxx32
-rw-r--r--configmgr/source/misc/providerfactory.hxx29
-rw-r--r--configmgr/source/misc/providerwrapper.cxx46
-rw-r--r--configmgr/source/misc/providerwrapper.hxx32
-rw-r--r--configmgr/source/misc/requestoptions.cxx8
-rw-r--r--configmgr/source/misc/serviceinfohelper.cxx44
-rw-r--r--configmgr/source/misc/simpleinteractionrequest.cxx12
-rw-r--r--configmgr/source/misc/tracer.cxx6
-rw-r--r--configmgr/source/platformbe/componentdefn.cxx13
-rw-r--r--configmgr/source/platformbe/systemintegrationmanager.cxx43
-rw-r--r--configmgr/source/platformbe/systemintegrationmanager.hxx31
-rw-r--r--configmgr/source/registry/cfgregistrykey.cxx679
-rw-r--r--configmgr/source/registry/cfgregistrykey.hxx5
-rw-r--r--configmgr/source/registry/configregistry.cxx109
-rw-r--r--configmgr/source/registry/configregistry.hxx6
-rw-r--r--configmgr/source/tree/builddata.cxx594
-rw-r--r--configmgr/source/tree/changes.cxx21
-rw-r--r--configmgr/source/tree/cmtree.cxx60
-rw-r--r--configmgr/source/tree/cmtreemodel.cxx46
-rw-r--r--configmgr/source/tree/localizedtreeactions.cxx92
-rw-r--r--configmgr/source/tree/makefile.mk2
-rw-r--r--configmgr/source/tree/mergehelper.cxx35
-rw-r--r--configmgr/source/tree/node.cxx271
-rw-r--r--configmgr/source/tree/nodeaccess.cxx185
-rw-r--r--configmgr/source/tree/nodeconverter.cxx10
-rw-r--r--configmgr/source/tree/nodevisitor.cxx232
-rw-r--r--configmgr/source/tree/subtree.hxx31
-rw-r--r--configmgr/source/tree/treechangefactory.cxx49
-rw-r--r--configmgr/source/tree/treefragment.cxx38
-rw-r--r--configmgr/source/tree/treesegment.cxx235
-rw-r--r--configmgr/source/tree/updatehelper.cxx410
-rw-r--r--configmgr/source/tree/valuenodeaccess.cxx174
-rw-r--r--configmgr/source/treecache/cacheaccess.cxx77
-rw-r--r--configmgr/source/treecache/cacheaccess.hxx52
-rw-r--r--configmgr/source/treecache/cachecontroller.cxx177
-rw-r--r--configmgr/source/treecache/cachecontroller.hxx158
-rw-r--r--configmgr/source/treecache/cachedata.cxx154
-rw-r--r--configmgr/source/treecache/cachedata.hxx70
-rw-r--r--configmgr/source/treecache/cachefactory.cxx13
-rw-r--r--configmgr/source/treecache/cacheline.cxx140
-rw-r--r--configmgr/source/treecache/cacheline.hxx63
-rw-r--r--configmgr/source/treecache/cachemulticaster.cxx60
-rw-r--r--configmgr/source/treecache/cachemulticaster.hxx42
-rw-r--r--configmgr/source/treecache/cachewritescheduler.cxx6
-rw-r--r--configmgr/source/treecache/cachewritescheduler.hxx5
-rw-r--r--configmgr/source/treecache/disposetimer.cxx33
-rw-r--r--configmgr/source/treecache/disposetimer.hxx10
-rw-r--r--configmgr/source/treecache/invalidatetree.cxx44
-rw-r--r--configmgr/source/treecache/treemanager.cxx285
-rw-r--r--configmgr/source/treemgr/collectchanges.cxx14
-rw-r--r--configmgr/source/treemgr/collectchanges.hxx20
-rw-r--r--configmgr/source/treemgr/configdefaultprovider.cxx28
-rw-r--r--configmgr/source/treemgr/configexcept.cxx36
-rw-r--r--configmgr/source/treemgr/configgroup.cxx94
-rw-r--r--configmgr/source/treemgr/configpath.cxx227
-rw-r--r--configmgr/source/treemgr/configset.cxx432
-rw-r--r--configmgr/source/treemgr/defaultproviderproxy.cxx8
-rw-r--r--configmgr/source/treemgr/defaultproviderproxy.hxx13
-rw-r--r--configmgr/source/treemgr/deferredview.cxx103
-rw-r--r--configmgr/source/treemgr/deferredview.hxx22
-rw-r--r--configmgr/source/treemgr/directview.cxx19
-rw-r--r--configmgr/source/treemgr/directview.hxx10
-rw-r--r--configmgr/source/treemgr/groupnodeimpl.hxx20
-rw-r--r--configmgr/source/treemgr/nodechange.cxx44
-rw-r--r--configmgr/source/treemgr/nodechangeimpl.cxx117
-rw-r--r--configmgr/source/treemgr/nodechangeimpl.hxx141
-rw-r--r--configmgr/source/treemgr/nodechangeinfo.cxx28
-rw-r--r--configmgr/source/treemgr/nodefactory.cxx88
-rw-r--r--configmgr/source/treemgr/nodefactory.hxx22
-rw-r--r--configmgr/source/treemgr/nodeimpl.cxx140
-rw-r--r--configmgr/source/treemgr/nodeimpl.hxx25
-rw-r--r--configmgr/source/treemgr/nodeimplobj.cxx382
-rw-r--r--configmgr/source/treemgr/nodeimplobj.hxx59
-rw-r--r--configmgr/source/treemgr/noderef.cxx1328
-rw-r--r--configmgr/source/treemgr/readonlyview.cxx8
-rw-r--r--configmgr/source/treemgr/readonlyview.hxx6
-rw-r--r--configmgr/source/treemgr/roottree.cxx49
-rw-r--r--configmgr/source/treemgr/roottreeimpl.hxx17
-rw-r--r--configmgr/source/treemgr/setnodeimpl.cxx368
-rw-r--r--configmgr/source/treemgr/setnodeimpl.hxx134
-rw-r--r--configmgr/source/treemgr/template.cxx16
-rw-r--r--configmgr/source/treemgr/templateimpl.cxx108
-rw-r--r--configmgr/source/treemgr/templateimpl.hxx59
-rw-r--r--configmgr/source/treemgr/treeimpl.cxx969
-rw-r--r--configmgr/source/treemgr/treeimpl.hxx577
-rw-r--r--configmgr/source/treemgr/valuemembernode.cxx100
-rw-r--r--configmgr/source/treemgr/valuemembernode.hxx29
-rw-r--r--configmgr/source/treemgr/valuenodeimpl.hxx18
-rw-r--r--configmgr/source/treemgr/viewaccess.cxx6
-rw-r--r--configmgr/source/treemgr/viewaccess.hxx109
-rw-r--r--configmgr/source/treemgr/viewfactory.hxx8
-rw-r--r--configmgr/source/treemgr/viewnode.cxx31
-rw-r--r--configmgr/source/treemgr/viewnode.hxx102
-rw-r--r--configmgr/source/treemgr/viewstrategy.cxx313
-rw-r--r--configmgr/source/treemgr/viewstrategy.hxx105
-rw-r--r--configmgr/source/xml/basicparser.cxx50
-rw-r--r--configmgr/source/xml/basicparser.hxx32
-rw-r--r--configmgr/source/xml/elementformatter.cxx86
-rw-r--r--configmgr/source/xml/elementformatter.hxx27
-rw-r--r--configmgr/source/xml/elementinfo.hxx10
-rw-r--r--configmgr/source/xml/elementparser.cxx76
-rw-r--r--configmgr/source/xml/elementparser.hxx38
-rw-r--r--configmgr/source/xml/layerparser.cxx10
-rw-r--r--configmgr/source/xml/layerparser.hxx11
-rw-r--r--configmgr/source/xml/layerwriter.cxx54
-rw-r--r--configmgr/source/xml/layerwriter.hxx25
-rw-r--r--configmgr/source/xml/matchlocale.cxx113
-rw-r--r--configmgr/source/xml/parsersvc.cxx72
-rw-r--r--configmgr/source/xml/parsersvc.hxx14
-rw-r--r--configmgr/source/xml/schemaparser.cxx22
-rw-r--r--configmgr/source/xml/schemaparser.hxx11
-rw-r--r--configmgr/source/xml/typeconverter.cxx4
-rw-r--r--configmgr/source/xml/valueconverter.cxx111
-rw-r--r--configmgr/source/xml/valueformatter.cxx65
-rw-r--r--configmgr/source/xml/valueformatter.hxx9
-rw-r--r--configmgr/source/xml/writersvc.cxx20
-rw-r--r--configmgr/source/xml/writersvc.hxx21
351 files changed, 11304 insertions, 17609 deletions
diff --git a/configmgr/prj/build.lst b/configmgr/prj/build.lst
index 1ef391627a..a3d93b598a 100644
--- a/configmgr/prj/build.lst
+++ b/configmgr/prj/build.lst
@@ -1,4 +1,4 @@
-cg configmgr : offapi comphelper cppuhelper tools vos NULL
+cg configmgr : BOOST:boost offapi comphelper cppuhelper salhelper tools vos NULL
cg configmgr usr1 - all cg_mkout NULL
cg configmgr\inc nmake - all cg_inc NULL
cg configmgr\source\misc nmake - all cg_misc cg_inc NULL
diff --git a/configmgr/qa/unit/makefile.mk b/configmgr/qa/unit/makefile.mk
index 856849dc68..4b57dabac7 100644
--- a/configmgr/qa/unit/makefile.mk
+++ b/configmgr/qa/unit/makefile.mk
@@ -55,9 +55,8 @@ ALLTAR: test
$(MISC)$/$(TARGET).rdb .ERRREMOVE:
$(COPY) $(SOLARBINDIR)$/types.rdb $@
regcomp -register -r $@ -c $(subst,$/,/ $(DLLDEST)$/configmgr2.uno$(DLLPOST))
- regcomp -register -r $@ -c $(subst,$/,/ $(SOLARLIBDIR)/typeconverter.uno$(DLLPOST))
regcomp -register -r $@ -c $(subst,$/,/ $(SOLARLIBDIR)/sax.uno$(DLLPOST))
- regcomp -register -r $@ -c $(subst,$/,/ $(SOLARLIBDIR)/simplereg.uno$(DLLPOST))
+ regcomp -register -r $@ -c $(subst,$/,/ $(SOLARLIBDIR)/stocservices.uno$(DLLPOST))
regcomp -register -r $@ -c $(subst,$/,/ $(SOLARLIBDIR)/streams.uno$(DLLPOST))
test .PHONY: $(SHL1TARGETN) $(MISC)$/$(TARGET).rdb
diff --git a/configmgr/qa/unit/performance.cxx b/configmgr/qa/unit/performance.cxx
index ee0db5055f..7a3e0475a4 100644
--- a/configmgr/qa/unit/performance.cxx
+++ b/configmgr/qa/unit/performance.cxx
@@ -33,8 +33,6 @@
#include "common.hxx"
-using namespace css;
-
void Test::setUp()
{
mpMagic = new Magic();
@@ -137,11 +135,11 @@ void Test::normalizePathKey (rtl::OString &rPath, rtl::OString &rKey)
}
}
-uno::Any Test::getKey (const sal_Char *pPath, rtl::OUString aName)
+css::uno::Any Test::getKey (const sal_Char *pPath, rtl::OUString aName)
{
- uno::Reference< container::XHierarchicalNameAccess > xNameAccess(
+ css::uno::Reference< css::container::XHierarchicalNameAccess > xNameAccess(
createView(pPath, false), css::uno::UNO_QUERY_THROW);
- uno::Any aVal;
+ css::uno::Any aVal;
aVal = xNameAccess->getByHierarchicalName (aName);
disposeComponent (xNameAccess);
return aVal;
@@ -149,11 +147,11 @@ uno::Any Test::getKey (const sal_Char *pPath, rtl::OUString aName)
void Test::setKey (const sal_Char *pPath, rtl::OUString aName, css::uno::Any a)
{
- uno::Reference< util::XChangesBatch > xAppView;
+ css::uno::Reference< css::util::XChangesBatch > xAppView;
- xAppView = uno::Reference< util::XChangesBatch > (
- createView(pPath, true), uno::UNO_QUERY_THROW );
- uno::Reference< container::XNameReplace > xSettings(xAppView, uno::UNO_QUERY_THROW);
+ xAppView = css::uno::Reference< css::util::XChangesBatch > (
+ createView(pPath, true), css::uno::UNO_QUERY_THROW );
+ css::uno::Reference< css::container::XNameReplace > xSettings(xAppView, css::uno::UNO_QUERY_THROW);
rtl::OUString aStr;
// set key
@@ -165,13 +163,13 @@ void Test::setKey (const sal_Char *pPath, rtl::OUString aName, css::uno::Any a)
void Test::resetKey (const sal_Char *pPath, rtl::OUString aName)
{
- uno::Reference< util::XChangesBatch > xAppView;
+ css::uno::Reference< css::util::XChangesBatch > xAppView;
// reset to default
- xAppView = uno::Reference< util::XChangesBatch > ( createView(pPath, true), uno::UNO_QUERY_THROW );
- uno::Reference< container::XNameReplace > xSettings(xAppView, uno::UNO_QUERY_THROW);
+ xAppView = css::uno::Reference< css::util::XChangesBatch > ( createView(pPath, true), css::uno::UNO_QUERY_THROW );
+ css::uno::Reference< css::container::XNameReplace > xSettings(xAppView, css::uno::UNO_QUERY_THROW);
- uno::Reference< beans::XPropertyState > xSettingsState(xSettings, uno::UNO_QUERY);
+ css::uno::Reference< css::beans::XPropertyState > xSettingsState(xSettings, css::uno::UNO_QUERY);
xSettingsState->setPropertyToDefault(aName);
xAppView->commitChanges();
@@ -194,7 +192,7 @@ void Test::keySet()
try {
setKey ("/org.openoffice.Setup/Test",
rtl::OUString::createFromAscii("AString"),
- uno::makeAny (rtl::OUString::createFromAscii("baa")));
+ css::uno::makeAny (rtl::OUString::createFromAscii("baa")));
// check value
rtl::OUString aStr;
@@ -229,14 +227,14 @@ void Test::readCommands()
rtl::OUString aPropProperties( RTL_CONSTASCII_USTRINGPARAM( "Properties" ));
try {
- uno::Reference< container::XNameAccess > xNameAccess (
+ css::uno::Reference< css::container::XNameAccess > xNameAccess (
createView("/org.openoffice.UI.GenericCommands/UserInterface/Commands", false),
css::uno::UNO_QUERY_THROW);
CPPUNIT_ASSERT_MESSAGE ("fetched UI generic commands", xNameAccess.is());
- uno::Any a;
- uno::Sequence< rtl::OUString > aNameSeq = xNameAccess->getElementNames();
+ css::uno::Any a;
+ css::uno::Sequence< rtl::OUString > aNameSeq = xNameAccess->getElementNames();
CPPUNIT_ASSERT_MESSAGE ("right element / sequence", aNameSeq.getLength() == 696);
sal_uInt32 end, start = osl_getGlobalTimer();
@@ -247,7 +245,7 @@ void Test::readCommands()
try
{
{
- uno::Reference< container::XNameAccess > xChildNameAccess;
+ css::uno::Reference< css::container::XNameAccess > xChildNameAccess;
// This is the slow bit ! ...
// Creating the @#$@#$ing XNameAccess object [ 650 times ]
// which we then use to 'getByName' etc.
diff --git a/configmgr/qa/unit/threading.cxx b/configmgr/qa/unit/threading.cxx
index 44eca185f7..b04f7c3550 100644
--- a/configmgr/qa/unit/threading.cxx
+++ b/configmgr/qa/unit/threading.cxx
@@ -169,9 +169,7 @@ void Test::threadTests()
} CATCH_FAIL ("checking keys exist")
}
-typedef ::cppu::WeakImplHelper1< css::beans::XPropertyChangeListener > ListenerBase;
-
-class RecursiveListener : public ListenerBase
+class RecursiveListener : public cppu::WeakImplHelper1< css::beans::XPropertyChangeListener >
{
public:
sal_Int32 m_nRecurse;
@@ -183,8 +181,7 @@ public:
public:
RecursiveListener (Test *pTest, int nCount,
const char *pPath, const char *pKey)
- : ListenerBase()
- , m_nRecurse (nCount)
+ : m_nRecurse (nCount)
, m_pTest (pTest)
, m_pPath (pPath)
, m_pKey (pKey)
@@ -201,8 +198,8 @@ public:
disposeComponent (mxPropSet);
}
- virtual void SAL_CALL acquire() throw() { ListenerBase::acquire(); }
- virtual void SAL_CALL release() throw() { ListenerBase::acquire(); }
+ virtual void SAL_CALL acquire() throw() { cppu::WeakImplHelper1< css::beans::XPropertyChangeListener >::acquire(); }
+ virtual void SAL_CALL release() throw() { cppu::WeakImplHelper1< css::beans::XPropertyChangeListener >::acquire(); }
// XPropertyChangeListener
virtual void SAL_CALL propertyChange( const ::css::beans::PropertyChangeEvent& ) throw (::css::uno::RuntimeException)
{
diff --git a/configmgr/source/api/confeventhelpers.cxx b/configmgr/source/api/confeventhelpers.cxx
deleted file mode 100644
index 1d9811f996..0000000000
--- a/configmgr/source/api/confeventhelpers.cxx
+++ /dev/null
@@ -1,362 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: confeventhelpers.cxx,v $
- * $Revision: 1.17 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General 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_configmgr.hxx"
-
-#include <stdio.h>
-#include <string.h>
-#include "confeventhelpers.hxx"
-#include "configexcept.hxx"
-#include "change.hxx"
-#include "treechangelist.hxx"
-#include <osl/diagnose.h>
-
-#ifndef INCLUDED_ALGORITHM
-#include <algorithm>
-#define INCLUDED_ALGORITHM
-#endif
-
-namespace configmgr
-{
- namespace internal
- {
-
-////////////////////////////////////////////////////////////////////////
- using namespace configuration;
- namespace Path = configuration::Path;
-
-/////////////////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////////////////
-ConfigChangesBroadcasterImpl::ConfigChangesBroadcasterImpl()
-{
-}
-
-/////////////////////////////////////////////////////////////////////////
-ConfigChangesBroadcasterImpl::~ConfigChangesBroadcasterImpl()
-{
- OSL_ENSURE(m_aListeners.begin() == m_aListeners.end(), "Remaining listeners found - forgot to dispose ?");
- OSL_ENSURE(m_aPathMap.empty(), "Spurious mappings found");
-}
-
-/////////////////////////////////////////////////////////////////////////
-void ConfigChangesBroadcasterImpl::add(AbsolutePath const& aName, INodeListenerRef const& pListener)
-{
- osl::MutexGuard aGuard(m_aListeners.mutex);
-
- InfoRef aAdded = m_aListeners.addListener(NodeListenerInfo(pListener));
- aAdded->addPath(aName);
- m_aPathMap.insert(PathMap::value_type(aName,aAdded));
-}
-
-/////////////////////////////////////////////////////////////////////////
-void ConfigChangesBroadcasterImpl::remove(INodeListenerRef const& pListener)
-{
- osl::MutexGuard aGuard(m_aListeners.mutex);
-
- Listeners::Iterator const iter = m_aListeners.find(pListener);
- if (iter != m_aListeners.end())
- {
- typedef NodeListenerInfo::Pathes Pathes;
- Pathes const& pathes = iter->pathList();
-
- // first clear the Path Map
- for(Pathes::iterator itPath = pathes.begin(); itPath != pathes.end(); ++itPath)
- {
- typedef PathMap::iterator PMIter;
- typedef std::pair<PMIter, PMIter> PMRange;
-
- PMRange aRange = m_aPathMap.equal_range(*itPath);
- while (aRange.first != aRange.second)
- {
- PMIter cur = aRange.first++;
- if (cur->second == iter)
- m_aPathMap.erase(cur);
- }
- }
-
- // the remove the broadcast helper entry
- m_aListeners.removeListener(pListener);
- }
-}
-
-/////////////////////////////////////////////////////////////////////////
-// This should actually be available from the TreeChangeList
-/////////////////////////////////////////////////////////////////////////
-
-static Change const* resolvePath(Change const& rChange, RelativePath& aRelativePath, RemoveNode const*& pRemoveNode)
-{
- RelativePath::Iterator aIter;
-
- OSL_ASSERT(pRemoveNode == NULL);
- pRemoveNode = NULL;
-
- Change const* pChange = &rChange;
- if (rChange.ISA(RemoveNode))
- pRemoveNode = static_cast<RemoveNode const*>(pChange);
-
- RelativePath::Iterator const aEnd(aRelativePath.end());
-
- for( aIter = aRelativePath.begin();
- aIter != aEnd;
- ++aIter)
- {
- OSL_ASSERT( pChange != NULL );
-
- pChange = pChange->getSubChange(aIter->getName().toString());
-
- if (pChange == NULL) break;
-
- OSL_ASSERT(pRemoveNode == NULL);
- OSL_ASSERT(aIter->getName().toString() == pChange->getNodeName());
-
- if (pChange->ISA(RemoveNode))
- pRemoveNode = static_cast<RemoveNode const*>(pChange);
- }
-
- if (pRemoveNode)
- {
- aRelativePath = RelativePath( Path::Rep(aRelativePath.begin(),aIter) );
- OSL_ASSERT( aRelativePath.getLocalName().getName().toString() == pRemoveNode->getNodeName());
- }
- else
- OSL_ASSERT( pChange == 0 || configuration::matches(aRelativePath, RelativePath( Path::Rep(aRelativePath.begin(),aIter) )) );
-
- return pChange;
-}
-
-/////////////////////////////////////////////////////////////////////////
-void ConfigChangesBroadcasterImpl::dispatchInner
-(
- INodeListenerRef const& pTarget,
- AbsolutePath const& _aTargetPath,
- Change const& rBaseChange,
- AbsolutePath const& _aChangeLocation,
- sal_Bool , //_bError,
- IConfigBroadcaster* pSource
-)
-{
- using namespace configuration;
- try
- {
- OSL_ASSERT(pTarget.is());
- OSL_ASSERT( Path::hasPrefix( _aTargetPath, _aChangeLocation ) );
-
- RelativePath aLocalPath = Path::stripPrefix( _aTargetPath, _aChangeLocation );
-
- RemoveNode const* pRemoved = 0;
- Change const* pTargetChange = resolvePath(rBaseChange, aLocalPath, pRemoved );
-
- OSL_ASSERT( !pTargetChange || matches(_aChangeLocation.compose(aLocalPath),_aTargetPath) );
-
- if (pRemoved)
- pTarget->nodeDeleted(_aChangeLocation.compose(aLocalPath), pSource);
-
- else if (pTargetChange)
- pTarget->nodeChanged(*pTargetChange, _aTargetPath, pSource);
-
- }
- catch (InvalidName& )
- {
- OSL_ENSURE(false,"ConfigChangesBroadcasterImpl: Could not dispatch notification: context path mismatch");
- }
-}
-
-/////////////////////////////////////////////////////////////////////////
-void ConfigChangesBroadcasterImpl::dispatchOuter
-(
- INodeListenerRef const& pTarget,
- AbsolutePath const& _aTargetPath,
- Change const& rBaseChange,
- AbsolutePath const& _aChangeLocation,
- sal_Bool , //_bError,
- IConfigBroadcaster* pSource
-)
-{
- { (void)_aTargetPath; }
- OSL_ASSERT(pTarget.is());
- OSL_ASSERT( Path::hasPrefix( _aChangeLocation, _aTargetPath) );
-
- pTarget->nodeChanged(rBaseChange, _aChangeLocation, pSource);
-}
-
-/////////////////////////////////////////////////////////////////////////
-void ConfigChangesBroadcasterImpl::dispatch(TreeChangeList const& rList_, sal_Bool _bError, IConfigBroadcaster* pSource)
-{
- dispatch(rList_.root, rList_.getRootNodePath(),_bError, pSource);
-}
-/////////////////////////////////////////////////////////////////////////
-namespace
-{
- struct DispatchTarget
- {
- DispatchTarget(INodeListenerRef _pTarget, AbsolutePath const* _pDispatchPath)
- : pTarget(_pTarget), pDispatchPath( _pDispatchPath) {}
-
- INodeListenerRef pTarget;
- AbsolutePath const* pDispatchPath;
- };
- typedef std::vector<DispatchTarget> DispatchTargets;
-}
-/////////////////////////////////////////////////////////////////////////
-void ConfigChangesBroadcasterImpl::dispatch
-(
- Change const& rBaseChange,
- AbsolutePath const& _aChangeLocation,
- sal_Bool _bError,
- IConfigBroadcaster* pSource
-)
-{
- OSL_ENSURE(!_aChangeLocation.isRoot(),"Cannot dispatch changes directly to the root node");
-
- // listeners registered under multiple sub-pathes will be called multiple times !
-
- // Collect the targets
- osl::ClearableMutexGuard aGuard(m_aListeners.mutex);
-
- // Dispatch listeners to ancestors of the change root
- DispatchTargets aOuterTargets;
- if (_aChangeLocation.getDepth() > 1)
- {
- AbsolutePath const aModulePath( Path::Rep(*_aChangeLocation.begin()) );
-
- PathMap::const_iterator itOuter = m_aPathMap.lower_bound( aModulePath );
- PathMap::const_iterator const endOuter = m_aPathMap.upper_bound(_aChangeLocation.getParentPath());
-
- // TODO: Both loops are so similar - they should be a single function
- while (itOuter != endOuter)
- {
- OSL_ASSERT( m_aListeners.find(itOuter->second->get()) != m_aListeners.end() );
-
- // check whether this should be dispatched at all
- if ( Path::hasPrefix(_aChangeLocation,itOuter->first) )
- {
- aOuterTargets.push_back( DispatchTarget(itOuter->second->get(), &itOuter->first) );
- }
- ++itOuter;
- }
- }
-
- // Dispatch listeners to descendants of the change root
- DispatchTargets aInnerTargets;
- {
- PathMap::const_iterator itInner = m_aPathMap.lower_bound(_aChangeLocation);
-
- while( itInner != m_aPathMap.end() && Path::hasPrefix(itInner->first,_aChangeLocation) )
- {
- OSL_ASSERT( m_aListeners.find(itInner->second->get()) != m_aListeners.end() );
-
- aInnerTargets.push_back( DispatchTarget(itInner->second->get(), &itInner->first) );
-
- ++itInner;
- }
- }
-
- aGuard.clear();
-
- {for (DispatchTargets::const_iterator it = aOuterTargets.begin(); it != aOuterTargets.end(); ++it){
- this->dispatchOuter(it->pTarget, *it->pDispatchPath, rBaseChange, _aChangeLocation, _bError, pSource);
- }}
- {for (DispatchTargets::const_iterator it = aInnerTargets.begin(); it != aInnerTargets.end(); ++it){
- this->dispatchInner(it->pTarget, *it->pDispatchPath, rBaseChange, _aChangeLocation, _bError, pSource);
- }}
-}
-
-/////////////////////////////////////////////////////////////////////////
-void ConfigChangesBroadcasterImpl::disposing(IConfigBroadcaster* pSource)
-{
- osl::ClearableMutexGuard aGuard(m_aListeners.mutex);
- m_aPathMap.clear();
-
- aGuard.clear();
- m_aListeners.disposing(pSource);
-}
-
-/////////////////////////////////////////////////////////////////////////
-/* class ConfigMessageBroadcasterImpl
- {
- public:
- private:
- typedef BroadcastImplHelper<INodeListener*> Listeners;
- Listeners m_aListeners;
- };
-*/
-/////////////////////////////////////////////////////////////////////////
-/*void ConfigMessageBroadcasterImpl::add(IMessageHandler* pListener)
-{
- osl::MutexGuard aGuard(m_aListeners.mutex);
-
- m_aListeners.addListener(pListener);
-}
-
-/////////////////////////////////////////////////////////////////////////
-void ConfigMessageBroadcasterImpl::remove(IMessageHandler* pListener)
-{
- osl::MutexGuard aGuard(m_aListeners.mutex);
-
- m_aListeners.removeListener(pListener);
-}
-
-/////////////////////////////////////////////////////////////////////////
-void ConfigMessageBroadcasterImpl::dispatch(OUString const& _rNotifyReason, sal_Int32 _nNotificationId, IConfigBroadcaster* pSource)
-{
- osl::MutexGuard aGuard(m_aListeners.mutex);
-
- for (Listeners::Iterator it = m_aListeners.begin(); it != m_aListeners.end(); )
- {
- // incrementing here allows a listener to remove itself from within the callback
-
- // it is illegal to cause removal of another listener from the callback
- // if this occurs (dereferencing, incrementing or comparing 'it' fails)
- // we need to explicitly guard against that (which is really too expensive)
-
- IMessageHandler* pHandler = *it;
- ++it;
-
- if (pHandler)
- pHandler->message(_rNotifyReason,_nNotificationId,pSource);
- }
-
-}
-
-/////////////////////////////////////////////////////////////////////////
-void ConfigMessageBroadcasterImpl::disposing(IConfigBroadcaster* pSource)
-{
- osl::MutexGuard aGuard(m_aListeners.mutex);
-
- m_aListeners.disposing(pSource);
-}
-*/
-/////////////////////////////////////////////////////////////////////////
- } // namespace
-} // namespace
-
-
-
diff --git a/configmgr/source/api/confeventhelpers.hxx b/configmgr/source/api/confeventhelpers.hxx
deleted file mode 100644
index 319531e06b..0000000000
--- a/configmgr/source/api/confeventhelpers.hxx
+++ /dev/null
@@ -1,204 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: confeventhelpers.hxx,v $
- * $Revision: 1.12 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef CONFIGMGR_API_EVENTHELPERS_HXX_
-#define CONFIGMGR_API_EVENTHELPERS_HXX_
-
-#include "confevents.hxx"
-#include "configpath.hxx"
-#include <com/sun/star/uno/RuntimeException.hpp>
-#include <osl/diagnose.h>
-#include <osl/mutex.hxx>
-
-#ifndef INCLUDED_MAP
-#include <map>
-#define INCLUDED_MAP
-#endif
-#ifndef INCLUDED_FUNCTIONAL
-#include <functional>
-#define INCLUDED_FUNCTIONAL
-#endif
-#include <hash_set>
-#ifndef INCLUDED_SET
-#include <set>
-#define INCLUDED_SET
-#endif
-
-namespace configmgr
-{
- namespace internal
- {
-
- using namespace configuration;
- ////////////////////////////////////////////////////////////////////////
- template <class ListenerRef>
- class BroadcastImplHelper
- {
- public:
- osl::Mutex mutex;
-
- public:
- BroadcastImplHelper()
- {}
-
- ~BroadcastImplHelper()
- {
- OSL_ENSURE(m_aInterfaces.empty(), "Configuration Broadcaster was not disposed properly");
- }
-
- public:
- typedef std::set<ListenerRef> Interfaces;
- typedef typename Interfaces::iterator FullIterator;
- typedef typename Interfaces::const_iterator Iterator;
-
- public:
- FullIterator addListener(ListenerRef aListener)
- {
- return m_aInterfaces.insert(aListener).first;
- }
- void removeListener(ListenerRef aListener)
- {
- m_aInterfaces.erase(aListener);
- }
-
- void disposing(IConfigBroadcaster* pSource);
-
- public:
- Iterator begin() const { return m_aInterfaces.begin(); }
- Iterator end() const { return m_aInterfaces.end(); }
-
- Iterator find(ListenerRef aListener) const { return m_aInterfaces.find(aListener); }
- FullIterator findFull(ListenerRef aListener) { return m_aInterfaces.find(aListener); }
- private:
- Interfaces m_aInterfaces;
-
- // no implementation - not copyable
- BroadcastImplHelper(BroadcastImplHelper&);
- void operator=(BroadcastImplHelper&);
- };
-
- ////////////////////////////////////////////////////////////////////////
- template <class Listener>
- void BroadcastImplHelper<Listener>::disposing(IConfigBroadcaster* pSource)
- {
- osl::ClearableMutexGuard aGuard(this->mutex); // ensure that no notifications are running
-
- Interfaces aTargets;
- aTargets.swap(m_aInterfaces);
-
- aGuard.clear();
- for(FullIterator it = aTargets.begin(); it != aTargets.end(); )
- {
- FullIterator cur = it++;
- if (*cur)
- (*cur)->disposing(pSource);
- }
- }
-
-
- /////////////////////////////////////////////////////////////////////////
-
- class NodeListenerInfo
- {
- public:
- typedef std::hash_set<AbsolutePath, Path::Hash, Path::Equiv> Pathes;
-
- public:
- NodeListenerInfo(INodeListenerRef const& pListener)
- : m_pListener(pListener)
- {
- }
-
- // path handling
- Pathes const& pathList() const { return m_aPathes; }
-
- void addPath(AbsolutePath const& sPath) const { m_aPathes.insert(sPath); }
- void removePath(AbsolutePath const& sPath) const { m_aPathes.erase(sPath); }
- //void removeChildPathes(OUString const& sPath);
-
- // behave as pointer for use as a 'reference' class
- INodeListenerRef get() const { return m_pListener; }
- INodeListenerRef operator->() const { return get(); }
- INodeListener& operator*() const { return *m_pListener; }
- // needed to allow if (info) ...
- struct HasListener;
- operator HasListener const*() const { return reinterpret_cast<HasListener*>(m_pListener.get()); }
-
- bool operator < (NodeListenerInfo const& aInfo) const
- { return std::less<INodeListener*>()(m_pListener.get(), aInfo.m_pListener.get()); }
-
- bool operator == (NodeListenerInfo const& aInfo) const
- { return !!( m_pListener == aInfo.m_pListener); }
-
- bool operator > (NodeListenerInfo const& aInfo) const
- { return aInfo.operator < (*this); }
- bool operator >= (NodeListenerInfo const& aInfo) const
- { return !operator<(aInfo); }
- bool operator <= (NodeListenerInfo const& aInfo) const
- { return !operator>(aInfo); }
-
- bool operator != (NodeListenerInfo const& aInfo) const
- { return !operator==(aInfo); }
-
- private:
- INodeListenerRef m_pListener;
- mutable Pathes m_aPathes; // hack to be mutable even as set element
- };
- class ConfigChangesBroadcasterImpl
- {
- public:
- ConfigChangesBroadcasterImpl();
- ~ConfigChangesBroadcasterImpl();
-
- void add(AbsolutePath const& aPath, INodeListenerRef const& pListener);
- void remove(INodeListenerRef const& pListener);
-
-// void removed(OUString const& aPath, bool bRemovedFromModel, IConfigBroadcaster* pSource);
-
- void dispatch(Change const& rBaseChange, AbsolutePath const& sChangeLocation, sal_Bool _bError, IConfigBroadcaster* pSource);
- void dispatch(TreeChangeList const& rList_, sal_Bool _bError, IConfigBroadcaster* pSource);
- void disposing(IConfigBroadcaster* pSource);
- private:
- typedef BroadcastImplHelper<NodeListenerInfo> Listeners;
- typedef Listeners::FullIterator InfoRef;
- typedef std::multimap<AbsolutePath, InfoRef, Path::Before> PathMap;
- Listeners m_aListeners;
- PathMap m_aPathMap;
- private:
- void dispatchInner(INodeListenerRef const& pTarget, AbsolutePath const& sTargetPath, Change const& rBaseChange, AbsolutePath const& sChangeLocation, sal_Bool _bError, IConfigBroadcaster* pSource);
- void dispatchOuter(INodeListenerRef const& pTarget, AbsolutePath const& sTargetPath, Change const& rBaseChange, AbsolutePath const& sChangeLocation, sal_Bool _bError, IConfigBroadcaster* pSource);
- };
-
- /////////////////////////////////////////////////////////////////////////
- } // namespace
-} // namespace
-
-#endif // CONFIGMGR_API_EVENTHELPERS_HXX_
-
-
diff --git a/configmgr/source/api/confevents.cxx b/configmgr/source/api/confevents.cxx
index a1e4e59537..b99cd9b1f7 100644
--- a/configmgr/source/api/confevents.cxx
+++ b/configmgr/source/api/confevents.cxx
@@ -34,123 +34,270 @@
#include <stdio.h>
#include <string.h>
#include "confevents.hxx"
-#include "confeventhelpers.hxx"
+#include "configexcept.hxx"
#include "treechangelist.hxx"
#include <osl/diagnose.h>
namespace configmgr
{
/////////////////////////////////////////////////////////////////////////
- using internal::ConfigChangesBroadcasterImpl;
-
- /////////////////////////////////////////////////////////////////////////
- class ConfigChangeBroadcastHelper // broadcasts changes for a given set of options
- {
- ConfigChangesBroadcasterImpl m_changes;
- public:
- ConfigChangeBroadcastHelper();
- ~ConfigChangeBroadcastHelper();
-
- void broadcast(TreeChangeList const& anUpdate, sal_Bool bError, IConfigBroadcaster* pSource);
-
- public:
- // IConfigBroadcaster implementation helper
- void addListener(AbsolutePath const& aName, INodeListenerRef const& );
- void removeListener(INodeListenerRef const&);
-
- void dispose(IConfigBroadcaster* pSource);
- };
-
- /////////////////////////////////////////////////////////////////////////
- ConfigChangeBroadcaster::ConfigChangeBroadcaster()
- {
- }
-
- ConfigChangeBroadcaster::~ConfigChangeBroadcaster()
- {
- }
-
- /////////////////////////////////////////////////////////////////////////
ConfigChangeBroadcastHelper::ConfigChangeBroadcastHelper()
- : m_changes()
{
}
ConfigChangeBroadcastHelper::~ConfigChangeBroadcastHelper()
{
+ OSL_ENSURE(m_aListeners.begin() == m_aListeners.end(), "Remaining listeners found - forgot to dispose ?");
+ OSL_ENSURE(m_aPathMap.empty(), "Spurious mappings found");
}
/////////////////////////////////////////////////////////////////////////
- void ConfigChangeBroadcastHelper::dispose(IConfigBroadcaster* pSource)
+ void ConfigChangeBroadcastHelper::dispose(TreeManager * pSource)
{
- m_changes.disposing(pSource);
+ disposing(pSource);
}
/////////////////////////////////////////////////////////////////////////
- // IConfigBroadcaster implementation
- void ConfigChangeBroadcaster::addListener(AbsolutePath const& aName, RequestOptions const & _aOptions, INodeListenerRef const& pHandler)
+ void ConfigChangeBroadcastHelper::addListener(configuration::AbsolutePath const& aName, rtl::Reference<INodeListener> const& pHandler)
{
- if (ConfigChangeBroadcastHelper* pHelper = getBroadcastHelper(_aOptions,true))
- {
- pHelper->addListener(aName, pHandler);
- }
- else
- OSL_ASSERT(false);
+ add(aName, pHandler);
}
- void ConfigChangeBroadcaster::removeListener(RequestOptions const & _aOptions, INodeListenerRef const& pHandler)
+ void ConfigChangeBroadcastHelper::removeListener(rtl::Reference<INodeListener> const& pHandler)
{
- if (ConfigChangeBroadcastHelper* pHelper = getBroadcastHelper(_aOptions,false))
- {
- pHelper->removeListener( pHandler);
- }
+ remove(pHandler);
}
/////////////////////////////////////////////////////////////////////////
- void ConfigChangeBroadcaster::fireChanges(TreeChangeList const& rList_, sal_Bool bError_)
+ void ConfigChangeBroadcastHelper::broadcast(TreeChangeList const& anUpdate, sal_Bool bError, TreeManager * pSource)
+ {
+ dispatch(anUpdate, bError, pSource);
+ }
+
+/////////////////////////////////////////////////////////////////////////
+void ConfigChangeBroadcastHelper::add(configuration::AbsolutePath const& aName, rtl::Reference<INodeListener> const& pListener)
+{
+ osl::MutexGuard aGuard(m_aListeners.mutex);
+
+ internal::BroadcastImplHelper<internal::NodeListenerInfo>::Interfaces::iterator aAdded = m_aListeners.addListener(internal::NodeListenerInfo(pListener));
+ aAdded->addPath(aName);
+ m_aPathMap.insert(PathMap::value_type(aName,aAdded));
+}
+
+/////////////////////////////////////////////////////////////////////////
+void ConfigChangeBroadcastHelper::remove(rtl::Reference<INodeListener> const& pListener)
+{
+ osl::MutexGuard aGuard(m_aListeners.mutex);
+
+ internal::BroadcastImplHelper<internal::NodeListenerInfo>::Interfaces::const_iterator const iter = m_aListeners.find(pListener);
+ if (iter != m_aListeners.end())
{
- if (ConfigChangeBroadcastHelper* pHelper = getBroadcastHelper(rList_.getOptions(),false))
+ internal::NodeListenerInfo::Pathes const& pathes = iter->pathList();
+
+ // first clear the Path Map
+ for(internal::NodeListenerInfo::Pathes::iterator itPath = pathes.begin(); itPath != pathes.end(); ++itPath)
{
- pHelper->broadcast(rList_, bError_, this);
+ std::pair<PathMap::iterator, PathMap::iterator> aRange = m_aPathMap.equal_range(*itPath);
+ while (aRange.first != aRange.second)
+ {
+ PathMap::iterator cur = aRange.first++;
+ if (cur->second == iter)
+ m_aPathMap.erase(cur);
+ }
}
+
+ // the remove the broadcast helper entry
+ m_aListeners.removeListener(pListener);
}
+}
- /////////////////////////////////////////////////////////////////////////
- ConfigChangeBroadcastHelper* ConfigChangeBroadcaster::newBroadcastHelper()
+/////////////////////////////////////////////////////////////////////////
+// This should actually be available from the TreeChangeList
+/////////////////////////////////////////////////////////////////////////
+
+static Change const* resolvePath(Change const& rChange, configuration::RelativePath& aRelativePath, RemoveNode const*& pRemoveNode)
+{
+ std::vector<configuration::Path::Component>::const_reverse_iterator aIter;
+
+ OSL_ASSERT(pRemoveNode == NULL);
+ pRemoveNode = NULL;
+
+ Change const* pChange = &rChange;
+ pRemoveNode = dynamic_cast<RemoveNode const*>(pChange);
+
+ std::vector<configuration::Path::Component>::const_reverse_iterator const aEnd(aRelativePath.end());
+
+ for( aIter = aRelativePath.begin();
+ aIter != aEnd;
+ ++aIter)
{
- return new ConfigChangeBroadcastHelper();
+ OSL_ASSERT( pChange != NULL );
+
+ pChange = pChange->getSubChange(aIter->getName());
+
+ if (pChange == NULL) break;
+
+ OSL_ASSERT(pRemoveNode == NULL);
+ OSL_ASSERT(aIter->getName() == pChange->getNodeName());
+
+ pRemoveNode = dynamic_cast<RemoveNode const*>(pChange);
}
- /////////////////////////////////////////////////////////////////////////
- void ConfigChangeBroadcaster::disposeBroadcastHelper(ConfigChangeBroadcastHelper* pHelper)
+
+ if (pRemoveNode)
{
- if (pHelper)
- {
- pHelper->dispose(this);
- delete pHelper;
- }
- }
- /////////////////////////////////////////////////////////////////////////
- // IConfigBroadcaster implementation help
- void ConfigChangeBroadcastHelper::addListener(AbsolutePath const& aName, INodeListenerRef const& pHandler)
- {
- m_changes.add(aName, pHandler);
+ aRelativePath = configuration::RelativePath( configuration::Path::Rep(aRelativePath.begin(),aIter) );
+ OSL_ASSERT( aRelativePath.getLocalName().getName() == pRemoveNode->getNodeName());
}
+ else
+ OSL_ASSERT( pChange == 0 || configuration::matches(aRelativePath, configuration::RelativePath( configuration::Path::Rep(aRelativePath.begin(),aIter) )) );
+
+ return pChange;
+}
+
+/////////////////////////////////////////////////////////////////////////
+void ConfigChangeBroadcastHelper::dispatchInner
+(
+ rtl::Reference<INodeListener> const& pTarget,
+ configuration::AbsolutePath const& _aTargetPath,
+ Change const& rBaseChange,
+ configuration::AbsolutePath const& _aChangeLocation,
+ sal_Bool , //_bError,
+ TreeManager * pSource
+)
+{
+ try
+ {
+ OSL_ASSERT(pTarget.is());
+ OSL_ASSERT( configuration::Path::hasPrefix( _aTargetPath, _aChangeLocation ) );
+
+ configuration::RelativePath aLocalPath = configuration::Path::stripPrefix( _aTargetPath, _aChangeLocation );
+
+ RemoveNode const* pRemoved = 0;
+ Change const* pTargetChange = resolvePath(rBaseChange, aLocalPath, pRemoved );
+
+ OSL_ASSERT( !pTargetChange || matches(_aChangeLocation.compose(aLocalPath),_aTargetPath) );
+
+ if (pRemoved)
+ pTarget->nodeDeleted(_aChangeLocation.compose(aLocalPath), pSource);
+
+ else if (pTargetChange)
+ pTarget->nodeChanged(*pTargetChange, _aTargetPath, pSource);
- void ConfigChangeBroadcastHelper::removeListener(INodeListenerRef const& pHandler)
- {
- m_changes.remove(pHandler);
}
+ catch (configuration::InvalidName& )
+ {
+ OSL_ENSURE(false,"ConfigChangeBroadcastHelper: Could not dispatch notification: context path mismatch");
+ }
+}
-/* void ConfigChangeBroadcastHelper::removeNode(OUString const& aPath, bool bRemovedFromModel, IConfigBroadcaster* pSource)
- {
- m_changes.removed(aPath, bRemovedFromModel,pSource);
+/////////////////////////////////////////////////////////////////////////
+void ConfigChangeBroadcastHelper::dispatchOuter
+(
+ rtl::Reference<INodeListener> const& pTarget,
+ configuration::AbsolutePath const& _aTargetPath,
+ Change const& rBaseChange,
+ configuration::AbsolutePath const& _aChangeLocation,
+ sal_Bool , //_bError,
+ TreeManager * pSource
+)
+{
+ { (void)_aTargetPath; }
+ OSL_ASSERT(pTarget.is());
+ OSL_ASSERT( configuration::Path::hasPrefix( _aChangeLocation, _aTargetPath) );
+
+ pTarget->nodeChanged(rBaseChange, _aChangeLocation, pSource);
+}
+
+/////////////////////////////////////////////////////////////////////////
+void ConfigChangeBroadcastHelper::dispatch(TreeChangeList const& rList_, sal_Bool _bError, TreeManager * pSource)
+{
+ dispatch(rList_.root, rList_.getRootNodePath(),_bError, pSource);
+}
+
+/////////////////////////////////////////////////////////////////////////
+namespace
+{
+ struct DispatchTarget
+ {
+ DispatchTarget(rtl::Reference<INodeListener> _pTarget, configuration::AbsolutePath const* _pDispatchPath)
+ : pTarget(_pTarget), pDispatchPath( _pDispatchPath) {}
+
+ rtl::Reference<INodeListener> pTarget;
+ configuration::AbsolutePath const* pDispatchPath;
+ };
+}
+/////////////////////////////////////////////////////////////////////////
+void ConfigChangeBroadcastHelper::dispatch
+(
+ Change const& rBaseChange,
+ configuration::AbsolutePath const& _aChangeLocation,
+ sal_Bool _bError,
+ TreeManager * pSource
+)
+{
+ OSL_ENSURE(!_aChangeLocation.isRoot(),"Cannot dispatch changes directly to the root node");
+
+ // listeners registered under multiple sub-pathes will be called multiple times !
+
+ // Collect the targets
+ osl::ClearableMutexGuard aGuard(m_aListeners.mutex);
+
+ // Dispatch listeners to ancestors of the change root
+ std::vector<DispatchTarget> aOuterTargets;
+ if (_aChangeLocation.getDepth() > 1)
+ {
+ configuration::AbsolutePath const aModulePath( configuration::Path::Rep(*_aChangeLocation.begin()) );
+
+ PathMap::const_iterator itOuter = m_aPathMap.lower_bound( aModulePath );
+ PathMap::const_iterator const endOuter = m_aPathMap.upper_bound(_aChangeLocation.getParentPath());
+
+ // TODO: Both loops are so similar - they should be a single function
+ while (itOuter != endOuter)
+ {
+ OSL_ASSERT( m_aListeners.find(itOuter->second->get()) != m_aListeners.end() );
+
+ // check whether this should be dispatched at all
+ if ( configuration::Path::hasPrefix(_aChangeLocation,itOuter->first) )
+ {
+ aOuterTargets.push_back( DispatchTarget(itOuter->second->get(), &itOuter->first) );
+ }
+ ++itOuter;
+ }
}
-*/
- /////////////////////////////////////////////////////////////////////////
- void ConfigChangeBroadcastHelper::broadcast(TreeChangeList const& anUpdate, sal_Bool bError, IConfigBroadcaster* pSource)
+
+ // Dispatch listeners to descendants of the change root
+ std::vector<DispatchTarget> aInnerTargets;
{
- m_changes.dispatch(anUpdate, bError, pSource);
+ PathMap::const_iterator itInner = m_aPathMap.lower_bound(_aChangeLocation);
+
+ while( itInner != m_aPathMap.end() && configuration::Path::hasPrefix(itInner->first,_aChangeLocation) )
+ {
+ OSL_ASSERT( m_aListeners.find(itInner->second->get()) != m_aListeners.end() );
+
+ aInnerTargets.push_back( DispatchTarget(itInner->second->get(), &itInner->first) );
+
+ ++itInner;
+ }
}
+ aGuard.clear();
+
+ {for (std::vector<DispatchTarget>::const_iterator it = aOuterTargets.begin(); it != aOuterTargets.end(); ++it){
+ this->dispatchOuter(it->pTarget, *it->pDispatchPath, rBaseChange, _aChangeLocation, _bError, pSource);
+ }}
+ {for (std::vector<DispatchTarget>::const_iterator it = aInnerTargets.begin(); it != aInnerTargets.end(); ++it){
+ this->dispatchInner(it->pTarget, *it->pDispatchPath, rBaseChange, _aChangeLocation, _bError, pSource);
+ }}
+}
+
+/////////////////////////////////////////////////////////////////////////
+void ConfigChangeBroadcastHelper::disposing(TreeManager * pSource)
+{
+ osl::ClearableMutexGuard aGuard(m_aListeners.mutex);
+ m_aPathMap.clear();
+
+ aGuard.clear();
+ m_aListeners.disposing(pSource);
+}
} // namespace
diff --git a/configmgr/source/api/confsvccomponent.cxx b/configmgr/source/api/confsvccomponent.cxx
index 88c7cce8b8..a47cf2a7c1 100644
--- a/configmgr/source/api/confsvccomponent.cxx
+++ b/configmgr/source/api/confsvccomponent.cxx
@@ -32,6 +32,7 @@
#include "precompiled_configmgr.hxx"
#include "confsvccomponent.hxx"
+#include "datalock.hxx"
#include <com/sun/star/lang/DisposedException.hpp>
#include <cppuhelper/typeprovider.hxx>
#include <osl/mutex.hxx>
@@ -43,20 +44,20 @@ namespace configmgr {
ServiceComponentImpl::ServiceComponentImpl(ServiceImplementationInfo const* aInfo)
- : ServiceImplBase(UnoApiLock::getLock())
+ : ::cppu::WeakComponentImplHelper1< lang::XServiceInfo >(UnoApiLock::getLock())
, m_info(aInfo)
{
}
void ServiceComponentImpl::disposing()
{
- ServiceImplBase::disposing();
+ ::cppu::WeakComponentImplHelper1< lang::XServiceInfo >::disposing();
}
void ServiceComponentImpl::checkAlive() throw (uno::RuntimeException)
{
checkAlive("Object was disposed");
}
- void ServiceComponentImpl::checkAlive(OUString const& sMessage) throw (uno::RuntimeException)
+ void ServiceComponentImpl::checkAlive(rtl::OUString const& sMessage) throw (uno::RuntimeException)
{
if (rBHelper.bDisposed)
throw lang::DisposedException(sMessage, *this);
@@ -80,7 +81,7 @@ namespace configmgr {
}
// XServiceInfo
- OUString SAL_CALL ServiceComponentImpl::getImplementationName( ) throw(uno::RuntimeException)
+ rtl::OUString SAL_CALL ServiceComponentImpl::getImplementationName( ) throw(uno::RuntimeException)
{
return ServiceInfoHelper(m_info).getImplementationName();
}
@@ -90,7 +91,7 @@ namespace configmgr {
return ServiceInfoHelper(m_info).supportsService( ServiceName );
}
- uno::Sequence< OUString > SAL_CALL ServiceComponentImpl::getSupportedServiceNames( ) throw(uno::RuntimeException)
+ uno::Sequence< rtl::OUString > SAL_CALL ServiceComponentImpl::getSupportedServiceNames( ) throw(uno::RuntimeException)
{
return ServiceInfoHelper(m_info).getSupportedServiceNames( );
}
diff --git a/configmgr/source/api/makefile.mk b/configmgr/source/api/makefile.mk
index 06ef243578..d80b4c77b3 100644
--- a/configmgr/source/api/makefile.mk
+++ b/configmgr/source/api/makefile.mk
@@ -44,7 +44,6 @@ ENABLE_EXCEPTIONS=TRUE
SLOFILES= \
$(SLO)$/confevents.obj \
- $(SLO)$/confeventhelpers.obj \
$(SLO)$/confsvccomponent.obj
# --- Targets ----------------------------------
diff --git a/configmgr/source/api2/accessimpl.cxx b/configmgr/source/api2/accessimpl.cxx
index b53e4e3b4a..69098d7c12 100644
--- a/configmgr/source/api2/accessimpl.cxx
+++ b/configmgr/source/api2/accessimpl.cxx
@@ -59,22 +59,6 @@ namespace configmgr
namespace lang = css::lang;
namespace util = css::util;
- using uno::RuntimeException;
- using uno::Reference;
- using uno::Any;
- using uno::Sequence;
- using lang::NoSupportException;
-
- using configuration::AnyNodeRef;
- using configuration::NodeRef;
- using configuration::ValueRef;
-
- using configuration::Tree;
- using configuration::Name;
- using configuration::AbsolutePath;
- using configuration::RelativePath;
- using node::Attributes;
-
//-----------------------------------------------------------------------------------
// Constructors
//-----------------------------------------------------------------------------------
@@ -85,18 +69,18 @@ namespace configmgr
// XHierarchicalName
//------------------------------------------------------------------------------------------------------------------
-OUString implGetHierarchicalName( NodeAccess& rNode ) throw(RuntimeException)
+rtl::OUString implGetHierarchicalName( NodeAccess& rNode ) throw(uno::RuntimeException)
{
// RTL_LOGFILE_CONTEXT(aLog, "Configmgr::API::implGetHierarchicalName()");
- OUString sRet;
+ rtl::OUString sRet;
try
{
- GuardedNodeDataAccess lock( rNode );
+ GuardedNodeData<NodeAccess> lock( rNode );
- Tree aTree( lock.getTree());
+ rtl::Reference< configuration::Tree > aTree( lock.getTree());
- AbsolutePath const aFullPath = aTree.getAbsolutePath(lock.getNode());
+ configuration::AbsolutePath const aFullPath = aTree->getAbsolutePath(lock.getNode());
sRet = aFullPath.toString();
}
catch (configuration::Exception& ex)
@@ -110,21 +94,20 @@ OUString implGetHierarchicalName( NodeAccess& rNode ) throw(RuntimeException)
}
//------------------------------------------------------------------------------------------------------------------
-OUString implComposeHierarchicalName(NodeGroupInfoAccess& rNode, const OUString& sRelativeName )
- throw(css::lang::IllegalArgumentException, NoSupportException, RuntimeException)
+rtl::OUString implComposeHierarchicalName(NodeGroupInfoAccess& rNode, const rtl::OUString& sRelativeName )
+ throw(css::lang::IllegalArgumentException, lang::NoSupportException, uno::RuntimeException)
{
- using configuration::validateRelativePath; // should actually be found by "Koenig" lookup, but MSVC6 fails there
- OUString sRet;
+ rtl::OUString sRet;
try
{
- GuardedNodeDataAccess lock( rNode );
- NodeRef aNode( lock.getNode() );
- Tree aTree( lock.getTree() );
+ GuardedNodeData<NodeAccess> lock( rNode );
+ configuration::NodeRef aNode( lock.getNode() );
+ rtl::Reference< configuration::Tree > aTree( lock.getTree() );
- RelativePath const aAddedPath = validateRelativePath(sRelativeName, aTree, aNode);
+ configuration::RelativePath const aAddedPath = configuration::validateRelativePath(sRelativeName, aTree, aNode);
// TODO: add (relative) name validation based on node type - may then need provider lock
- AbsolutePath const aFullPath = aTree.getAbsolutePath(aNode).compose(aAddedPath);
+ configuration::AbsolutePath const aFullPath = aTree->getAbsolutePath(aNode).compose(aAddedPath);
sRet = aFullPath.toString();
}
@@ -146,22 +129,20 @@ OUString implComposeHierarchicalName(NodeGroupInfoAccess& rNode, const OUString&
}
//------------------------------------------------------------------------------------------------------------------
-OUString implComposeHierarchicalName(NodeSetInfoAccess& rNode, const OUString& sElementName )
- throw(css::lang::IllegalArgumentException, NoSupportException, RuntimeException)
+rtl::OUString implComposeHierarchicalName(NodeSetInfoAccess& rNode, const rtl::OUString& sElementName )
+ throw(css::lang::IllegalArgumentException, lang::NoSupportException, uno::RuntimeException)
{
- using configuration::validateElementPathComponent; // should actually be found by "Koenig" lookup, but MSVC6 fails there
- using configuration::Path::Component;
- OUString sRet;
+ rtl::OUString sRet;
try
{
- GuardedNodeDataAccess lock( rNode );
- NodeRef aNode( lock.getNode() );
- Tree aTree( lock.getTree() );
+ GuardedNodeData<NodeAccess> lock( rNode );
+ configuration::NodeRef aNode( lock.getNode() );
+ rtl::Reference< configuration::Tree > aTree( lock.getTree() );
- /*Path::*/Component const aAddedName = validateElementPathComponent(sElementName, aTree, aNode);
+ configuration::Path::Component const aAddedName = configuration::validateElementPathComponent(sElementName, aTree, aNode);
// TODO: add (relative) name validation based on node type - may then need provider lock
- AbsolutePath const aFullPath = aTree.getAbsolutePath(aNode).compose(aAddedName);
+ configuration::AbsolutePath const aFullPath = aTree->getAbsolutePath(aNode).compose(aAddedName);
sRet = aFullPath.toString();
}
@@ -190,7 +171,7 @@ OUString implComposeHierarchicalName(NodeSetInfoAccess& rNode, const OUString& s
//-----------------------------------------------------------------------------------
// for group nodes
-uno::Type implGetElementType(NodeGroupInfoAccess& rNode) throw(RuntimeException)
+uno::Type implGetElementType(NodeGroupInfoAccess& rNode) throw(uno::RuntimeException)
{
rNode.checkAlive();
// group nodes have a mix of types
@@ -199,14 +180,14 @@ uno::Type implGetElementType(NodeGroupInfoAccess& rNode) throw(RuntimeException)
}
// for set nodes
-uno::Type implGetElementType(NodeSetInfoAccess& rNode) throw(RuntimeException)
+uno::Type implGetElementType(NodeSetInfoAccess& rNode) throw(uno::RuntimeException)
{
uno::Type aRet;
try
{
GuardedNodeData<NodeSetInfoAccess> lock( rNode );
- aRet = rNode.getElementInfo().getElementType();
+ aRet = rNode.getElementInfo()->getInstanceType();
}
catch (configuration::Exception& ex)
{
@@ -219,7 +200,7 @@ uno::Type implGetElementType(NodeSetInfoAccess& rNode) throw(RuntimeException)
//-----------------------------------------------------------------------------------
// for group nodes
-sal_Bool implHasElements(NodeGroupInfoAccess& rNode) throw(RuntimeException)
+sal_Bool implHasElements(NodeGroupInfoAccess& rNode) throw(uno::RuntimeException)
{
// rNode.checkAlive();
// return true; // group nodes always have children
@@ -227,12 +208,12 @@ sal_Bool implHasElements(NodeGroupInfoAccess& rNode) throw(RuntimeException)
// Better: cater for the case where we are reaching the depth limit
try
{
- GuardedNodeDataAccess lock( rNode ); // no provider lock needed
+ GuardedNodeData<NodeAccess> lock( rNode ); // no provider lock needed
- Tree aThisTree( lock.getTree() );
- NodeRef aThisNode( lock.getNode() );
- OSL_ASSERT( !aThisTree.hasElements(aThisNode) );
- return aThisTree.hasChildren(aThisNode);
+ rtl::Reference< configuration::Tree > aThisTree( lock.getTree() );
+ configuration::NodeRef aThisNode( lock.getNode() );
+ OSL_ASSERT( !aThisTree->hasElements(aThisNode) );
+ return aThisTree->hasChildren(aThisNode);
}
catch (configuration::Exception& ex)
{
@@ -246,16 +227,16 @@ sal_Bool implHasElements(NodeGroupInfoAccess& rNode) throw(RuntimeException)
}
// for set nodes
-sal_Bool implHasElements(NodeSetInfoAccess& rNode) throw(RuntimeException)
+sal_Bool implHasElements(NodeSetInfoAccess& rNode) throw(uno::RuntimeException)
{
try
{
- GuardedNodeDataAccess lock( rNode ); // provider lock needed
+ GuardedNodeData<NodeAccess> lock( rNode ); // provider lock needed
- Tree aThisTree( lock.getTree() );
- NodeRef aThisNode( lock.getNode() );
- OSL_ASSERT( !aThisTree.hasChildren(aThisNode) );
- return aThisTree.hasElements(aThisNode);
+ rtl::Reference< configuration::Tree > aThisTree( lock.getTree() );
+ configuration::NodeRef aThisNode( lock.getNode() );
+ OSL_ASSERT( !aThisTree->hasChildren(aThisNode) );
+ return aThisTree->hasElements(aThisNode);
}
catch (configuration::Exception& ex)
{
@@ -275,79 +256,75 @@ sal_Bool implHasElements(NodeSetInfoAccess& rNode) throw(RuntimeException)
//------------------------------------------------------------------------------------------------------------------
namespace internal
{
- using namespace configuration;
- struct SearchExactName : private NodeVisitor
+ struct SearchExactName : private configuration::NodeVisitor
{
protected:
// warning: order dependency
- RelativePath aSearchPath;
- RelativePath::MutatingIterator pSearchComponent;
+ configuration::RelativePath aSearchPath;
+ std::vector<configuration::Path::Component>::reverse_iterator pSearchComponent;
public:
explicit
- SearchExactName(const RelativePath& aLookFor)
+ SearchExactName(const configuration::RelativePath& aLookFor)
: aSearchPath(aLookFor)
, pSearchComponent(aSearchPath.begin_mutate())
{}
bool complete() { return aSearchPath.end_mutate() == pSearchComponent; }
- bool search(NodeRef const& aNode, Tree const& aTree);
+ bool search(configuration::NodeRef const& aNode, rtl::Reference< configuration::Tree > const& aTree);
- RelativePath const& getBestMatch() const { return aSearchPath; }
+ configuration::RelativePath const& getBestMatch() const { return aSearchPath; }
private:
- bool findMatch(NodeRef& aNode, Tree& aTree);
- virtual Result handle(Tree const& aTree, NodeRef const&); // NodeVisitor
- virtual Result handle(Tree const& aTree, ValueRef const&); // NodeVisitor
+ bool findMatch(configuration::NodeRef& aNode, rtl::Reference< configuration::Tree > & aTree);
+ virtual Result handle(rtl::Reference< configuration::Tree > const& aTree, configuration::NodeRef const&); // NodeVisitor
+ virtual Result handle(rtl::Reference< configuration::Tree > const& aTree, configuration::ValueRef const&); // NodeVisitor
};
//..................................................................................................................
- bool SearchExactName::findMatch(NodeRef& aNode, Tree& aTree)
+ bool SearchExactName::findMatch(configuration::NodeRef& aNode, rtl::Reference< configuration::Tree > & aTree)
{
OSL_ASSERT( !complete() );
if ( !aNode.isValid() ) return false;
- using configuration::hasChildOrElement;
- using configuration::findInnerChildOrAvailableElement;
-
// exact match ?
- if (!hasChildOrElement(aTree,aNode,*pSearchComponent))
+ if (!configuration::hasChildOrElement(aTree,aNode,*pSearchComponent))
{
- if (aTree.dispatchToChildren(aNode,*this) == CONTINUE) // not found there
+ if (aTree->dispatchToChildren(aNode,*this) == CONTINUE) // not found there
return false;
}
- OSL_ASSERT(hasChildOrElement(aTree,aNode,*pSearchComponent));
+ OSL_ASSERT(configuration::hasChildOrElement(aTree,aNode,*pSearchComponent));
- if (! findInnerChildOrAvailableElement(aTree,aNode,pSearchComponent->getName()) )
- aNode = NodeRef(); // will stop recursion (value or unloaded element found)
+ if (! configuration::findInnerChildOrAvailableElement(aTree,aNode,pSearchComponent->getName()) )
+ aNode = configuration::NodeRef(); // will stop recursion (value or unloaded element found)
++pSearchComponent;
return true;
}
//..................................................................................................................
// helper
- static Path::Component getExtendedNodeName(Tree const& aTree, NodeRef const& aNode, Name const& aSimpleNodeName)
+ static configuration::Path::Component getExtendedNodeName(rtl::Reference< configuration::Tree > const& aTree, configuration::NodeRef const& aNode, rtl::OUString const& aSimpleNodeName)
{
- OSL_PRECOND( !aTree.isEmpty(), "ERROR: Configuration: Tree operation requires valid tree" );
- OSL_PRECOND( !aNode.isValid() || aTree.isValidNode(aNode), "ERROR: Configuration: NodeRef does not match tree" );
+ OSL_PRECOND( !configuration::isEmpty(aTree.get()), "ERROR: Configuration: Tree operation requires valid tree" );
+ OSL_PRECOND( !aNode.isValid() || aTree->isValidNode(aNode.getOffset()), "ERROR: Configuration: NodeRef does not match tree" );
- if (aTree.isRootNode(aNode))
- return aTree.getRootName();
+ if (aTree->isRootNode(aNode))
+ return aTree->getExtendedRootName();
else
- return Path::wrapSimpleName(aSimpleNodeName);
+ return configuration::Path::wrapSimpleName(aSimpleNodeName);
}
//..................................................................................................................
- NodeVisitor::Result SearchExactName::handle(Tree const& aTree, NodeRef const& aNode)
+ configuration::NodeVisitor::Result SearchExactName::handle(rtl::Reference< configuration::Tree > const& aTree, configuration::NodeRef const& aNode)
{
OSL_ASSERT( aNode.isValid() );
OSL_ASSERT( !complete() );
// find inexact match (the first one, but the order is unspecified)
// TODO: Add support for node-type-specific element names
- Name aNodeName = aTree.getName(aNode);
- Name aSearchName = pSearchComponent->getName();
- if (aNodeName.toString().equalsIgnoreAsciiCase(aSearchName.toString()))
+ rtl::OUString aNodeName = aTree->getSimpleNodeName(aNode.getOffset());
+ rtl::OUString aSearchName = pSearchComponent->getName();
+ if (aNodeName.equalsIgnoreAsciiCase(aSearchName))
{
*pSearchComponent = getExtendedNodeName(aTree,aNode,aNodeName);
return DONE; // for this level
@@ -356,32 +333,32 @@ namespace internal
return CONTINUE;
}
//..................................................................................................................
- NodeVisitor::Result SearchExactName::handle(Tree const& aTree, ValueRef const& aNode)
+ configuration::NodeVisitor::Result SearchExactName::handle(rtl::Reference< configuration::Tree > const&, configuration::ValueRef const& aNode)
{
OSL_ASSERT( aNode.isValid() );
OSL_ASSERT( !complete() );
// find inexact match (the first one, but the order is unspecified)
// TODO: Add support for node-type-specific element names
- Name aNodeName = aTree.getName(aNode);
- OSL_ASSERT( isSimpleName(aNodeName) );
+ rtl::OUString aNodeName = aNode.m_sNodeName;
+ OSL_ASSERT( configuration::isSimpleName(aNodeName) );
// value refs are group members and thus have to have simple names
- if (aNodeName.toString().equalsIgnoreAsciiCase(pSearchComponent->getName().toString()))
+ if (aNodeName.equalsIgnoreAsciiCase(pSearchComponent->getName()))
{
- *pSearchComponent = Path::wrapSimpleName(aNodeName);
+ *pSearchComponent = configuration::Path::wrapSimpleName(aNodeName);
return DONE; // for this level
}
else
return CONTINUE;
}
//..................................................................................................................
- bool SearchExactName::search(NodeRef const & aNode, Tree const & aTree)
+ bool SearchExactName::search(configuration::NodeRef const & aNode, rtl::Reference< configuration::Tree > const & aTree)
{
if (!aNode.isValid()) return false;
- Tree aSearchTree(aTree);
- NodeRef aSearchNode(aNode);
+ rtl::Reference< configuration::Tree > aSearchTree(aTree);
+ configuration::NodeRef aSearchNode(aNode);
while (!complete())
if (! findMatch(aSearchNode, aSearchTree))
@@ -393,22 +370,19 @@ namespace internal
} // namespace internal
//..................................................................................................................
-OUString implGetExactName(NodeGroupInfoAccess& rNode, const OUString& rApproximateName ) throw(RuntimeException)
+rtl::OUString implGetExactName(NodeGroupInfoAccess& rNode, const rtl::OUString& rApproximateName ) throw(uno::RuntimeException)
{
// here we try to support both tree-fragment-local pathes and simple names (the latter ones are just an instance of the first)
try
{
- using internal::SearchExactName;
- using configuration::validateRelativePath;
-
- GuardedNodeDataAccess lock( rNode );
+ GuardedNodeData<NodeAccess> lock( rNode );
- Tree aTree(lock.getTree());
- NodeRef aNode(lock.getNode());
+ rtl::Reference< configuration::Tree > aTree(lock.getTree());
+ configuration::NodeRef aNode(lock.getNode());
- RelativePath aApproximatePath = validateRelativePath(rApproximateName,aTree,aNode);
+ configuration::RelativePath aApproximatePath = configuration::validateRelativePath(rApproximateName,aTree,aNode);
- SearchExactName aSearch(aApproximatePath);
+ internal::SearchExactName aSearch(aApproximatePath);
aSearch.search(aNode, aTree);
@@ -434,31 +408,27 @@ OUString implGetExactName(NodeGroupInfoAccess& rNode, const OUString& rApproxima
}
//..................................................................................................................
-OUString implGetExactName(NodeSetInfoAccess& rNode, const OUString& rApproximateName ) throw(RuntimeException)
+rtl::OUString implGetExactName(NodeSetInfoAccess& rNode, const rtl::OUString& rApproximateName ) throw(uno::RuntimeException)
{
// here we can support only local names
try
{
- using internal::SearchExactName;
- using configuration::validateElementPathComponent;
- using configuration::Path::Component;
+ GuardedNodeData<NodeAccess> lock( rNode );
- GuardedNodeDataAccess lock( rNode );
+ rtl::Reference< configuration::Tree > aTree(lock.getTree());
+ configuration::NodeRef aNode(lock.getNode());
- Tree aTree(lock.getTree());
- NodeRef aNode(lock.getNode());
+ configuration::Path::Component aApproximateName = configuration::validateElementPathComponent(rApproximateName,aTree,aNode);
- /*Path::*/Component aApproximateName = validateElementPathComponent(rApproximateName,aTree,aNode);
-
- SearchExactName aSearch(aApproximateName);
+ internal::SearchExactName aSearch(aApproximateName);
aSearch.search(aNode, aTree);
OSL_ENSURE( aSearch.getBestMatch().getDepth() == 1,
"Search for exact names changed number of path components !?");
- return aSearch.getBestMatch().getLocalName().getName().toString();
+ return aSearch.getBestMatch().getLocalName().getName();
}
catch (configuration::InvalidName& )
{
@@ -483,20 +453,18 @@ OUString implGetExactName(NodeSetInfoAccess& rNode, const OUString& rApproximate
beans::Property implGetAsProperty(NodeAccess& rNode)
throw(uno::RuntimeException)
{
-
- using beans::Property;
try
{
- GuardedNodeDataAccess lock( rNode );
+ GuardedNodeData<NodeAccess> lock( rNode );
- Tree aTree( lock.getTree());
- NodeRef aNode( lock.getNode());
+ rtl::Reference< configuration::Tree > aTree( lock.getTree());
+ configuration::NodeRef aNode( lock.getNode());
- Name aName = aTree.getName(aNode);
- Attributes aAttributes = aTree.getAttributes(aNode);
+ rtl::OUString aName = aTree->getSimpleNodeName(aNode.getOffset());
+ node::Attributes aAttributes = aTree->getAttributes(aNode);
uno::Type aApiType = getUnoInterfaceType();
- return helperMakeProperty( aName,aAttributes,aApiType, aTree.hasNodeDefault(aNode) );
+ return helperMakeProperty( aName,aAttributes,aApiType, aTree->hasNodeDefault(aNode) );
}
catch (configuration::Exception& ex)
{
@@ -507,7 +475,7 @@ beans::Property implGetAsProperty(NodeAccess& rNode)
// unreachable, but still there to make some compilers happy
OSL_ASSERT(!"Unreachable code");
- return Property();
+ return beans::Property();
}
// XPropertySetInfo
//-----------------------------------------------------------------------------------
@@ -519,9 +487,9 @@ uno::Sequence< css::beans::Property > implGetProperties( NodeAccess& rNode ) thr
try
{
- GuardedNodeDataAccess lock( rNode );
+ GuardedNodeData<NodeAccess> lock( rNode );
- lock.getTree().dispatchToChildren(lock.getNode(), aCollect);
+ lock.getTree()->dispatchToChildren(lock.getNode(), aCollect);
}
catch (configuration::Exception& ex)
{
@@ -534,42 +502,42 @@ uno::Sequence< css::beans::Property > implGetProperties( NodeAccess& rNode ) thr
}
//-----------------------------------------------------------------------------------
-css::beans::Property implGetPropertyByName( NodeAccess& rNode, const OUString& aName )
+css::beans::Property implGetPropertyByName( NodeAccess& rNode, const rtl::OUString& aName )
throw (css::beans::UnknownPropertyException, uno::RuntimeException)
{
try
{
- GuardedNodeDataAccess lock( rNode );
+ GuardedNodeData<NodeAccess> lock( rNode );
- Tree aTree( lock.getTree() );
- NodeRef const aNode( lock.getNode() );
+ rtl::Reference< configuration::Tree > aTree( lock.getTree() );
+ configuration::NodeRef const aNode( lock.getNode() );
- Name aChildName = configuration::validateChildOrElementName(aName,aTree,aNode);
+ rtl::OUString aChildName = configuration::validateChildOrElementName(aName,aTree,aNode);
- AnyNodeRef aChildNode = configuration::getChildOrElement(aTree,aNode, aChildName);
+ configuration::AnyNodeRef aChildNode = configuration::getChildOrElement(aTree,aNode, aChildName);
if (!aChildNode.isValid())
{
OSL_ENSURE(!configuration::hasChildOrElement(aTree,aNode,aChildName),"ERROR: Configuration: Existing Property not found by implementation");
- OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Configuration - Cannot get Property. Property '") );
+ rtl::OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Configuration - Cannot get Property. Property '") );
sMessage += aName;
- sMessage += OUString( RTL_CONSTASCII_USTRINGPARAM("' could not be found in ") );
- sMessage += aTree.getAbsolutePath(aNode).toString();
+ sMessage += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("' could not be found in ") );
+ sMessage += aTree->getAbsolutePath(aNode).toString();
- Reference<uno::XInterface> xContext( rNode.getUnoInstance() );
+ uno::Reference<uno::XInterface> xContext( rNode.getUnoInstance() );
throw css::beans::UnknownPropertyException( sMessage, xContext );
}
- Attributes aChildAttributes = aTree.getAttributes(aChildNode);
- uno::Type aApiType = aChildNode.isNode() ? getUnoInterfaceType() : aTree.getUnoType(aChildNode.toValue());
+ node::Attributes aChildAttributes = aTree->getAttributes(aChildNode);
+ uno::Type aApiType = aChildNode.isNode() ? getUnoInterfaceType() : aTree->getUnoType(aChildNode.toValue());
- return helperMakeProperty( aChildName,aChildAttributes,aApiType, aTree.hasNodeDefault(aChildNode) );
+ return helperMakeProperty( aChildName,aChildAttributes,aApiType, aTree->hasNodeDefault(aChildNode) );
}
catch (configuration::InvalidName& ex)
{
ExceptionMapper e(ex);
- Reference<uno::XInterface> xContext( rNode.getUnoInstance() );
+ uno::Reference<uno::XInterface> xContext( rNode.getUnoInstance() );
throw css::beans::UnknownPropertyException( e.message(), xContext );
}
catch (configuration::Exception& ex)
@@ -586,9 +554,9 @@ css::beans::Property implGetPropertyByName( NodeAccess& rNode, const OUString& a
//-----------------------------------------------------------------------------------
-sal_Bool implHasPropertyByName( NodeAccess& rNode, const OUString& Name ) throw (uno::RuntimeException)
+sal_Bool implHasPropertyByName( NodeAccess& rNode, const rtl::OUString& name ) throw (uno::RuntimeException)
{
- return implHasByName(rNode, Name);
+ return implHasByName(rNode, name);
}
// XNameAccess
@@ -598,17 +566,15 @@ sal_Bool implHasPropertyByName( NodeAccess& rNode, const OUString& Name ) throw
// TODO: optimization - cache the node found (for subsequent getByName)
// TODO: optimization - less locking for group nodes
//-----------------------------------------------------------------------------------
-sal_Bool implHasByName(NodeAccess& rNode, const OUString& sName ) throw(RuntimeException)
+sal_Bool implHasByName(NodeAccess& rNode, const rtl::OUString& sName ) throw(uno::RuntimeException)
{
- using namespace com::sun::star::container;
- using configuration::hasChildOrElement;
try
{
- GuardedNodeDataAccess lock( rNode );
+ GuardedNodeData<NodeAccess> lock( rNode );
- Name aChildName = configuration::makeName(sName, Name::NoValidate());
+ rtl::OUString aChildName(sName);
- return hasChildOrElement(lock.getTree(), lock.getNode(), aChildName);
+ return configuration::hasChildOrElement(lock.getTree(), lock.getNode(), aChildName);
}
#if OSL_DEBUG_LEVEL > 0
catch (configuration::InvalidName& ex)
@@ -631,30 +597,28 @@ sal_Bool implHasByName(NodeAccess& rNode, const OUString& sName ) throw(RuntimeE
}
//-----------------------------------------------------------------------------------
-Any implGetByName(NodeAccess& rNode, const OUString& sName )
- throw(css::container::NoSuchElementException, css::lang::WrappedTargetException, RuntimeException)
+uno::Any implGetByName(NodeAccess& rNode, const rtl::OUString& sName )
+ throw(css::container::NoSuchElementException, css::lang::WrappedTargetException, uno::RuntimeException)
{
- using namespace com::sun::star::container;
- using configuration::getChildOrElement;
try
{
- GuardedNodeDataAccess lock( rNode );
+ GuardedNodeData<NodeAccess> lock( rNode );
- Tree aTree( lock.getTree() );
- NodeRef aNode( lock.getNode() );
+ rtl::Reference< configuration::Tree > aTree( lock.getTree() );
+ configuration::NodeRef aNode( lock.getNode() );
- Name aChildName = configuration::validateChildOrElementName(sName,aTree,aNode);
+ rtl::OUString aChildName = configuration::validateChildOrElementName(sName,aTree,aNode);
- AnyNodeRef aChildNode = getChildOrElement(aTree,aNode, aChildName);
+ configuration::AnyNodeRef aChildNode = configuration::getChildOrElement(aTree,aNode, aChildName);
if (!aChildNode.isValid())
{
- OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Configuration - Child Element '") );
+ rtl::OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Configuration - Child Element '") );
sMessage += sName;
- sMessage += OUString( RTL_CONSTASCII_USTRINGPARAM("' not found in ") );
- sMessage += aTree.getAbsolutePath(aNode).toString();
+ sMessage += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("' not found in ") );
+ sMessage += aTree->getAbsolutePath(aNode).toString();
- Reference<uno::XInterface> xContext( rNode.getUnoInstance() );
- throw NoSuchElementException( sMessage, xContext );
+ uno::Reference<uno::XInterface> xContext( rNode.getUnoInstance() );
+ throw com::sun::star::container::NoSuchElementException( sMessage, xContext );
}
OSL_ASSERT(aNode.isValid());
@@ -663,8 +627,8 @@ Any implGetByName(NodeAccess& rNode, const OUString& sName )
catch (configuration::InvalidName& ex)
{
ExceptionMapper e(ex);
- Reference<uno::XInterface> xContext( rNode.getUnoInstance() );
- throw NoSuchElementException( e.message(), xContext );
+ uno::Reference<uno::XInterface> xContext( rNode.getUnoInstance() );
+ throw com::sun::star::container::NoSuchElementException( e.message(), xContext );
}
catch (configuration::Exception& ex)
{
@@ -675,21 +639,21 @@ Any implGetByName(NodeAccess& rNode, const OUString& sName )
// unreachable, but still there to make some compilers happy
OSL_ASSERT(!"Unreachable code");
- return Any();
+ return uno::Any();
}
//-----------------------------------------------------------------------------------
// TODO: optimization - less locking for group nodes
//-----------------------------------------------------------------------------------
-Sequence< OUString > implGetElementNames( NodeAccess& rNode ) throw( RuntimeException)
+uno::Sequence< rtl::OUString > implGetElementNames( NodeAccess& rNode ) throw( uno::RuntimeException)
{
CollectNodeNames aCollect;
try
{
- GuardedNodeDataAccess lock( rNode );
+ GuardedNodeData<NodeAccess> lock( rNode );
- lock.getTree().dispatchToChildren(lock.getNode(), aCollect);
+ lock.getTree()->dispatchToChildren(lock.getNode(), aCollect);
}
catch (configuration::Exception& ex)
{
@@ -707,21 +671,18 @@ Sequence< OUString > implGetElementNames( NodeAccess& rNode ) throw( RuntimeExce
//-----------------------------------------------------------------------------------
// TO DO: optimization - cache the node found for subsequent getByHierarchicalName()
//-----------------------------------------------------------------------------------
-sal_Bool implHasByHierarchicalName(NodeAccess& rNode, const OUString& sHierarchicalName ) throw(RuntimeException)
+sal_Bool implHasByHierarchicalName(NodeAccess& rNode, const rtl::OUString& sHierarchicalName ) throw(uno::RuntimeException)
{
- using namespace com::sun::star::container;
- using configuration::validateAndReducePath; // should actually be found by "Koenig" lookup, but MSVC6 fails
- using configuration::getDeepDescendant; // should actually be found by "Koenig" lookup, but MSVC6 fails
try
{
- GuardedNodeDataAccess lock( rNode );
+ GuardedNodeData<NodeAccess> lock( rNode );
- Tree aTree( lock.getTree() );
- NodeRef aNode( lock.getNode() );
+ rtl::Reference< configuration::Tree > aTree( lock.getTree() );
+ configuration::NodeRef aNode( lock.getNode() );
- RelativePath aRelPath = validateAndReducePath( sHierarchicalName, aTree, aNode );
+ configuration::RelativePath aRelPath = configuration::validateAndReducePath( sHierarchicalName, aTree, aNode );
- return getDeepDescendant(aTree, aNode, aRelPath).isValid();
+ return configuration::getDeepDescendant(aTree, aNode, aRelPath).isValid();
}
catch (configuration::InvalidName& )
{
@@ -740,34 +701,31 @@ sal_Bool implHasByHierarchicalName(NodeAccess& rNode, const OUString& sHierarchi
}
//-----------------------------------------------------------------------------------
-Any implGetByHierarchicalName(NodeAccess& rNode, const OUString& sHierarchicalName )
- throw(css::container::NoSuchElementException, RuntimeException)
+uno::Any implGetByHierarchicalName(NodeAccess& rNode, const rtl::OUString& sHierarchicalName )
+ throw(css::container::NoSuchElementException, uno::RuntimeException)
{
// rtl::OUString aTmpStr(implGetHierarchicalName(rNode));
// RTL_LOGFILE_CONTEXT_TRACE2(aLog, "Node: %s HierachicalName: %s",RTL_LOGFILE_OU2A(aTmpStr), RTL_LOGFILE_OU2A(sHierarchicalName));
- using namespace com::sun::star::container;
- using configuration::validateAndReducePath; // should actually be found by "Koenig" lookup, but MSVC6 fails
- using configuration::getDeepDescendant; // should actually be found by "Koenig" lookup, but MSVC6 fails
try
{
- GuardedNodeDataAccess lock( rNode );
+ GuardedNodeData<NodeAccess> lock( rNode );
- Tree aTree( lock.getTree() );
- NodeRef aNode( lock.getNode() );
+ rtl::Reference< configuration::Tree > aTree( lock.getTree() );
+ configuration::NodeRef aNode( lock.getNode() );
- RelativePath aRelPath = validateAndReducePath( sHierarchicalName, aTree, aNode );
+ configuration::RelativePath aRelPath = configuration::validateAndReducePath( sHierarchicalName, aTree, aNode );
- AnyNodeRef aNestedNode = getDeepDescendant( aTree, aNode, aRelPath );
+ configuration::AnyNodeRef aNestedNode = configuration::getDeepDescendant( aTree, aNode, aRelPath );
if (!aNestedNode.isValid())
{
- OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Configuration - Descendant Element '") );
+ rtl::OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Configuration - Descendant Element '") );
sMessage += aRelPath.toString();
- sMessage += OUString( RTL_CONSTASCII_USTRINGPARAM("' not found in Node ") );
- sMessage += aTree.getAbsolutePath(aNode).toString();
+ sMessage += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("' not found in Node ") );
+ sMessage += aTree->getAbsolutePath(aNode).toString();
- Reference<uno::XInterface> xContext( rNode.getUnoInstance() );
- throw NoSuchElementException( sMessage, xContext );
+ uno::Reference<uno::XInterface> xContext( rNode.getUnoInstance() );
+ throw com::sun::star::container::NoSuchElementException( sMessage, xContext );
}
OSL_ASSERT(aNode.isValid());
@@ -776,8 +734,8 @@ Any implGetByHierarchicalName(NodeAccess& rNode, const OUString& sHierarchicalNa
catch (configuration::InvalidName& ex)
{
ExceptionMapper e(ex);
- Reference<uno::XInterface> xContext( rNode.getUnoInstance() );
- throw NoSuchElementException( e.message(), xContext );
+ uno::Reference<uno::XInterface> xContext( rNode.getUnoInstance() );
+ throw com::sun::star::container::NoSuchElementException( e.message(), xContext );
}
catch (configuration::Exception& ex)
{
@@ -788,7 +746,7 @@ Any implGetByHierarchicalName(NodeAccess& rNode, const OUString& sHierarchicalNa
// unreachable, but still there to make some compilers happy
OSL_ASSERT(!"Unreachable code");
- return Any();
+ return uno::Any();
}
// XPropertyWithState
@@ -796,15 +754,13 @@ Any implGetByHierarchicalName(NodeAccess& rNode, const OUString& sHierarchicalNa
css::beans::PropertyState implGetStateAsProperty(NodeAccess& rNode)
throw (uno::RuntimeException)
{
- using namespace css::beans;
-
- PropertyState aRet = PropertyState_AMBIGUOUS_VALUE;
+ css::beans::PropertyState aRet = css::beans::PropertyState_AMBIGUOUS_VALUE;
try
{
- GuardedNodeDataAccess lock( rNode );
+ GuardedNodeData<NodeAccess> lock( rNode );
- if ( lock.getTree().isNodeDefault( lock.getNode() ) )
- aRet = PropertyState_DEFAULT_VALUE;
+ if ( lock.getTree()->isNodeDefault( lock.getNode() ) )
+ aRet = css::beans::PropertyState_DEFAULT_VALUE;
}
catch (configuration::Exception& ex)
{
@@ -815,7 +771,7 @@ css::beans::PropertyState implGetStateAsProperty(NodeAccess& rNode)
return aRet;
}
-Reference< uno::XInterface > implGetDefaultAsProperty(NodeAccess& )
+uno::Reference< uno::XInterface > implGetDefaultAsProperty(NodeAccess& )
throw (css::lang::WrappedTargetException, uno::RuntimeException)
{
// not really supported
@@ -826,7 +782,7 @@ Reference< uno::XInterface > implGetDefaultAsProperty(NodeAccess& )
return rNode.getUnoInstance();
*/
- return Reference< uno::XInterface >();
+ return uno::Reference< uno::XInterface >();
}
@@ -836,11 +792,11 @@ Reference< uno::XInterface > implGetDefaultAsProperty(NodeAccess& )
// XTemplateContainer
//-----------------------------------------------------------------------------------
-OUString SAL_CALL implGetElementTemplateName(NodeSetInfoAccess& rNode)
+rtl::OUString SAL_CALL implGetElementTemplateName(NodeSetInfoAccess& rNode)
throw(uno::RuntimeException)
{
GuardedNodeData<NodeSetInfoAccess> lock(rNode);
- return rNode.getElementInfo().getTemplateInfo().getTemplatePathString();
+ return rNode.getElementInfo()->getPathString();
}
//-----------------------------------------------------------------------------------
diff --git a/configmgr/source/api2/accessimpl.hxx b/configmgr/source/api2/accessimpl.hxx
index 4801e00f6b..b168338b6b 100644
--- a/configmgr/source/api2/accessimpl.hxx
+++ b/configmgr/source/api2/accessimpl.hxx
@@ -45,7 +45,6 @@ namespace configmgr
{
namespace css = ::com::sun::star;
namespace uno = ::com::sun::star::uno;
- using rtl::OUString;
/* implementations of the interfaces supported by a (parent) node
within the configuration tree.
@@ -58,13 +57,13 @@ namespace configmgr
class NodeGroupInfoAccess;
// XHierarchicalName
- OUString implGetHierarchicalName(NodeAccess& rNode)
+ rtl::OUString implGetHierarchicalName(NodeAccess& rNode)
throw(uno::RuntimeException);
- OUString implComposeHierarchicalName(NodeGroupInfoAccess& rNode, const OUString& aRelativeName )
+ rtl::OUString implComposeHierarchicalName(NodeGroupInfoAccess& rNode, const rtl::OUString& aRelativeName )
throw(css::lang::IllegalArgumentException, css::lang::NoSupportException, uno::RuntimeException);
- OUString implComposeHierarchicalName(NodeSetInfoAccess& rNode, const OUString& aRelativeName )
+ rtl::OUString implComposeHierarchicalName(NodeSetInfoAccess& rNode, const rtl::OUString& aRelativeName )
throw(css::lang::IllegalArgumentException, css::lang::NoSupportException, uno::RuntimeException);
// XElementAccess, base class of XNameAccess
@@ -81,27 +80,27 @@ namespace configmgr
throw(uno::RuntimeException);
// XNameAccess
- uno::Any implGetByName(NodeAccess& rNode, const OUString& aName )
+ uno::Any implGetByName(NodeAccess& rNode, const rtl::OUString& aName )
throw(css::container::NoSuchElementException, css::lang::WrappedTargetException, uno::RuntimeException);
- uno::Sequence< OUString > implGetElementNames(NodeAccess& rNode)
+ uno::Sequence< rtl::OUString > implGetElementNames(NodeAccess& rNode)
throw( uno::RuntimeException);
- sal_Bool implHasByName(NodeAccess& rNode, const OUString& aName )
+ sal_Bool implHasByName(NodeAccess& rNode, const rtl::OUString& aName )
throw(uno::RuntimeException);
// XHierarchicalNameAccess
- uno::Any implGetByHierarchicalName(NodeAccess& rNode, const OUString& aName )
+ uno::Any implGetByHierarchicalName(NodeAccess& rNode, const rtl::OUString& aName )
throw(css::container::NoSuchElementException, uno::RuntimeException);
- sal_Bool implHasByHierarchicalName(NodeAccess& rNode, const OUString& aName )
+ sal_Bool implHasByHierarchicalName(NodeAccess& rNode, const rtl::OUString& aName )
throw(uno::RuntimeException);
// XExactName
- OUString implGetExactName(NodeGroupInfoAccess& rNode, const OUString& aApproximateName )
+ rtl::OUString implGetExactName(NodeGroupInfoAccess& rNode, const rtl::OUString& aApproximateName )
throw(uno::RuntimeException);
- OUString implGetExactName(NodeSetInfoAccess& rNode, const OUString& aApproximateName )
+ rtl::OUString implGetExactName(NodeSetInfoAccess& rNode, const rtl::OUString& aApproximateName )
throw(uno::RuntimeException);
// XProperty
@@ -112,10 +111,10 @@ namespace configmgr
uno::Sequence< css::beans::Property > implGetProperties( NodeAccess& rNode )
throw (uno::RuntimeException);
- css::beans::Property implGetPropertyByName( NodeAccess& rNode, const OUString& aName )
+ css::beans::Property implGetPropertyByName( NodeAccess& rNode, const rtl::OUString& aName )
throw (css::beans::UnknownPropertyException, uno::RuntimeException);
- sal_Bool implHasPropertyByName( NodeAccess& rNode, const OUString& Name )
+ sal_Bool implHasPropertyByName( NodeAccess& rNode, const rtl::OUString& name )
throw (uno::RuntimeException);
@@ -129,7 +128,7 @@ namespace configmgr
// set-specific interfaces
// XTemplateContainer
- OUString SAL_CALL implGetElementTemplateName(NodeSetInfoAccess& rNode)
+ rtl::OUString SAL_CALL implGetElementTemplateName(NodeSetInfoAccess& rNode)
throw(uno::RuntimeException);
}
diff --git a/configmgr/source/api2/apiaccessobj.hxx b/configmgr/source/api2/apiaccessobj.hxx
index 2af7fcb930..0dae110bf8 100644
--- a/configmgr/source/api2/apiaccessobj.hxx
+++ b/configmgr/source/api2/apiaccessobj.hxx
@@ -46,40 +46,29 @@ namespace configmgr
namespace configapi
{
//-----------------------------------------------------------------------------
- using configuration::Tree;
- using configuration::NodeRef;
-
-//-----------------------------------------------------------------------------
// Inner Elements
//-----------------------------------------------------------------------------
template <class NodeClass>
class OInnerElement : public InnerElement, public NodeClass
{
- static ServiceInfo const*const s_pServiceInfo;
+ static ServiceImplementationInfo const*const s_pServiceInfo;
- UnoInterface* m_pUnoThis;
+ uno::XInterface* m_pUnoThis;
ApiTreeImpl& m_rTree;
- NodeRef m_aNode;
+ configuration::NodeRef m_aNode;
public:
- inline OInnerElement(UnoInterface* pUnoThis,ApiTreeImpl& rTree, NodeRef const& aNode);
+ inline OInnerElement(uno::XInterface* pUnoThis,ApiTreeImpl& rTree, configuration::NodeRef const& aNode);
inline ~OInnerElement();
- virtual inline NodeRef doGetNode() const;
+ virtual inline configuration::NodeRef doGetNode() const;
virtual inline ApiTreeImpl& getApiTree() const;
- virtual inline UnoInterface* doGetUnoInstance() const;
- virtual inline ServiceInfo const* doGetServiceInfo() const;
+ virtual inline uno::XInterface* doGetUnoInstance() const;
+ virtual inline ServiceImplementationInfo const* doGetServiceInfo() const;
- static inline ServiceInfo const* getStaticServiceInfo();
+ static inline ServiceImplementationInfo const* getStaticServiceInfo();
};
- //-------------------------------------------------------------------------
-
- typedef OInnerElement<NodeGroupInfoAccess> OInnerGroupInfoAccess;
- typedef OInnerElement<NodeGroupAccess> OInnerGroupUpdateAccess;
- typedef OInnerElement<NodeSetInfoAccess> OInnerSetInfoAccess;
- typedef OInnerElement<NodeTreeSetAccess> OInnerTreeSetUpdateAccess;
- typedef OInnerElement<NodeValueSetAccess> OInnerValueSetUpdateAccess;
//-----------------------------------------------------------------------------
// Set Elements
@@ -88,35 +77,26 @@ namespace configmgr
template <class NodeClass>
class OSetElement : public SetElement, public NodeClass
{
- static ServiceInfo const*const s_pServiceInfo;
+ static ServiceImplementationInfo const*const s_pServiceInfo;
mutable ApiTreeImpl m_aTree;
public:
- OSetElement(UnoInterface* pUnoThis, configuration::TreeRef const& aTree, ApiTreeImpl& rParentTree)
+ OSetElement(uno::XInterface* pUnoThis, rtl::Reference< configuration::Tree > const& aTree, ApiTreeImpl& rParentTree)
: m_aTree(pUnoThis, aTree,rParentTree)
{}
- OSetElement(UnoInterface* pUnoThis, configuration::TreeRef const& aTree, ApiProvider& rProvider, ApiTreeImpl* pParentTree = 0)
+ OSetElement(uno::XInterface* pUnoThis, rtl::Reference< configuration::Tree > const& aTree, ApiProvider& rProvider, ApiTreeImpl* pParentTree = 0)
: m_aTree(pUnoThis, rProvider,aTree,pParentTree)
{}
- virtual inline NodeRef doGetNode() const;
+ virtual inline configuration::NodeRef doGetNode() const;
virtual inline ApiTreeImpl& getApiTree() const;
- virtual inline UnoInterface* doGetUnoInstance() const;
- virtual inline ServiceInfo const* doGetServiceInfo() const;
+ virtual inline uno::XInterface* doGetUnoInstance() const;
+ virtual inline ServiceImplementationInfo const* doGetServiceInfo() const;
- static inline ServiceInfo const* getStaticServiceInfo();
+ static inline ServiceImplementationInfo const* getStaticServiceInfo();
};
- // Set Elements
- //-------------------------------------------------------------------------
-
- typedef OSetElement<NodeGroupInfoAccess> OSetElementGroupInfoAccess;
- typedef OSetElement<NodeGroupAccess> OSetElementGroupUpdateAccess;
- typedef OSetElement<NodeSetInfoAccess> OSetElementSetInfoAccess;
- typedef OSetElement<NodeTreeSetAccess> OSetElementTreeSetUpdateAccess;
- typedef OSetElement<NodeValueSetAccess> OSetElementValueSetUpdateAccess;
-
//-----------------------------------------------------------------------------
// Root Elements
//-----------------------------------------------------------------------------
@@ -124,55 +104,44 @@ namespace configmgr
template <class NodeClass>
class OReadRootElement : public RootElement, public NodeClass
{
- static ServiceInfo const*const s_pServiceInfo;
+ static ServiceImplementationInfo const*const s_pServiceInfo;
mutable ApiRootTreeImpl m_aRootTree;
public:
- OReadRootElement(UnoInterface* pUnoThis, ApiProvider& rProvider, configuration::Tree const& aTree, vos::ORef< OOptions >const& _xOptions)
+ OReadRootElement(uno::XInterface* pUnoThis, ApiProvider& rProvider, rtl::Reference< configuration::Tree > const& aTree, vos::ORef< OOptions >const& _xOptions)
: m_aRootTree(pUnoThis, rProvider,aTree, _xOptions)
{}
- virtual inline NodeRef doGetNode() const;
+ virtual inline configuration::NodeRef doGetNode() const;
virtual inline ApiTreeImpl& getApiTree() const;
virtual inline ApiRootTreeImpl& getRootTree();
- virtual inline UnoInterface* doGetUnoInstance() const;
- virtual inline ServiceInfo const* doGetServiceInfo() const;
+ virtual inline uno::XInterface* doGetUnoInstance() const;
+ virtual inline ServiceImplementationInfo const* doGetServiceInfo() const;
- static inline ServiceInfo const* getStaticServiceInfo();
+ static inline ServiceImplementationInfo const* getStaticServiceInfo();
};
//-------------------------------------------------------------------------
template <class NodeClass>
class OUpdateRootElement : public UpdateRootElement, public NodeClass
{
- static ServiceInfo const*const s_pServiceInfo;
+ static ServiceImplementationInfo const*const s_pServiceInfo;
mutable ApiRootTreeImpl m_aRootTree;
public:
- OUpdateRootElement(UnoInterface* pUnoThis, ApiProvider& rProvider, configuration::Tree const& aTree, vos::ORef< OOptions >const& _xOptions)
+ OUpdateRootElement(uno::XInterface* pUnoThis, ApiProvider& rProvider, rtl::Reference< configuration::Tree > const& aTree, vos::ORef< OOptions >const& _xOptions)
: m_aRootTree(pUnoThis, rProvider,aTree,_xOptions)
{}
- virtual inline NodeRef doGetNode() const;
+ virtual inline configuration::NodeRef doGetNode() const;
virtual inline ApiTreeImpl& getApiTree() const;
virtual inline ApiRootTreeImpl& getRootTree();
- virtual inline UnoInterface* doGetUnoInstance() const;
- virtual inline ServiceInfo const* doGetServiceInfo() const;
+ virtual inline uno::XInterface* doGetUnoInstance() const;
+ virtual inline ServiceImplementationInfo const* doGetServiceInfo() const;
- static inline ServiceInfo const* getStaticServiceInfo();
+ static inline ServiceImplementationInfo const* getStaticServiceInfo();
};
-
- // Root Elements
- //-------------------------------------------------------------------------
-
- typedef OReadRootElement<NodeGroupInfoAccess> ORootElementGroupInfoAccess;
- typedef OUpdateRootElement<NodeGroupAccess> ORootElementGroupUpdateAccess;
- typedef OReadRootElement<NodeSetInfoAccess> ORootElementSetInfoAccess;
- typedef OUpdateRootElement<NodeTreeSetAccess> ORootElementTreeSetUpdateAccess;
- typedef OUpdateRootElement<NodeValueSetAccess> ORootElementValueSetUpdateAccess;
-
-//-----------------------------------------------------------------------------
}
}
//-----------------------------------------------------------------------------
diff --git a/configmgr/source/api2/apiaccessobj.inl b/configmgr/source/api2/apiaccessobj.inl
index 7929de63bd..1f1eaf2c21 100644
--- a/configmgr/source/api2/apiaccessobj.inl
+++ b/configmgr/source/api2/apiaccessobj.inl
@@ -43,7 +43,7 @@ namespace configmgr
//-----------------------------------------------------------------------------
template <class NodeClass>
-OInnerElement<NodeClass>::OInnerElement(UnoInterface* pUnoThis,ApiTreeImpl& rTree, NodeRef const& aNode)
+OInnerElement<NodeClass>::OInnerElement(uno::XInterface* pUnoThis,ApiTreeImpl& rTree, configuration::NodeRef const& aNode)
: m_pUnoThis(pUnoThis)
, m_rTree(rTree)
, m_aNode(aNode)
@@ -60,7 +60,7 @@ OInnerElement<NodeClass>::~OInnerElement()
//-----------------------------------------------------------------------------
template <class NodeClass>
-NodeRef OInnerElement<NodeClass>::doGetNode() const
+configuration::NodeRef OInnerElement<NodeClass>::doGetNode() const
{
return m_aNode;
}
@@ -74,7 +74,7 @@ ApiTreeImpl& OInnerElement<NodeClass>::getApiTree() const
//-----------------------------------------------------------------------------
template <class NodeClass>
-UnoInterface* OInnerElement<NodeClass>::doGetUnoInstance() const
+uno::XInterface* OInnerElement<NodeClass>::doGetUnoInstance() const
{
return m_pUnoThis;
}
@@ -99,9 +99,9 @@ ServiceImplementationInfo const* OInnerElement<NodeClass>::getStaticServiceInfo(
//-----------------------------------------------------------------------------
template <class NodeClass>
-NodeRef OSetElement<NodeClass>::doGetNode() const
+configuration::NodeRef OSetElement<NodeClass>::doGetNode() const
{
- return m_aTree.getTree().getRootNode();
+ return m_aTree.getTree()->getRootNode();
}
//-----------------------------------------------------------------------------
@@ -113,7 +113,7 @@ ApiTreeImpl& OSetElement<NodeClass>::getApiTree() const
//-----------------------------------------------------------------------------
template <class NodeClass>
-UnoInterface* OSetElement<NodeClass>::doGetUnoInstance() const
+uno::XInterface* OSetElement<NodeClass>::doGetUnoInstance() const
{
return m_aTree.getUnoInstance();
}
@@ -138,9 +138,9 @@ ServiceImplementationInfo const* OSetElement<NodeClass>::getStaticServiceInfo()
//-----------------------------------------------------------------------------
template <class NodeClass>
-NodeRef OReadRootElement<NodeClass>::doGetNode() const
+configuration::NodeRef OReadRootElement<NodeClass>::doGetNode() const
{
- return m_aRootTree.getApiTree().getTree().getRootNode();
+ return m_aRootTree.getApiTree().getTree()->getRootNode();
}
//-----------------------------------------------------------------------------
@@ -159,7 +159,7 @@ ApiRootTreeImpl& OReadRootElement<NodeClass>::getRootTree()
//-----------------------------------------------------------------------------
template <class NodeClass>
-UnoInterface* OReadRootElement<NodeClass>::doGetUnoInstance() const
+uno::XInterface* OReadRootElement<NodeClass>::doGetUnoInstance() const
{
return m_aRootTree.getApiTree().getUnoInstance();
}
@@ -184,9 +184,9 @@ ServiceImplementationInfo const* OReadRootElement<NodeClass>::getStaticServiceIn
//-----------------------------------------------------------------------------
template <class NodeClass>
-NodeRef OUpdateRootElement<NodeClass>::doGetNode() const
+configuration::NodeRef OUpdateRootElement<NodeClass>::doGetNode() const
{
- return m_aRootTree.getApiTree().getTree().getRootNode();
+ return m_aRootTree.getApiTree().getTree()->getRootNode();
}
//-----------------------------------------------------------------------------
@@ -205,7 +205,7 @@ ApiRootTreeImpl& OUpdateRootElement<NodeClass>::getRootTree()
//-----------------------------------------------------------------------------
template <class NodeClass>
-UnoInterface* OUpdateRootElement<NodeClass>::doGetUnoInstance() const
+uno::XInterface* OUpdateRootElement<NodeClass>::doGetUnoInstance() const
{
return m_aRootTree.getApiTree().getUnoInstance();
}
diff --git a/configmgr/source/api2/apifactory.cxx b/configmgr/source/api2/apifactory.cxx
index f4680edb37..457a11a963 100644
--- a/configmgr/source/api2/apifactory.cxx
+++ b/configmgr/source/api2/apifactory.cxx
@@ -56,19 +56,6 @@ namespace configmgr
namespace configapi
{
//-----------------------------------------------------------------------------
- typedef uno::XInterface UnoInterface;
- typedef uno::Reference< uno::XInterface > UnoInterfaceRef;
- typedef uno::Any UnoAny;
-
- using uno::Reference;
- using lang::XUnoTunnel;
- using configuration::Tree;
- using configuration::ElementTree;
- using configuration::TemplateHolder;
- using configuration::NodeRef;
- using configuration::NodeID;
-
-//-----------------------------------------------------------------------------
ObjectRegistry::~ObjectRegistry()
{
OSL_ENSURE(m_aMap.empty(),"WARNING: Configuration Object Map: Some Objects were not revoked correctly");
@@ -76,7 +63,7 @@ ObjectRegistry::~ObjectRegistry()
//-----------------------------------------------------------------------------
-Factory::Factory(ObjectRegistryHolder pRegistry)
+Factory::Factory(rtl::Reference<ObjectRegistry> pRegistry)
: m_pRegistry(pRegistry)
, m_aTunnelID()
{
@@ -114,12 +101,12 @@ ApiTreeImpl& Factory::getImplementation(NodeElement& rElement)
//-----------------------------------------------------------------------------
inline
-TemplateHolder Factory::implGetSetElementTemplate(Tree const& aTree, NodeRef const& aNode)
+rtl::Reference<configuration::Template> Factory::implGetSetElementTemplate(rtl::Reference< configuration::Tree > const& aTree, configuration::NodeRef const& aNode)
{
- TemplateHolder aRet;
+ rtl::Reference<configuration::Template> aRet;
if (configuration::isSetNode(aTree,aNode))
{
- aRet = configuration::SetElementInfo::extractElementInfo(aTree,aNode);
+ aRet = aTree->extractElementInfo(aNode);
}
else if (!configuration::isGroupNode(aTree,aNode))
{
@@ -130,16 +117,16 @@ TemplateHolder Factory::implGetSetElementTemplate(Tree const& aTree, NodeRef con
}
//-----------------------------------------------------------------------------
inline
-UnoInterfaceRef Factory::implToUno(NodeElement* pElement)
+uno::Reference< uno::XInterface > Factory::implToUno(NodeElement* pElement)
{
if ( pElement )
- return UnoInterfaceRef(pElement->getUnoInstance(), uno::UNO_REF_NO_ACQUIRE);
+ return uno::Reference< uno::XInterface >(pElement->getUnoInstance(), uno::UNO_REF_NO_ACQUIRE);
else
- return UnoInterfaceRef();
+ return uno::Reference< uno::XInterface >();
}
//-----------------------------------------------------------------------------
inline
-void Factory::implHaveNewElement(NodeID aNodeID, NodeElement* pElement)
+void Factory::implHaveNewElement(configuration::NodeID aNodeID, NodeElement* pElement)
{
OSL_ENSURE(pElement ,"WARNING: New API object could not be created");
@@ -151,40 +138,40 @@ void Factory::implHaveNewElement(NodeID aNodeID, NodeElement* pElement)
}
//-----------------------------------------------------------------------------
-UnoInterfaceRef Factory::makeUnoElement(Tree const& aTree, NodeRef const& aNode)
+uno::Reference< uno::XInterface > Factory::makeUnoElement(rtl::Reference< configuration::Tree > const& aTree, configuration::NodeRef const& aNode)
{
return implToUno(makeElement(aTree,aNode));
}
//-----------------------------------------------------------------------------
-NodeElement* Factory::makeElement(Tree const& aTree, NodeRef const& aNode)
+NodeElement* Factory::makeElement(rtl::Reference< configuration::Tree > const& aTree, configuration::NodeRef const& aNode)
{
- OSL_PRECOND( !aTree.isEmpty() == aNode.isValid(), "ERROR: Configuration: Making element from tree requires valid node");
- if (aTree.isEmpty())
+ OSL_PRECOND( !configuration::isEmpty(aTree.get()) == aNode.isValid(), "ERROR: Configuration: Making element from tree requires valid node");
+ if (configuration::isEmpty(aTree.get()))
return 0;
- OSL_PRECOND( aTree.isValidNode(aNode), "ERROR: Configuration: NodeRef does not match Tree");
+ OSL_PRECOND( aNode.isValid() && aTree->isValidNode(aNode.getOffset()), "ERROR: Configuration: NodeRef does not match Tree");
OSL_PRECOND( configuration::isStructuralNode(aTree,aNode), "ERROR: Configuration: Cannot make object for value node");
- NodeID aNodeID(aTree,aNode);
+ configuration::NodeID aNodeID(aTree,aNode);
NodeElement* pRet = findElement(aNodeID);
if (pRet == 0)
{
- TemplateHolder aTemplate = implGetSetElementTemplate(aTree,aNode);
+ rtl::Reference<configuration::Template> aTemplate = implGetSetElementTemplate(aTree,aNode);
- if (!aTree.isRootNode(aNode))
+ if (!aTree->isRootNode(aNode))
{
pRet = doCreateGroupMember(aTree,aNode,aTemplate.get());
}
else
{
- ElementTree aElementTree = ElementTree::extract(aTree);
- if (aElementTree.isValid())
+ rtl::Reference< configuration::ElementTree > aElementTree(dynamic_cast< configuration::ElementTree * >(aTree.get()));
+ if (aElementTree.is())
{
pRet = doCreateSetElement(aElementTree,aTemplate.get());
}
else
{
- OSL_ENSURE(aTree.getContextTree().isEmpty(),"INTERNAL ERROR: Found tree (not a set element) with a parent tree.");
+ OSL_ENSURE(configuration::isEmpty(aTree->getContextTree()),"INTERNAL ERROR: Found tree (not a set element) with a parent tree.");
pRet = doCreateAccessRoot(aTree,aTemplate.get(), vos::ORef< OOptions >());
}
}
@@ -194,12 +181,12 @@ NodeElement* Factory::makeElement(Tree const& aTree, NodeRef const& aNode)
}
//-----------------------------------------------------------------------------
-UnoInterfaceRef Factory::findUnoElement(NodeID const& aNodeID)
+uno::Reference< uno::XInterface > Factory::findUnoElement(configuration::NodeID const& aNodeID)
{
return implToUno(findElement(aNodeID));
}
//-----------------------------------------------------------------------------
-NodeElement* Factory::findElement(NodeID const& aNodeID)
+NodeElement* Factory::findElement(configuration::NodeID const& aNodeID)
{
NodeElement* pReturn = implFind(aNodeID);
if (pReturn) pReturn->getUnoInstance()->acquire();
@@ -207,32 +194,32 @@ NodeElement* Factory::findElement(NodeID const& aNodeID)
}
//-----------------------------------------------------------------------------
-void Factory::revokeElement(NodeID const& aNodeID)
+void Factory::revokeElement(configuration::NodeID const& aNodeID)
{
if (NodeElement* pElement = implFind(aNodeID))
doRevokeElement(aNodeID, pElement);
}
//-----------------------------------------------------------------------------
-TreeElement* Factory::makeAccessRoot(Tree const& aTree, RequestOptions const& _aOptions)
+TreeElement* Factory::makeAccessRoot(rtl::Reference< configuration::Tree > const& aTree, RequestOptions const& _aOptions)
{
- OSL_PRECOND( !aTree.isEmpty() , "ERROR: Configuration: Making element from tree requires valid tree");
- if (aTree.isEmpty()) return 0;
+ OSL_PRECOND( !configuration::isEmpty(aTree.get()) , "ERROR: Configuration: Making element from tree requires valid tree");
+ if (configuration::isEmpty(aTree.get())) return 0;
- OSL_ENSURE(aTree.getContextTree().isEmpty(),"INTERNAL ERROR: Tree with parent tree should not be used for an access root");
- OSL_ENSURE(!ElementTree::extract(aTree).isValid(),"INTERNAL ERROR: Element Tree should not be used for an access root");
+ OSL_ENSURE(configuration::isEmpty(aTree->getContextTree()),"INTERNAL ERROR: Tree with parent tree should not be used for an access root");
+ OSL_ENSURE(dynamic_cast< configuration::ElementTree * >(aTree.get()) == 0, "INTERNAL ERROR: Element Tree should not be used for an access root");
- NodeRef aRoot = aTree.getRootNode();
+ configuration::NodeRef aRoot = aTree->getRootNode();
OSL_ENSURE(aRoot.isValid(),"INTERNAL ERROR: Tree has no root node");
OSL_PRECOND( configuration::isStructuralNode(aTree,aRoot), "ERROR: Configuration: Cannot make object for value node");
- NodeID aNodeID(aTree,aRoot);
+ configuration::NodeID aNodeID(aTree,aRoot);
// must be a tree element if it is a tree root
TreeElement* pRet = static_cast<TreeElement*>(findElement(aNodeID));
if (0 == pRet)
{
- TemplateHolder aTemplate = implGetSetElementTemplate(aTree,aRoot);
+ rtl::Reference<configuration::Template> aTemplate = implGetSetElementTemplate(aTree,aRoot);
vos::ORef<OOptions> xOptions = new OOptions(_aOptions);
pRet = doCreateAccessRoot(aTree,aTemplate.get(), xOptions);
implHaveNewElement (aNodeID,pRet);
@@ -241,28 +228,28 @@ TreeElement* Factory::makeAccessRoot(Tree const& aTree, RequestOptions const& _a
}
//-----------------------------------------------------------------------------
-UnoInterfaceRef Factory::makeUnoGroupMember(Tree const& aTree, NodeRef const& aNode)
+uno::Reference< uno::XInterface > Factory::makeUnoGroupMember(rtl::Reference< configuration::Tree > const& aTree, configuration::NodeRef const& aNode)
{
return implToUno(makeGroupMember(aTree,aNode));
}
//-----------------------------------------------------------------------------
-NodeElement* Factory::makeGroupMember(Tree const& aTree, NodeRef const& aNode)
+NodeElement* Factory::makeGroupMember(rtl::Reference< configuration::Tree > const& aTree, configuration::NodeRef const& aNode)
{
- OSL_PRECOND( !aTree.isEmpty() , "ERROR: Configuration: Creating an object requires a valid tree");
- if (aTree.isEmpty()) return 0;
+ OSL_PRECOND( !configuration::isEmpty(aTree.get()) , "ERROR: Configuration: Creating an object requires a valid tree");
+ if (configuration::isEmpty(aTree.get())) return 0;
OSL_PRECOND( aNode.isValid() , "ERROR: Configuration: Creating an object requires a valid node");
- OSL_PRECOND( aTree.isValidNode(aNode), "ERROR: Configuration: NodeRef does not match Tree");
- if (!aTree.isValidNode(aNode)) return 0;
+ OSL_PRECOND( aTree->isValidNode(aNode.getOffset()), "ERROR: Configuration: NodeRef does not match Tree");
+ if (!aTree->isValidNode(aNode.getOffset())) return 0;
OSL_PRECOND( configuration::isStructuralNode(aTree,aNode), "ERROR: Configuration: Cannot make object for value node");
- OSL_ENSURE(!aTree.isRootNode(aNode),"INTERNAL ERROR: Root of Tree should not be used for a group member object");
+ OSL_ENSURE(!aTree->isRootNode(aNode),"INTERNAL ERROR: Root of Tree should not be used for a group member object");
- NodeID aNodeID(aTree,aNode);
+ configuration::NodeID aNodeID(aTree,aNode);
NodeElement* pRet = findElement(aNodeID);
if (0 == pRet)
{
- TemplateHolder aTemplate = implGetSetElementTemplate(aTree,aNode);
+ rtl::Reference<configuration::Template> aTemplate = implGetSetElementTemplate(aTree,aNode);
pRet = doCreateGroupMember(aTree,aNode,aTemplate.get());
@@ -274,37 +261,37 @@ NodeElement* Factory::makeGroupMember(Tree const& aTree, NodeRef const& aNode)
}
//-----------------------------------------------------------------------------
-UnoInterfaceRef Factory::makeUnoSetElement(ElementTree const& aElementTree)
+uno::Reference< uno::XInterface > Factory::makeUnoSetElement(rtl::Reference< configuration::ElementTree > const& aElementTree)
{
- UnoInterfaceRef aRet = implToUno(makeSetElement(aElementTree));
- OSL_ENSURE( uno::Reference<XUnoTunnel>::query(aRet).is(),"ERROR: API set element has no UnoTunnel");
- OSL_ENSURE( uno::Reference<XUnoTunnel>::query(aRet).is() &&
- 0 != uno::Reference<XUnoTunnel>::query(aRet)->getSomething(doGetElementTunnelID()),
+ uno::Reference< uno::XInterface > aRet = implToUno(makeSetElement(aElementTree));
+ OSL_ENSURE( uno::Reference<lang::XUnoTunnel>::query(aRet).is(),"ERROR: API set element has no UnoTunnel");
+ OSL_ENSURE( uno::Reference<lang::XUnoTunnel>::query(aRet).is() &&
+ 0 != uno::Reference<lang::XUnoTunnel>::query(aRet)->getSomething(doGetElementTunnelID()),
"ERROR: API set element does not support the right tunnel ID");
return aRet;
}
//-----------------------------------------------------------------------------
-SetElement* Factory::makeSetElement(ElementTree const& aElementTree)
+SetElement* Factory::makeSetElement(rtl::Reference< configuration::ElementTree > const& aElementTree)
{
- OSL_PRECOND( aElementTree.isValid() , "ERROR: Configuration: Making element from tree requires valid tree");
- if (!aElementTree.isValid()) return 0;
+ OSL_PRECOND( aElementTree.is() , "ERROR: Configuration: Making element from tree requires valid tree");
+ if (!aElementTree.is()) return 0;
- Tree aTree = aElementTree.getTree();
- OSL_ENSURE(!aTree.isEmpty(),"INTERNAL ERROR: Element Tree has no Tree");
+ rtl::Reference< configuration::Tree > aTree(aElementTree.get());
+ OSL_ENSURE(!configuration::isEmpty(aTree.get()),"INTERNAL ERROR: Element Tree has no Tree");
- NodeRef aRoot = aTree.getRootNode();
+ configuration::NodeRef aRoot = aTree->getRootNode();
OSL_ENSURE(aRoot.isValid(),"INTERNAL ERROR: Tree has no root node");
OSL_ENSURE( configuration::isStructuralNode(aTree,aRoot), "ERROR: Configuration: Cannot make object for value node");
- NodeID aNodeID(aTree,aRoot);
+ configuration::NodeID aNodeID(aTree,aRoot);
// must be a set element if it wraps a ElementTree
SetElement* pRet = static_cast<SetElement*>( findElement(aNodeID) );
if (0 == pRet)
{
- TemplateHolder aTemplate = implGetSetElementTemplate(aTree,aRoot);
+ rtl::Reference<configuration::Template> aTemplate = implGetSetElementTemplate(aTree,aRoot);
pRet = doCreateSetElement(aElementTree,aTemplate.get());
@@ -314,18 +301,18 @@ SetElement* Factory::makeSetElement(ElementTree const& aElementTree)
}
//-----------------------------------------------------------------------------
-SetElement* Factory::findSetElement(configuration::ElementRef const& aElement)
+SetElement* Factory::findSetElement(rtl::Reference< configuration::ElementTree > const& aElement)
{
- OSL_PRECOND( aElement.isValid() , "ERROR: Configuration: Making element from tree requires valid tree");
- if (!aElement.isValid()) return 0;
+ OSL_PRECOND( aElement.is() , "ERROR: Configuration: Making element from tree requires valid tree");
+ if (!aElement.is()) return 0;
- configuration::TreeRef aTree = aElement.getTreeRef();
- OSL_ENSURE(!aTree.isEmpty(),"INTERNAL ERROR: Element Tree has no Tree");
+ rtl::Reference< configuration::Tree > aTree(aElement.get());
+ OSL_ENSURE(!isEmpty(aTree.get()),"INTERNAL ERROR: Element Tree has no Tree");
- NodeRef aRoot = aTree.getRootNode();
+ configuration::NodeRef aRoot = aTree->getRootNode();
OSL_ENSURE(aRoot.isValid(),"INTERNAL ERROR: Tree has no root node");
- NodeID aNodeID(aTree,aRoot);
+ configuration::NodeID aNodeID(aTree,aRoot);
// must be a set element if it wraps a ElementTree
SetElement* pRet = static_cast<SetElement*>( findElement(aNodeID) );
@@ -333,12 +320,11 @@ SetElement* Factory::findSetElement(configuration::ElementRef const& aElement)
}
//-----------------------------------------------------------------------------
-SetElement* Factory::extractSetElement(UnoAny const& aElement)
+SetElement* Factory::extractSetElement(uno::Any const& aElement)
{
- using configuration::ElementTreeImpl;
SetElement* pTunneledImpl = 0;
- Reference< XUnoTunnel > xElementTunnel;
+ uno::Reference< lang::XUnoTunnel > xElementTunnel;
if ( aElement.hasValue() && (aElement >>= xElementTunnel) )
{
OSL_ASSERT( xElementTunnel.is() );
diff --git a/configmgr/source/api2/apifactory.hxx b/configmgr/source/api2/apifactory.hxx
index f616e7d0fb..1c80fc9655 100644
--- a/configmgr/source/api2/apifactory.hxx
+++ b/configmgr/source/api2/apifactory.hxx
@@ -33,6 +33,7 @@
#include "options.hxx"
#include "utility.hxx"
+#include <boost/utility.hpp>
#include <rtl/ref.hxx>
#include <vos/ref.hxx>
#include <cppuhelper/typeprovider.hxx>
@@ -41,22 +42,15 @@ namespace configmgr
{
namespace configuration
{
- class Name;
class NodeID;
class NodeRef;
- class Tree;
- class ElementRef;
class ElementTree;
-
class Template;
- typedef rtl::Reference<Template> TemplateHolder;
+ class Tree;
}
namespace configapi
{
namespace uno = com::sun::star::uno;
- typedef uno::XInterface UnoInterface;
- typedef uno::Reference< uno::XInterface > UnoInterfaceRef;
- typedef uno::Any UnoAny;
class ApiTreeImpl;
class NodeElement;
@@ -67,44 +61,42 @@ namespace configmgr
// used to register objects
class ObjectRegistry;
- typedef rtl::Reference<ObjectRegistry> ObjectRegistryHolder;
- typedef cppu::OImplementationId UnoTunnelID;
// used to create UNO objects
- class Factory : Noncopyable
+ class Factory : private boost::noncopyable
{
- ObjectRegistryHolder m_pRegistry;
- UnoTunnelID const m_aTunnelID;
+ rtl::Reference<ObjectRegistry> m_pRegistry;
+ cppu::OImplementationId const m_aTunnelID;
private:
/// return the element _without_ acquiring it
NodeElement* implFind(configuration::NodeID const& aNode);
public:
- Factory(ObjectRegistryHolder pRegistry);
+ Factory(rtl::Reference<ObjectRegistry> pRegistry);
virtual ~Factory();
- UnoInterfaceRef makeUnoElement(configuration::Tree const& aTree, configuration::NodeRef const& aNode);
- UnoInterfaceRef findUnoElement(configuration::NodeID const& aNode);
+ uno::Reference< uno::XInterface > makeUnoElement(rtl::Reference< configuration::Tree > const& aTree, configuration::NodeRef const& aNode);
+ uno::Reference< uno::XInterface > findUnoElement(configuration::NodeID const& aNode);
- UnoInterfaceRef makeUnoGroupMember(configuration::Tree const& aTree, configuration::NodeRef const& aNode);
- UnoInterfaceRef makeUnoSetElement(configuration::ElementTree const& aTree);
+ uno::Reference< uno::XInterface > makeUnoGroupMember(rtl::Reference< configuration::Tree > const& aTree, configuration::NodeRef const& aNode);
+ uno::Reference< uno::XInterface > makeUnoSetElement(rtl::Reference< configuration::ElementTree > const& aTree);
- NodeElement* makeElement(configuration::Tree const& aTree, configuration::NodeRef const& aNode);
+ NodeElement* makeElement(rtl::Reference< configuration::Tree > const& aTree, configuration::NodeRef const& aNode);
NodeElement* findElement(configuration::NodeID const& aNode);
- NodeElement* makeGroupMember(configuration::Tree const& aTree, configuration::NodeRef const& aNode);
- TreeElement* makeAccessRoot(configuration::Tree const& aTree, RequestOptions const& _aOptions);
- SetElement* makeSetElement(configuration::ElementTree const& aTree);
+ NodeElement* makeGroupMember(rtl::Reference< configuration::Tree > const& aTree, configuration::NodeRef const& aNode);
+ TreeElement* makeAccessRoot(rtl::Reference< configuration::Tree > const& aTree, RequestOptions const& _aOptions);
+ SetElement* makeSetElement(rtl::Reference< configuration::ElementTree > const& aTree);
- SetElement* findSetElement(configuration::ElementRef const& aElement);
+ SetElement* findSetElement(rtl::Reference< configuration::ElementTree > const& aElement);
/// check for the existence of an element
sal_Bool hasElement(configuration::NodeID const& _rNode) { return NULL != implFind(_rNode); }
void revokeElement(configuration::NodeID const& aNode);
- SetElement* extractSetElement(UnoAny const& aElement);
+ SetElement* extractSetElement(uno::Any const& aElement);
bool tunnelSetElement(sal_Int64& nSomething, SetElement& rElement, uno::Sequence< sal_Int8 > const& aTunnelID);
// registry operations
@@ -115,14 +107,14 @@ namespace configmgr
uno::Sequence< sal_Int8 > doGetElementTunnelID() const { return m_aTunnelID.getImplementationId(); }
- virtual NodeElement* doCreateGroupMember(configuration::Tree const& aTree, configuration::NodeRef const& aNode, configuration::Template* pSetElementTemplate) = 0;
- virtual TreeElement* doCreateAccessRoot(configuration::Tree const& aTree, configuration::Template* pSetElementTemplate, vos::ORef< OOptions >const& _xOptions) = 0;
- virtual SetElement* doCreateSetElement(configuration::ElementTree const& aTree, configuration::Template* pSetElementTemplate) = 0;
+ virtual NodeElement* doCreateGroupMember(rtl::Reference< configuration::Tree > const& aTree, configuration::NodeRef const& aNode, configuration::Template* pSetElementTemplate) = 0;
+ virtual TreeElement* doCreateAccessRoot(rtl::Reference< configuration::Tree > const& aTree, configuration::Template* pSetElementTemplate, vos::ORef< OOptions >const& _xOptions) = 0;
+ virtual SetElement* doCreateSetElement(rtl::Reference< configuration::ElementTree > const& aTree, configuration::Template* pSetElementTemplate) = 0;
static ApiTreeImpl& getImplementation(NodeElement& pElement);
private:
- static configuration::TemplateHolder implGetSetElementTemplate(configuration::Tree const& aTree, configuration::NodeRef const& aNode);
- static UnoInterfaceRef implToUno(NodeElement* pNode);
+ static rtl::Reference<configuration::Template> implGetSetElementTemplate(rtl::Reference< configuration::Tree > const& aTree, configuration::NodeRef const& aNode);
+ static uno::Reference< uno::XInterface > implToUno(NodeElement* pNode);
void implHaveNewElement(configuration::NodeID aNodeID, NodeElement* pNode);
};
diff --git a/configmgr/source/api2/apifactoryimpl.cxx b/configmgr/source/api2/apifactoryimpl.cxx
index 85bea01e69..8a64373153 100644
--- a/configmgr/source/api2/apifactoryimpl.cxx
+++ b/configmgr/source/api2/apifactoryimpl.cxx
@@ -47,13 +47,11 @@ namespace configmgr
{
namespace configapi
{
- using configuration::Template;
- using configuration::NodeID;
//-----------------------------------------------------------------------------
// class ReadOnlyObjectFactory
//-----------------------------------------------------------------------------
-ReadOnlyObjectFactory::ReadOnlyObjectFactory(ApiProvider& rProvider,ObjectRegistryHolder pRegistry)
+ReadOnlyObjectFactory::ReadOnlyObjectFactory(ApiProvider& rProvider,rtl::Reference<ObjectRegistry> pRegistry)
: Factory(pRegistry)
, m_rProvider(rProvider)
{
@@ -65,21 +63,21 @@ ReadOnlyObjectFactory::~ReadOnlyObjectFactory()
}
//-----------------------------------------------------------------------------
-NodeElement* ReadOnlyObjectFactory::doCreateGroupMember(configuration::Tree const& aTree, configuration::NodeRef const& aNode, Template* pSetElementTemplate)
+NodeElement* ReadOnlyObjectFactory::doCreateGroupMember(rtl::Reference< configuration::Tree > const& aTree, configuration::NodeRef const& aNode, configuration::Template* pSetElementTemplate)
{
- OSL_ENSURE(!aTree.isEmpty(), "ERROR: trying to create a group member without a tree");
+ OSL_ENSURE(!configuration::isEmpty(aTree.get()), "ERROR: trying to create a group member without a tree");
OSL_ENSURE(aNode.isValid(), "ERROR: trying to create a group member without a node");
- OSL_ENSURE(aTree.isValidNode(aNode), "ERROR: node does not match tree , while trying to create a group member");
- OSL_ENSURE(!aTree.isRootNode(aNode), "ERROR: trying to create a group member on a root node");
- if (aTree.isRootNode(aNode))
+ OSL_ENSURE(aTree->isValidNode(aNode.getOffset()), "ERROR: node does not match tree , while trying to create a group member");
+ OSL_ENSURE(!aTree->isRootNode(aNode), "ERROR: trying to create a group member on a root node");
+ if (aTree->isRootNode(aNode))
return 0;
- NodeElement* pRootElement = makeElement(aTree,aTree.getRootNode());
+ NodeElement* pRootElement = makeElement(aTree,aTree->getRootNode());
OSL_ENSURE(pRootElement, "Could not create root element of tree - cannot create group member object");
if (!pRootElement)
return 0;
- UnoInterfaceRef aRootRelease(pRootElement->getUnoInstance(), uno::UNO_REF_NO_ACQUIRE);
+ uno::Reference<uno::XInterface> aRootRelease(pRootElement->getUnoInstance(), uno::UNO_REF_NO_ACQUIRE);
ApiTreeImpl& rRootContext = getImplementation(*pRootElement);
NodeElement * pResult = 0;
@@ -100,9 +98,9 @@ NodeElement* ReadOnlyObjectFactory::doCreateGroupMember(configuration::Tree cons
}
//-----------------------------------------------------------------------------
-TreeElement* ReadOnlyObjectFactory::doCreateAccessRoot(configuration::Tree const& aTree, Template* pSetElementTemplate, vos::ORef< OOptions >const& _xOptions)
+TreeElement* ReadOnlyObjectFactory::doCreateAccessRoot(rtl::Reference< configuration::Tree > const& aTree, configuration::Template* pSetElementTemplate, vos::ORef< OOptions >const& _xOptions)
{
- OSL_ENSURE(!aTree.isEmpty(), "ERROR: trying to create a root object without a tree");
+ OSL_ENSURE(!configuration::isEmpty(aTree.get()), "ERROR: trying to create a root object without a tree");
TreeElement * pResult = 0;
if (!pSetElementTemplate)
@@ -121,24 +119,24 @@ TreeElement* ReadOnlyObjectFactory::doCreateAccessRoot(configuration::Tree const
}
//-----------------------------------------------------------------------------
-SetElement* ReadOnlyObjectFactory::doCreateSetElement(configuration::ElementTree const& aElementTree, Template* pSetElementTemplate)
+SetElement* ReadOnlyObjectFactory::doCreateSetElement(rtl::Reference< configuration::ElementTree > const& aElementTree, configuration::Template* pSetElementTemplate)
{
- OSL_ENSURE(aElementTree.isValid(), "ERROR: trying to create a set element object without a tree");
+ OSL_ENSURE(aElementTree.is(), "ERROR: trying to create a set element object without a tree");
- Tree aTree( aElementTree.getTree() );
- OSL_ENSURE(!aTree.isEmpty(), "ERROR: trying to create a set element object without a tree");
+ rtl::Reference< configuration::Tree > aTree( aElementTree.get() );
+ OSL_ENSURE(!configuration::isEmpty(aTree.get()), "ERROR: trying to create a set element object without a tree");
ApiTreeImpl * pParentContext = 0;
- UnoInterfaceRef aParentRelease;
+ uno::Reference<uno::XInterface> aParentRelease;
- configuration::Tree aParentTree = aTree.getContextTree();
- if (!aParentTree.isEmpty())
+ rtl::Reference< configuration::Tree > aParentTree = aTree->getContextTree();
+ if (!configuration::isEmpty(aParentTree.get()))
{
- //NodeRef aParentNode = aTree.getContextNode();
- NodeRef aParentRoot = aParentTree.getRootNode();
+ //configuration::NodeRef aParentNode = aTree.getContextNode();
+ configuration::NodeRef aParentRoot = aParentTree->getRootNode();
if (NodeElement* pParentRootElement = makeElement(aParentTree,aParentRoot) )
{
- aParentRelease = UnoInterfaceRef(pParentRootElement->getUnoInstance(), uno::UNO_REF_NO_ACQUIRE);
+ aParentRelease = uno::Reference<uno::XInterface>(pParentRootElement->getUnoInstance(), uno::UNO_REF_NO_ACQUIRE);
pParentContext = &getImplementation(*pParentRootElement);
}
}
@@ -146,13 +144,13 @@ SetElement* ReadOnlyObjectFactory::doCreateSetElement(configuration::ElementTree
SetElement * pResult = 0;
if (!pSetElementTemplate)
{
- OSetElementGroupInfo * pNewObject = new OSetElementGroupInfo(aTree.getRef(),m_rProvider,pParentContext);
+ OSetElementGroupInfo * pNewObject = new OSetElementGroupInfo(aTree,m_rProvider,pParentContext);
pNewObject->acquire();
pResult = &pNewObject->getElementClass();
}
else
{
- OSetElementSetInfo * pNewObject = new OSetElementSetInfo(aTree.getRef(),m_rProvider,pParentContext);
+ OSetElementSetInfo * pNewObject = new OSetElementSetInfo(aTree,m_rProvider,pParentContext);
pNewObject->acquire();
pResult = &pNewObject->getElementClass();
}
@@ -164,7 +162,7 @@ SetElement* ReadOnlyObjectFactory::doCreateSetElement(configuration::ElementTree
// class UpdateObjectFactory
//-----------------------------------------------------------------------------
-UpdateObjectFactory::UpdateObjectFactory(ApiProvider& rProvider,ObjectRegistryHolder pRegistry)
+UpdateObjectFactory::UpdateObjectFactory(ApiProvider& rProvider,rtl::Reference<ObjectRegistry> pRegistry)
: Factory(pRegistry)
, m_rProvider(rProvider)
{
@@ -176,28 +174,28 @@ UpdateObjectFactory::~UpdateObjectFactory()
}
//-----------------------------------------------------------------------------
-bool UpdateObjectFactory::implIsReadOnly(configuration::Tree const& aTree, configuration::NodeRef const& aNode)
+bool UpdateObjectFactory::implIsReadOnly(rtl::Reference< configuration::Tree > const& aTree, configuration::NodeRef const& aNode)
{
- OSL_ENSURE(!aTree.isEmpty(), "ERROR: trying to create an object without a tree");
+ OSL_ENSURE(!configuration::isEmpty(aTree.get()), "ERROR: trying to create an object without a tree");
OSL_ENSURE(aNode.isValid(), "ERROR: trying to create an object without a node");
- OSL_ENSURE(aTree.isValidNode(aNode), "ERROR: node does not match tree , while trying to create an object");
+ OSL_ENSURE(aTree->isValidNode(aNode.getOffset()), "ERROR: node does not match tree , while trying to create an object");
- return aTree.getAttributes(aNode).isReadonly();
+ return aTree->getAttributes(aNode).isReadonly();
}
//-----------------------------------------------------------------------------
-NodeElement* UpdateObjectFactory::doCreateGroupMember(configuration::Tree const& aTree, configuration::NodeRef const& aNode, Template* pSetElementTemplate)
+NodeElement* UpdateObjectFactory::doCreateGroupMember(rtl::Reference< configuration::Tree > const& aTree, configuration::NodeRef const& aNode, configuration::Template* pSetElementTemplate)
{
- OSL_ENSURE(!aTree.isEmpty(), "ERROR: trying to create a group member without a tree");
+ OSL_ENSURE(!configuration::isEmpty(aTree.get()), "ERROR: trying to create a group member without a tree");
OSL_ENSURE(aNode.isValid(), "ERROR: trying to create a group member without a node");
- OSL_ENSURE(aTree.isValidNode(aNode), "ERROR: node does not match tree , while trying to create a group");
+ OSL_ENSURE(aTree->isValidNode(aNode.getOffset()), "ERROR: node does not match tree , while trying to create a group");
- NodeElement* pRootElement = makeElement(aTree,aTree.getRootNode());
+ NodeElement* pRootElement = makeElement(aTree,aTree->getRootNode());
OSL_ENSURE(pRootElement, "Could not create root element of tree - cannot create group member object");
if (!pRootElement)
return 0;
- UnoInterfaceRef aRootRelease(pRootElement->getUnoInstance(), uno::UNO_REF_NO_ACQUIRE);
+ uno::Reference<uno::XInterface> aRootRelease(pRootElement->getUnoInstance(), uno::UNO_REF_NO_ACQUIRE);
ApiTreeImpl& rRootContext = getImplementation(*pRootElement);
NodeElement * pResult = 0;
@@ -243,12 +241,12 @@ NodeElement* UpdateObjectFactory::doCreateGroupMember(configuration::Tree const&
}
//-----------------------------------------------------------------------------
-TreeElement* UpdateObjectFactory::doCreateAccessRoot(configuration::Tree const& aTree, Template* pSetElementTemplate, vos::ORef< OOptions >const& _xOptions)
+TreeElement* UpdateObjectFactory::doCreateAccessRoot(rtl::Reference< configuration::Tree > const& aTree, configuration::Template* pSetElementTemplate, vos::ORef< OOptions >const& _xOptions)
{
- OSL_ENSURE(!aTree.isEmpty(), "ERROR: trying to create a root object without a tree");
+ OSL_ENSURE(!configuration::isEmpty(aTree.get()), "ERROR: trying to create a root object without a tree");
TreeElement * pResult = 0;
- if (implIsReadOnly(aTree,aTree.getRootNode()))
+ if (implIsReadOnly(aTree,aTree->getRootNode()))
{
OSL_ENSURE(false, "WARNING: Trying to create an 'Update Access' on a read-only tree/node");
if (!pSetElementTemplate)
@@ -290,40 +288,40 @@ TreeElement* UpdateObjectFactory::doCreateAccessRoot(configuration::Tree const&
}
//-----------------------------------------------------------------------------
-SetElement* UpdateObjectFactory::doCreateSetElement(configuration::ElementTree const& aElementTree, Template* pSetElementTemplate)
+SetElement* UpdateObjectFactory::doCreateSetElement(rtl::Reference< configuration::ElementTree > const& aElementTree, configuration::Template* pSetElementTemplate)
{
- OSL_ENSURE(aElementTree.isValid(), "ERROR: trying to create a set element object without a tree");
+ OSL_ENSURE(aElementTree.is(), "ERROR: trying to create a set element object without a tree");
- Tree aTree( aElementTree.getTree() );
- OSL_ENSURE(!aTree.isEmpty(), "ERROR: trying to create a set element object without a tree");
+ rtl::Reference< configuration::Tree > aTree( aElementTree.get() );
+ OSL_ENSURE(!configuration::isEmpty(aTree.get()), "ERROR: trying to create a set element object without a tree");
ApiTreeImpl * pParentContext = 0;
- UnoInterfaceRef aParentRelease;
+ uno::Reference<uno::XInterface> aParentRelease;
- configuration::Tree aParentTree = aTree.getContextTree();
- if (!aParentTree.isEmpty())
+ rtl::Reference< configuration::Tree > aParentTree = aTree->getContextTree();
+ if (!configuration::isEmpty(aParentTree.get()))
{
- //NodeRef aParentNode = aTree.getContextNode();
- NodeRef aParentRoot = aParentTree.getRootNode();
+ //configuration::NodeRef aParentNode = aTree.getContextNode();
+ configuration::NodeRef aParentRoot = aParentTree->getRootNode();
if (NodeElement* pParentRootElement = makeElement(aParentTree,aParentRoot) )
{
- aParentRelease = UnoInterfaceRef(pParentRootElement->getUnoInstance(), uno::UNO_REF_NO_ACQUIRE);
+ aParentRelease = uno::Reference<uno::XInterface>(pParentRootElement->getUnoInstance(), uno::UNO_REF_NO_ACQUIRE);
pParentContext = &getImplementation(*pParentRootElement);
}
}
SetElement * pResult = 0;
- if (implIsReadOnly(aTree,aTree.getRootNode()))
+ if (implIsReadOnly(aTree,aTree->getRootNode()))
{
if (!pSetElementTemplate)
{
- OSetElementGroupInfo * pNewObject = new OSetElementGroupInfo(aTree.getRef(),m_rProvider,pParentContext);
+ OSetElementGroupInfo * pNewObject = new OSetElementGroupInfo(aTree,m_rProvider,pParentContext);
pNewObject->acquire();
pResult = &pNewObject->getElementClass();
}
else
{
- OSetElementSetInfo * pNewObject = new OSetElementSetInfo(aTree.getRef(),m_rProvider,pParentContext);
+ OSetElementSetInfo * pNewObject = new OSetElementSetInfo(aTree,m_rProvider,pParentContext);
pNewObject->acquire();
pResult = &pNewObject->getElementClass();
}
@@ -332,19 +330,19 @@ SetElement* UpdateObjectFactory::doCreateSetElement(configuration::ElementTree c
{
if (!pSetElementTemplate)
{
- OSetElementGroupUpdate * pNewObject = new OSetElementGroupUpdate(aTree.getRef(),m_rProvider,pParentContext);
+ OSetElementGroupUpdate * pNewObject = new OSetElementGroupUpdate(aTree,m_rProvider,pParentContext);
pNewObject->acquire();
pResult = &pNewObject->getElementClass();
}
else if (pSetElementTemplate->isInstanceValue())
{
- OSetElementValueSetUpdate * pNewObject = new OSetElementValueSetUpdate(aTree.getRef(),m_rProvider,pParentContext);
+ OSetElementValueSetUpdate * pNewObject = new OSetElementValueSetUpdate(aTree,m_rProvider,pParentContext);
pNewObject->acquire();
pResult = &pNewObject->getElementClass();
}
else
{
- OSetElementTreeSetUpdate * pNewObject = new OSetElementTreeSetUpdate(aTree.getRef(),m_rProvider,pParentContext);
+ OSetElementTreeSetUpdate * pNewObject = new OSetElementTreeSetUpdate(aTree,m_rProvider,pParentContext);
pNewObject->acquire();
pResult = &pNewObject->getElementClass();
}
diff --git a/configmgr/source/api2/apifactoryimpl.hxx b/configmgr/source/api2/apifactoryimpl.hxx
index 6c0d276f54..dc355f5b71 100644
--- a/configmgr/source/api2/apifactoryimpl.hxx
+++ b/configmgr/source/api2/apifactoryimpl.hxx
@@ -43,26 +43,26 @@ namespace configmgr
{
ApiProvider& m_rProvider;
public:
- ReadOnlyObjectFactory(ApiProvider& rProvider,ObjectRegistryHolder pRegistry);
+ ReadOnlyObjectFactory(ApiProvider& rProvider,rtl::Reference<ObjectRegistry> pRegistry);
~ReadOnlyObjectFactory();
- virtual NodeElement* doCreateGroupMember(configuration::Tree const& aTree, configuration::NodeRef const& aNode, configuration::Template* pSetElementTemplate);
- virtual TreeElement* doCreateAccessRoot(configuration::Tree const& aTree, configuration::Template* pSetElementTemplate, vos::ORef< OOptions >const& _xOptions);
- virtual SetElement* doCreateSetElement(configuration::ElementTree const& aTree, configuration::Template* pSetElementTemplate);
+ virtual NodeElement* doCreateGroupMember(rtl::Reference< configuration::Tree > const& aTree, configuration::NodeRef const& aNode, configuration::Template* pSetElementTemplate);
+ virtual TreeElement* doCreateAccessRoot(rtl::Reference< configuration::Tree > const& aTree, configuration::Template* pSetElementTemplate, vos::ORef< OOptions >const& _xOptions);
+ virtual SetElement* doCreateSetElement(rtl::Reference< configuration::ElementTree > const& aTree, configuration::Template* pSetElementTemplate);
};
// used to create UNO objects
class UpdateObjectFactory : public Factory
{
ApiProvider& m_rProvider;
public:
- UpdateObjectFactory(ApiProvider& rProvider,ObjectRegistryHolder pRegistry);
+ UpdateObjectFactory(ApiProvider& rProvider,rtl::Reference<ObjectRegistry> pRegistry);
~UpdateObjectFactory();
- virtual NodeElement* doCreateGroupMember(configuration::Tree const& aTree, configuration::NodeRef const& aNode, configuration::Template* pSetElementTemplate);
- virtual TreeElement* doCreateAccessRoot(configuration::Tree const& aTree, configuration::Template* pSetElementTemplate, vos::ORef< OOptions >const& _xOptions);
- virtual SetElement* doCreateSetElement(configuration::ElementTree const& aTree, configuration::Template* pSetElementTemplate);
+ virtual NodeElement* doCreateGroupMember(rtl::Reference< configuration::Tree > const& aTree, configuration::NodeRef const& aNode, configuration::Template* pSetElementTemplate);
+ virtual TreeElement* doCreateAccessRoot(rtl::Reference< configuration::Tree > const& aTree, configuration::Template* pSetElementTemplate, vos::ORef< OOptions >const& _xOptions);
+ virtual SetElement* doCreateSetElement(rtl::Reference< configuration::ElementTree > const& aTree, configuration::Template* pSetElementTemplate);
private:
- bool implIsReadOnly(configuration::Tree const& aTree, configuration::NodeRef const& aNode);
+ bool implIsReadOnly(rtl::Reference< configuration::Tree > const& aTree, configuration::NodeRef const& aNode);
};
}
diff --git a/configmgr/source/api2/apinodeaccess.cxx b/configmgr/source/api2/apinodeaccess.cxx
index ed2d191562..c5f9cd0717 100644
--- a/configmgr/source/api2/apinodeaccess.cxx
+++ b/configmgr/source/api2/apinodeaccess.cxx
@@ -63,15 +63,15 @@ configuration::NodeRef NodeAccess::getNodeRef() const
}
//-----------------------------------------------------------------------------
-configuration::TreeRef NodeAccess::getTreeRef() const
+rtl::Reference< configuration::Tree > NodeAccess::getTreeRef() const
{
return getApiTree().getTree();
}
//-----------------------------------------------------------------------------
-configuration::Tree NodeAccess::getTree() const
+rtl::Reference< configuration::Tree > NodeAccess::getTree() const
{
- return configuration::Tree(getApiTree().getTree());
+ return getApiTree().getTree();
}
//-----------------------------------------------------------------------------
@@ -101,13 +101,13 @@ Notifier NodeAccess::getNotifier() const
//-----------------------------------------------------------------------------
-UnoAny makeElement(configapi::Factory& rFactory, configuration::Tree const& aTree, configuration::AnyNodeRef const& aNode)
+uno::Any makeElement(configapi::Factory& rFactory, rtl::Reference< configuration::Tree > const& aTree, configuration::AnyNodeRef const& aNode)
{
- if (!aTree.isEmpty() && aNode.isValid())
+ if (!configuration::isEmpty(aTree.get()) && aNode.isValid())
{
if (aNode.isNode())
{
- NodeRef aInnerNode = aNode.toNode();
+ configuration::NodeRef aInnerNode = aNode.toNode();
if (configuration::isStructuralNode(aTree,aInnerNode))
return uno::makeAny( rFactory.makeUnoElement(aTree,aInnerNode) );
@@ -121,75 +121,60 @@ UnoAny makeElement(configapi::Factory& rFactory, configuration::Tree const& aTre
}
}
- return UnoAny();
+ return uno::Any();
}
//-----------------------------------------------------------------------------
-UnoAny makeInnerElement(configapi::Factory& rFactory, configuration::Tree const& aTree, configuration::NodeRef const& aNode)
+uno::Any makeInnerElement(configapi::Factory& rFactory, rtl::Reference< configuration::Tree > const& aTree, configuration::NodeRef const& aNode)
{
- if (!aTree.isEmpty() && aNode.isValid())
+ if (!configuration::isEmpty(aTree.get()) && aNode.isValid())
{
OSL_ENSURE(configuration::isStructuralNode(aTree,aNode), "Trying to makeInnerElement for a simple value");
return uno::makeAny( rFactory.makeUnoElement(aTree,aNode) );
}
- return UnoAny();
+ return uno::Any();
}
//-----------------------------------------------------------------------------
-UnoAny makeElement(configapi::Factory& rFactory, configuration::ElementTree const& aTree)
+uno::Any makeElement(configapi::Factory& rFactory, rtl::Reference< configuration::ElementTree > const& aTree)
{
- if (aTree.isValid())
+ if (aTree.is())
{
return uno::makeAny( rFactory.makeUnoSetElement(aTree) );
}
- return UnoAny();
+ return uno::Any();
}
//-----------------------------------------------------------------------------
-configuration::ElementRef extractElementRef(configapi::Factory& rFactory, UnoAny const& aElement, configuration::TemplateInfo const& aTemplateInfo )
+rtl::Reference< configuration::ElementTree > extractElementTree(configapi::Factory& rFactory, uno::Any const& aElement, rtl::Reference< configuration::Template > const& aTemplate )
{
- using configuration::ElementRef;
- configuration::TemplateHolder const aRequestedTemplate = aTemplateInfo.getTemplate();
- OSL_ENSURE(aRequestedTemplate.is(), "ERROR: Need a template to extract a matching set element");
- if (!aRequestedTemplate.is())
- return ElementRef(NULL);
+ OSL_ENSURE(aTemplate.is(), "ERROR: Need a template to extract a matching set element");
if (SetElement* pSetElement = rFactory.extractSetElement(aElement))
{
- configuration::TemplateHolder aFoundTemplate = pSetElement->getTemplateInfo().getTemplate();
+ rtl::Reference<configuration::Template> aFoundTemplate = pSetElement->getTemplateInfo();
if (aFoundTemplate.is())
{
- if (aFoundTemplate != aRequestedTemplate)
- throw configuration::TypeMismatch(aFoundTemplate->getPathString(), aRequestedTemplate->getPathString());
+ if (aFoundTemplate != aTemplate)
+ throw configuration::TypeMismatch(aFoundTemplate->getPathString(), aTemplate->getPathString());
return pSetElement->getElementRef( );
}
}
- return ElementRef(NULL);
-}
-//-----------------------------------------------------------------------------
-
-configuration::ElementTree extractElementTree(configapi::Factory& rFactory, UnoAny const& aElement, configuration::SetElementInfo const& aElementInfo )
-{
- using namespace configuration;
- ElementRef aExtractedRef = extractElementRef(rFactory,aElement,aElementInfo.getTemplateInfo());
- return aExtractedRef.getElementTree();
+ return rtl::Reference< configuration::ElementTree >();
}
//-----------------------------------------------------------------------------
-configuration::SetElementInfo NodeSetInfoAccess::getElementInfo() const
+rtl::Reference< configuration::Template > NodeSetInfoAccess::getElementInfo() const
{
- using configuration::SetElementInfo;
- using configuration::TemplateHolder;
-
- TemplateHolder aTemplate = SetElementInfo::extractElementInfo(getTree(),getNodeRef());
+ rtl::Reference<configuration::Template> aTemplate = getTree()->extractElementInfo(getNodeRef());
OSL_ENSURE(aTemplate.is(), "ERROR: Set must have an element template");
- return SetElementInfo(aTemplate);
+ return aTemplate;
}
}
diff --git a/configmgr/source/api2/apinodeaccess.hxx b/configmgr/source/api2/apinodeaccess.hxx
index d585a9bcbd..c0c80fe386 100644
--- a/configmgr/source/api2/apinodeaccess.hxx
+++ b/configmgr/source/api2/apinodeaccess.hxx
@@ -31,6 +31,11 @@
#ifndef CONFIGMGR_API_NODEACCESS_HXX_
#define CONFIGMGR_API_NODEACCESS_HXX_
+#include "sal/config.h"
+
+#include "boost/utility.hpp"
+
+#include "datalock.hxx"
#include "utility.hxx"
#include "noderef.hxx"
@@ -40,16 +45,9 @@ namespace configmgr
{
namespace configuration
{
- class Name;
class AnyNodeRef;
class NodeRef;
- class TreeRef;
class Tree;
-
- class SetElementInfo;
- class TemplateInfo;
- class ElementRef;
- class ElementTree;
}
namespace configapi
{
@@ -60,36 +58,34 @@ namespace configmgr
class ApiTreeImpl;
namespace uno = com::sun::star::uno;
- typedef uno::XInterface UnoInterface;
- typedef uno::Any UnoAny;
// API object implementation wrappers
// these objects just provide the pieces needed to navigate and manipulate trees and nodes
// The common part of all nodes, provides all you need to read and listen
- class NodeAccess : Noncopyable
+ class NodeAccess : private boost::noncopyable
{
public:
virtual ~NodeAccess();
// model access
configuration::NodeRef getNodeRef() const;
- configuration::TreeRef getTreeRef() const;
- configuration::Tree getTree() const;
+ rtl::Reference< configuration::Tree > getTreeRef() const;
+ rtl::Reference< configuration::Tree > getTree() const;
// self-locked methods for dispose handling
void checkAlive() const;
void disposeNode();
// api object handling
- UnoInterface* getUnoInstance() const
+ uno::XInterface* getUnoInstance() const
{ return doGetUnoInstance(); }
Factory& getFactory() const;
Notifier getNotifier() const;
protected:
virtual configuration::NodeRef doGetNode() const = 0;
- virtual UnoInterface* doGetUnoInstance() const = 0;
+ virtual uno::XInterface* doGetUnoInstance() const = 0;
virtual ApiTreeImpl& getApiTree() const = 0;
};
@@ -98,21 +94,21 @@ namespace configmgr
to create service implementations wrapping inner nodes</p>
<p> returns VOID if <var>aNode</var> is empty.</p>
*/
- UnoAny makeElement(configapi::Factory& rFactory, configuration::Tree const& aTree, configuration::AnyNodeRef const& aNode);
+ uno::Any makeElement(configapi::Factory& rFactory, rtl::Reference< configuration::Tree > const& aTree, configuration::AnyNodeRef const& aNode);
/** builds a Uno <type scope='com::sun::star::uno'>Any</type> representing inner node <var>aNode</var>.
<p> Uses the <type scope='configmgr::configapi'>Factory</type> provided
to create service implementations wrapping inner nodes</p>
<p> returns VOID if <var>aNode</var> is empty.</p>
*/
- UnoAny makeInnerElement(configapi::Factory& rFactory, configuration::Tree const& aTree, configuration::NodeRef const& aNode);
+ uno::Any makeInnerElement(configapi::Factory& rFactory, rtl::Reference< configuration::Tree > const& aTree, configuration::NodeRef const& aNode);
/** builds a Uno <type scope='com::sun::star::uno'>Any</type> representing set element <var>aElement</var>.
<p> Uses the <type scope='configmgr::configapi'>Factory</type> provided
to create service implementations wrapping inner nodes</p>
<p> returns VOID if <var>aNode</var> is empty.</p>
*/
- UnoAny makeElement(configapi::Factory& rFactory, configuration::ElementTree const& aTree);
+ uno::Any makeElement(configapi::Factory& rFactory, rtl::Reference< configuration::ElementTree > const& aTree);
// Info interfaces for Group Nodes
@@ -127,88 +123,51 @@ namespace configmgr
{
friend class SetElement;
public:
- configuration::SetElementInfo getElementInfo() const;
+ rtl::Reference< configuration::Template > getElementInfo() const;
};
/** extracts a <type scope='configmgr::configuration'>ElementTree</type> from a <type scope='com::sun::star::uno'>Any</type>
- which must contain an object which wraps an instance of the template available in <var>aElementInfo</var>.
+ which must contain an object which wraps an instance of the template available in <var>aTemplate</var>.
<p> Uses the <type scope='configmgr::configapi'>Factory</type> provided
to resolve inner nodes (which may suppose that the object was created using the same factory)</p>
- <p> returns an empty <type scope='configmgr::configuration'>Tree</type> if <var>aElement</var> is empty.</p>
+ <p> returns an empty tree if <var>aElement</var> is empty.</p>
<p> May throw exceptions if the type doesn't match the template.</p>
*/
- configuration::ElementRef extractElementRef (Factory& rFactory, UnoAny const& aElement, configuration::TemplateInfo const& aElementInfo );
- configuration::ElementTree extractElementTree(Factory& rFactory, UnoAny const& aElement, configuration::SetElementInfo const& aElementInfo );
-
- // Guarding and locking implementations
- /// guards a NodeAccess; provides an object (read) lock,
- /// ensures object was not disposed
-
-// FIXME: can evaporate this class [ I think ]
- class NodeReadGuardImpl : Noncopyable
- {
- NodeAccess &m_rNode;
- public:
- NodeReadGuardImpl(NodeAccess& rNode)
- : m_rNode(rNode)
- { rNode.checkAlive(); }
- ~NodeReadGuardImpl()
- {}
- public:
- NodeAccess& get() const { return m_rNode; }
-
- configuration::Tree getTree() const
- { return m_rNode.getTree(); }
- configuration::NodeRef getNode() const
- { return m_rNode.getNodeRef(); }
- };
-
- // Thin Wrappers around NodeAccesses: Provide guarding and convenient access
- /// wraps a NodeAccess; provides an object (read) lock, ensures object was not disposed
- template <class Access>
- class GuardedNode
- {
- NodeReadGuardImpl m_aViewLock;
- public:
- GuardedNode(Access& rNode) : m_aViewLock(rNode) {}
- public:
- Access& get() const { return static_cast<Access&>(m_aViewLock.get()); }
- };
- typedef GuardedNode<NodeAccess> GuardedNodeAccess;
+ rtl::Reference< configuration::ElementTree > extractElementTree(Factory& rFactory, uno::Any const& aElement, rtl::Reference< configuration::Template > const& aTemplate );
/// wraps a NodeAccess; provides both object and provider (read) locks,
// ensures object was not disposed
template <class Access>
class GuardedNodeData
- {
+ {
UnoApiLock m_aLock;
- NodeReadGuardImpl m_aViewLock;
+ Access & m_rNode;
public:
GuardedNodeData(Access& rNode);
public:
- Access& get() const { return static_cast<Access&>(m_aViewLock.get()); }
+ Access& get() const { return m_rNode; }
- configuration::Tree getTree() const;
+ rtl::Reference< configuration::Tree > getTree() const;
configuration::NodeRef getNode() const;
};
- typedef GuardedNodeData<NodeAccess> GuardedNodeDataAccess;
template <class Access>
GuardedNodeData<Access>::GuardedNodeData(Access& rNode)
- : m_aViewLock(rNode)
+ : m_rNode(rNode)
{
+ rNode.checkAlive();
}
template <class Access>
- configuration::Tree GuardedNodeData<Access>::getTree() const
+ rtl::Reference< configuration::Tree > GuardedNodeData<Access>::getTree() const
{
- return (configuration::Tree) m_aViewLock.getTree();
+ return m_rNode.getTree();
}
template <class Access>
configuration::NodeRef GuardedNodeData<Access>::getNode() const
{
- return m_aViewLock.getNode();
+ return m_rNode.getNodeRef();
}
}
}
diff --git a/configmgr/source/api2/apinodeupdate.cxx b/configmgr/source/api2/apinodeupdate.cxx
index f3e938c6dd..d7cf1d409c 100644
--- a/configmgr/source/api2/apinodeupdate.cxx
+++ b/configmgr/source/api2/apinodeupdate.cxx
@@ -68,9 +68,8 @@ configuration::GroupDefaulter NodeGroupAccess::getNodeDefaulter()
configuration::SetElementFactory NodeTreeSetAccess::getElementFactory()
{
- using namespace configuration;
- TemplateProvider aProvider = SetElementFactory::findTemplateProvider(getTree(),getNodeRef());
- return SetElementFactory(aProvider);
+ configuration::TemplateProvider aProvider = configuration::SetElementFactory::findTemplateProvider(getTree(),getNodeRef());
+ return configuration::SetElementFactory(aProvider);
}
//-----------------------------------------------------------------------------
@@ -95,29 +94,25 @@ configuration::ValueSetUpdater NodeValueSetAccess::getNodeUpdater()
void attachSetElement(NodeTreeSetAccess& aSet, SetElement& aElement)
{
- using configuration::NodeID;
- OSL_ENSURE( NodeID(aSet.getTreeRef(),aSet.getNodeRef()) ==
- NodeID(aElement.getTreeRef().getContextTree(),aElement.getTreeRef().getContextNode()),
+ OSL_ENSURE( configuration::NodeID(aSet.getTreeRef(),aSet.getNodeRef()) ==
+ configuration::NodeID(rtl::Reference< configuration::Tree >(aElement.getTreeRef()->getContextTree()),aElement.getTreeRef()->getContextNodeRef()),
"ERROR: Attaching an unrelated SetElement to a SetInfoAccess");
aElement.haveNewParent(&aSet);
}
//-----------------------------------------------------------------------------
-bool attachSetElement(NodeTreeSetAccess& aSet, configuration::ElementTree const& aElementTree)
+bool attachSetElement(NodeTreeSetAccess& aSet, rtl::Reference< configuration::ElementTree > const& aElementTree)
{
- using configuration::NodeID;
- OSL_ENSURE( NodeID(aSet.getTreeRef(),aSet.getNodeRef()) ==
- NodeID(aElementTree.getTree().getContextTree(),aElementTree.getTree().getContextNode()),
+ OSL_ENSURE( configuration::NodeID(aSet.getTreeRef(),aSet.getNodeRef()) ==
+ configuration::NodeID(rtl::Reference< configuration::Tree >(aElementTree->getContextTree()), aElementTree->getContextNodeRef()),
"ERROR: Attaching an unrelated ElementTree to a SetInfoAccess");
Factory& rFactory = aSet.getFactory();
-
- configuration::ElementRef aElementRef( aElementTree.getImpl() ); // no other conversion available
- if (SetElement* pSetElement = rFactory.findSetElement(aElementRef))
+ if (SetElement* pSetElement = rFactory.findSetElement(aElementTree))
{
// the factory always does an extra acquire
- UnoInterfaceRef xReleaseSetElement(pSetElement->getUnoInstance(), uno::UNO_REF_NO_ACQUIRE);
+ uno::Reference<uno::XInterface> xReleaseSetElement(pSetElement->getUnoInstance(), uno::UNO_REF_NO_ACQUIRE);
attachSetElement(aSet, *pSetElement);
return true;
@@ -130,22 +125,22 @@ bool attachSetElement(NodeTreeSetAccess& aSet, configuration::ElementTree const&
void detachSetElement(SetElement& aElement)
{
- OSL_ENSURE( aElement.getTreeRef().getContextTree().isEmpty(),
+ OSL_ENSURE( configuration::isEmpty(aElement.getTreeRef()->getContextTree()),
"ERROR: Detaching a SetElement that has a parent");
aElement.haveNewParent(0);
}
//-----------------------------------------------------------------------------
-bool detachSetElement(Factory& rFactory, configuration::ElementRef const& aElementTree)
+bool detachSetElement(Factory& rFactory, rtl::Reference< configuration::ElementTree > const& aElementTree)
{
- OSL_ENSURE( aElementTree.getTreeRef().getContextTree().isEmpty(),
+ OSL_ENSURE( configuration::isEmpty(aElementTree->getContextTree()),
"ERROR: Detaching an ElementTree that has a parent");
if (SetElement* pSetElement = rFactory.findSetElement(aElementTree))
{
// the factory always does an extra acquire
- UnoInterfaceRef xReleaseSetElement(pSetElement->getUnoInstance(), uno::UNO_REF_NO_ACQUIRE);
+ uno::Reference<uno::XInterface> xReleaseSetElement(pSetElement->getUnoInstance(), uno::UNO_REF_NO_ACQUIRE);
detachSetElement(*pSetElement);
return true;
diff --git a/configmgr/source/api2/apinodeupdate.hxx b/configmgr/source/api2/apinodeupdate.hxx
index 2b955ead4a..bade3975f3 100644
--- a/configmgr/source/api2/apinodeupdate.hxx
+++ b/configmgr/source/api2/apinodeupdate.hxx
@@ -31,6 +31,10 @@
#ifndef CONFIGMGR_API_NODEUPDATE_HXX_
#define CONFIGMGR_API_NODEUPDATE_HXX_
+#include "sal/config.h"
+
+#include "boost/utility.hpp"
+
#include "apinodeaccess.hxx"
#include "utility.hxx"
@@ -44,7 +48,6 @@ namespace configmgr
class ValueSetUpdater;
class SetDefaulter;
class SetElementFactory;
- class ElementTree;
class NodeUpdate;
}
@@ -52,9 +55,6 @@ namespace configmgr
{
class SetElement;
- typedef uno::XInterface UnoInterface;
- typedef uno::Any UnoAny;
-
// API object implementation wrappers
// these objects just provide the pieces needed to navigate and manipulate trees and nodes
@@ -104,17 +104,17 @@ namespace configmgr
void attachSetElement(NodeTreeSetAccess& aSet, SetElement& aElement);
/// informs a <type>SetElement</type> that it should now link to the given SetElement
- bool attachSetElement(NodeTreeSetAccess& aSet, configuration::ElementTree const& aElementTree);
+ bool attachSetElement(NodeTreeSetAccess& aSet, rtl::Reference< configuration::ElementTree > const& aElementTree);
/// informs a <type>SetElement</type> that it should now unlink from its owning SetElement
void detachSetElement(SetElement& aElement);
/// informs a <type>SetElement</type> that it should now unlink from its owning SetElement
- bool detachSetElement(Factory& rFactory, configuration::ElementRef const& aElementTree);
+ bool detachSetElement(Factory& rFactory, rtl::Reference< configuration::ElementTree > const& aElementTree);
/// Guarding and locking implementations
/// guards a NodeGroupAccess, or NodeSetAccess; provides an object (write)/provider(read) lock; ensures object was not disposed
- class UpdateGuardImpl : Noncopyable
+ class UpdateGuardImpl : private boost::noncopyable
{
NodeAccess& m_rNode;
public:
@@ -139,20 +139,17 @@ namespace configmgr
public:
Access& get() const { return static_cast<Access&>(m_aImpl.get()); }
- configuration::Tree getTree() const;
+ rtl::Reference< configuration::Tree > getTree() const;
configuration::NodeRef getNode() const;
- typedef typename Access::NodeUpdater Updater;
- typedef typename Access::NodeDefaulter Defaulter;
-
- Updater getNodeUpdater() const;
- Defaulter getNodeDefaulter() const;
+ typename Access::NodeUpdater getNodeUpdater() const;
+ typename Access::NodeDefaulter getNodeDefaulter() const;
void clearForBroadcast() { m_aImpl.downgrade(); }
};
template <class Access>
- configuration::Tree GuardedNodeUpdate<Access>::getTree() const
+ rtl::Reference< configuration::Tree > GuardedNodeUpdate<Access>::getTree() const
{
return get().getTree();
}
@@ -164,22 +161,16 @@ namespace configmgr
}
template <class Access>
- typename GuardedNodeUpdate<Access>::Updater GuardedNodeUpdate<Access>::getNodeUpdater() const
+ typename Access::NodeUpdater GuardedNodeUpdate<Access>::getNodeUpdater() const
{
return get().getNodeUpdater();
}
template <class Access>
- typename GuardedNodeUpdate<Access>::Defaulter GuardedNodeUpdate<Access>::getNodeDefaulter() const
+ typename Access::NodeDefaulter GuardedNodeUpdate<Access>::getNodeDefaulter() const
{
return get().getNodeDefaulter();
}
-
- /// wraps a NodeGroupAccess; provides an object (write) lock, ensures object was not disposed
- typedef GuardedNodeUpdate<NodeGroupAccess> GuardedGroupUpdateAccess;
- typedef GuardedNodeUpdate<NodeSetAccess> GuardedSetUpdateAccess;
- typedef GuardedNodeUpdate<NodeTreeSetAccess> GuardedTreeSetUpdateAccess;
- typedef GuardedNodeUpdate<NodeValueSetAccess> GuardedValueSetUpdateAccess;
}
}
diff --git a/configmgr/source/api2/apinotifierimpl.cxx b/configmgr/source/api2/apinotifierimpl.cxx
index 1313c7688b..8dca2a44a0 100644
--- a/configmgr/source/api2/apinotifierimpl.cxx
+++ b/configmgr/source/api2/apinotifierimpl.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: apinotifierimpl.cxx,v $
- * $Revision: 1.8.14.1 $
+ * $Revision: 1.8.20.5 $
*
* This file is part of OpenOffice.org.
*
@@ -48,21 +48,13 @@ namespace configmgr
namespace util = css::util;
namespace beans = css::beans;
- using uno::RuntimeException;
- using uno::Reference;
-
- using configuration::NodeRef;
- using configuration::ValueRef;
- using configuration::Tree;
-
-
// Generic Notifier Support Implementations
//-----------------------------------------------------------------------------------
/// add a Listener to the notifier of a NodeAccess
template <class Listener>
inline
-void genericAddListener(NodeAccess& rNode, const Reference< Listener >& xListener )
+void genericAddListener(NodeAccess& rNode, const uno::Reference< Listener >& xListener )
{
GuardedNotifier aGuardedNotifier( rNode ); // guard the notifier
aGuardedNotifier->add(rNode.getNodeRef(), xListener);
@@ -71,7 +63,7 @@ void genericAddListener(NodeAccess& rNode, const Reference< Listener >& xListene
/// remove a Listener from the notifier of a NodeAccess
template <class Listener>
inline
-void genericRemoveListener(NodeAccess& rNode, const Reference< Listener >& xListener )
+void genericRemoveListener(NodeAccess& rNode, const uno::Reference< Listener >& xListener )
{
GuardedNotifier aGuardedNotifier( rNode ); // guard the notifier
aGuardedNotifier->remove(rNode.getNodeRef(), xListener);
@@ -86,21 +78,19 @@ void genericRemoveListener(NodeAccess& rNode, const Reference< Listener >& xList
*/
template <class Listener>
inline
-bool genericAddChildListener(NodeGroupInfoAccess& rNode, const Reference< Listener >& xListener, const OUString& sName )
+bool genericAddChildListener(NodeGroupInfoAccess& rNode, const uno::Reference< Listener >& xListener, const rtl::OUString& sName )
{
- using configuration::validateChildName;
-
if (sName.getLength() != 0)
{
- GuardedNodeDataAccess aGuardedNode( rNode ); // guard access to children
+ GuardedNodeData<NodeAccess> aGuardedNode( rNode ); // guard access to children
GuardedNotifier aGuardedNotifier( rNode ); // guard the notifier
- Tree aTree( aGuardedNode.getTree() );
- NodeRef aNode( aGuardedNode.getNode() );
+ rtl::Reference< configuration::Tree > aTree( aGuardedNode.getTree() );
+ configuration::NodeRef aNode( aGuardedNode.getNode() );
- Name aChildName = validateChildName(sName,aTree,aNode);
+ rtl::OUString aChildName = configuration::validateChildName(sName,aTree,aNode);
- if (!aTree.hasChild(aNode,aChildName)) return false;
+ if (!aTree->hasChild(aNode,aChildName)) return false;
aGuardedNotifier->addForOne(aNode, xListener, aChildName);
}
@@ -123,21 +113,19 @@ bool genericAddChildListener(NodeGroupInfoAccess& rNode, const Reference< Listen
*/
template <class Listener>
inline
-bool genericRemoveChildListener(NodeGroupInfoAccess& rNode, const Reference< Listener >& xListener, const OUString& sName )
+bool genericRemoveChildListener(NodeGroupInfoAccess& rNode, const uno::Reference< Listener >& xListener, const rtl::OUString& sName )
{
- using configuration::validateChildName;
-
if (sName.getLength() != 0)
{
- GuardedNodeDataAccess aGuardedNode( rNode ); // guard access to children
+ GuardedNodeData<NodeAccess> aGuardedNode( rNode ); // guard access to children
GuardedNotifier aGuardedNotifier( rNode ); // guard the notifier
- Tree aTree( aGuardedNode.getTree() );
- NodeRef aNode( aGuardedNode.getNode() );
+ rtl::Reference< configuration::Tree > aTree( aGuardedNode.getTree() );
+ configuration::NodeRef aNode( aGuardedNode.getNode() );
- Name aChildName = validateChildName(sName,aTree,aNode);
+ rtl::OUString aChildName = configuration::validateChildName(sName,aTree,aNode);
- if (!aTree.hasChild(aNode,aChildName)) return false;
+ if (!aTree->hasChild(aNode,aChildName)) return false;
aGuardedNotifier->removeForOne(aNode, xListener, aChildName);
}
@@ -156,28 +144,28 @@ bool genericRemoveChildListener(NodeGroupInfoAccess& rNode, const Reference< Lis
// XComponent
//-----------------------------------------------------------------------------------
-void implAddListener(NodeAccess& rNode, const Reference< css::lang::XEventListener >& xListener )
- throw(RuntimeException)
+void implAddListener(NodeAccess& rNode, const uno::Reference< css::lang::XEventListener >& xListener )
+ throw(uno::RuntimeException)
{
genericAddListener(rNode,xListener);
}
-void implRemoveListener(NodeAccess& rNode, const Reference< css::lang::XEventListener >& xListener )
- throw(RuntimeException)
+void implRemoveListener(NodeAccess& rNode, const uno::Reference< css::lang::XEventListener >& xListener )
+ throw(uno::RuntimeException)
{
genericRemoveListener(rNode,xListener);
}
// XContainer
//-----------------------------------------------------------------------------------
-void implAddListener(NodeAccess& rNode, const Reference< css::container::XContainerListener >& xListener )
- throw(RuntimeException)
+void implAddListener(NodeAccess& rNode, const uno::Reference< css::container::XContainerListener >& xListener )
+ throw(uno::RuntimeException)
{
genericAddListener(rNode,xListener);
}
-void implRemoveListener(NodeAccess& rNode, const Reference< css::container::XContainerListener >& xListener )
- throw(RuntimeException)
+void implRemoveListener(NodeAccess& rNode, const uno::Reference< css::container::XContainerListener >& xListener )
+ throw(uno::RuntimeException)
{
genericRemoveListener(rNode,xListener);
}
@@ -185,14 +173,14 @@ void implRemoveListener(NodeAccess& rNode, const Reference< css::container::XCon
// XChangesNotifier
//-----------------------------------------------------------------------------------
-void implAddListener(NodeAccess& rNode, const Reference< css::util::XChangesListener >& xListener )
- throw(RuntimeException)
+void implAddListener(NodeAccess& rNode, const uno::Reference< css::util::XChangesListener >& xListener )
+ throw(uno::RuntimeException)
{
genericAddListener(rNode,xListener);
}
-void implRemoveListener(NodeAccess& rNode, const Reference< css::util::XChangesListener >& xListener )
- throw(RuntimeException)
+void implRemoveListener(NodeAccess& rNode, const uno::Reference< css::util::XChangesListener >& xListener )
+ throw(uno::RuntimeException)
{
genericRemoveListener(rNode,xListener);
}
@@ -200,7 +188,7 @@ void implRemoveListener(NodeAccess& rNode, const Reference< css::util::XChangesL
// XMultiPropertySet
//-----------------------------------------------------------------------------------
-void implAddListener( NodeAccess& rNode, const uno::Reference< beans::XPropertiesChangeListener >& xListener, const uno::Sequence< OUString >& aPropertyNames )
+void implAddListener( NodeAccess& rNode, const uno::Reference< beans::XPropertiesChangeListener >& xListener, const uno::Sequence< rtl::OUString >& aPropertyNames )
throw(uno::RuntimeException)
{
@@ -223,24 +211,23 @@ void implRemoveListener( NodeAccess& rNode, const uno::Reference< beans::XProper
// XPropertySet - VetoableChangeListeners
//-----------------------------------------------------------------------------------
-void implAddListener( NodeGroupInfoAccess& rNode, const uno::Reference< beans::XVetoableChangeListener >& xListener, const OUString& sPropertyName )
+void implAddListener( NodeGroupInfoAccess& rNode, const uno::Reference< beans::XVetoableChangeListener >& xListener, const rtl::OUString& sPropertyName )
throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
{
- using namespace css::beans;
try
{
if (!genericAddChildListener(rNode,xListener,sPropertyName))
{
- throw UnknownPropertyException(
- OUString(RTL_CONSTASCII_USTRINGPARAM("Configuration: cannot add listener - node not found !")),
+ throw css::beans::UnknownPropertyException(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Configuration: cannot add listener - node not found !")),
rNode.getUnoInstance() );
}
}
catch (configuration::InvalidName& ex)
{
ExceptionMapper e(ex);
- throw UnknownPropertyException(
- OUString(RTL_CONSTASCII_USTRINGPARAM("Configuration: cannot add listener - node not found:")) += ex.message(),
+ throw css::beans::UnknownPropertyException(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Configuration: cannot add listener - node not found:")) += ex.message(),
rNode.getUnoInstance() );
}
catch (configuration::Exception& ex)
@@ -253,24 +240,23 @@ void implAddListener( NodeGroupInfoAccess& rNode, const uno::Reference< beans::X
}
-void implRemoveListener( NodeGroupInfoAccess& rNode, const uno::Reference< beans::XVetoableChangeListener >& xListener, const OUString& sPropertyName )
+void implRemoveListener( NodeGroupInfoAccess& rNode, const uno::Reference< beans::XVetoableChangeListener >& xListener, const rtl::OUString& sPropertyName )
throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
{
- using namespace css::beans;
try
{
if (!genericRemoveChildListener(rNode,xListener,sPropertyName))
{
- throw UnknownPropertyException(
- OUString(RTL_CONSTASCII_USTRINGPARAM("Configuration: cannot remove listener - node not found !")),
+ throw css::beans::UnknownPropertyException(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Configuration: cannot remove listener - node not found !")),
rNode.getUnoInstance() );
}
}
catch (configuration::InvalidName& ex)
{
ExceptionMapper e(ex);
- throw UnknownPropertyException(
- OUString(RTL_CONSTASCII_USTRINGPARAM("Configuration: cannot remove listener - node not found:")) += ex.message(),
+ throw css::beans::UnknownPropertyException(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Configuration: cannot remove listener - node not found:")) += ex.message(),
rNode.getUnoInstance() );
}
catch (configuration::Exception& ex)
@@ -284,24 +270,23 @@ void implRemoveListener( NodeGroupInfoAccess& rNode, const uno::Reference< beans
// XPropertySet - PropertyChangeListeners
//-----------------------------------------------------------------------------------
-void implAddListener( NodeGroupInfoAccess& rNode, const uno::Reference< beans::XPropertyChangeListener >& xListener, const OUString& sPropertyName )
+void implAddListener( NodeGroupInfoAccess& rNode, const uno::Reference< beans::XPropertyChangeListener >& xListener, const rtl::OUString& sPropertyName )
throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
{
- using namespace css::beans;
try
{
if (!genericAddChildListener(rNode,xListener,sPropertyName))
{
- throw UnknownPropertyException(
- OUString(RTL_CONSTASCII_USTRINGPARAM("Configuration: cannot add listener - node not found !")),
+ throw css::beans::UnknownPropertyException(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Configuration: cannot add listener - node not found !")),
rNode.getUnoInstance() );
}
}
catch (configuration::InvalidName& ex)
{
ExceptionMapper e(ex);
- throw UnknownPropertyException(
- OUString(RTL_CONSTASCII_USTRINGPARAM("Configuration: cannot add listener - node not found:")) += ex.message(),
+ throw css::beans::UnknownPropertyException(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Configuration: cannot add listener - node not found:")) += ex.message(),
rNode.getUnoInstance() );
}
catch (configuration::Exception& ex)
@@ -312,24 +297,23 @@ void implAddListener( NodeGroupInfoAccess& rNode, const uno::Reference< beans::X
}
}
-void implRemoveListener( NodeGroupInfoAccess& rNode, const uno::Reference< beans::XPropertyChangeListener >& xListener, const OUString& sPropertyName )
+void implRemoveListener( NodeGroupInfoAccess& rNode, const uno::Reference< beans::XPropertyChangeListener >& xListener, const rtl::OUString& sPropertyName )
throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
{
- using namespace css::beans;
try
{
if (!genericRemoveChildListener(rNode,xListener,sPropertyName))
{
- throw UnknownPropertyException(
- OUString(RTL_CONSTASCII_USTRINGPARAM("Configuration: cannot remove listener - node not found !")),
+ throw css::beans::UnknownPropertyException(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Configuration: cannot remove listener - node not found !")),
rNode.getUnoInstance() );
}
}
catch (configuration::InvalidName& ex)
{
ExceptionMapper e(ex);
- throw UnknownPropertyException(
- OUString(RTL_CONSTASCII_USTRINGPARAM("Configuration: cannot remove listener - node not found:")) += ex.message(),
+ throw css::beans::UnknownPropertyException(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Configuration: cannot remove listener - node not found:")) += ex.message(),
rNode.getUnoInstance() );
}
catch (configuration::Exception& ex)
diff --git a/configmgr/source/api2/apinotifierimpl.hxx b/configmgr/source/api2/apinotifierimpl.hxx
index 474c3982d8..4a19118395 100644
--- a/configmgr/source/api2/apinotifierimpl.hxx
+++ b/configmgr/source/api2/apinotifierimpl.hxx
@@ -43,7 +43,6 @@ namespace configmgr
{
namespace css = ::com::sun::star;
namespace uno = ::com::sun::star::uno;
- using rtl::OUString;
/* implementations of the event notification interfaces
supported by a node within the configuration tree.
@@ -78,21 +77,21 @@ namespace configmgr
throw(uno::RuntimeException);
// XPropertySet - VetoableChangeListeners
- void implAddListener( NodeGroupInfoAccess& rNode, const uno::Reference< css::beans::XVetoableChangeListener >& xListener, const OUString& sPropertyName )
+ void implAddListener( NodeGroupInfoAccess& rNode, const uno::Reference< css::beans::XVetoableChangeListener >& xListener, const rtl::OUString& sPropertyName )
throw(css::beans::UnknownPropertyException, css::lang::WrappedTargetException, uno::RuntimeException);
- void implRemoveListener( NodeGroupInfoAccess& rNode, const uno::Reference< css::beans::XVetoableChangeListener >& xListener, const OUString& sPropertyName )
+ void implRemoveListener( NodeGroupInfoAccess& rNode, const uno::Reference< css::beans::XVetoableChangeListener >& xListener, const rtl::OUString& sPropertyName )
throw(css::beans::UnknownPropertyException, css::lang::WrappedTargetException, uno::RuntimeException);
// XPropertySet
- void implAddListener( NodeGroupInfoAccess& rNode, const uno::Reference< css::beans::XPropertyChangeListener >& xListener, const OUString& sPropertyName )
+ void implAddListener( NodeGroupInfoAccess& rNode, const uno::Reference< css::beans::XPropertyChangeListener >& xListener, const rtl::OUString& sPropertyName )
throw(css::beans::UnknownPropertyException, css::lang::WrappedTargetException, uno::RuntimeException);
- void implRemoveListener( NodeGroupInfoAccess& rNode, const uno::Reference< css::beans::XPropertyChangeListener >& xListener, const OUString& sPropertyName )
+ void implRemoveListener( NodeGroupInfoAccess& rNode, const uno::Reference< css::beans::XPropertyChangeListener >& xListener, const rtl::OUString& sPropertyName )
throw(css::beans::UnknownPropertyException, css::lang::WrappedTargetException, uno::RuntimeException);
// XMultiPropertySet
- void implAddListener( NodeAccess& rNode, const uno::Reference< css::beans::XPropertiesChangeListener >& xListener, const uno::Sequence< OUString >& sPropertyNames )
+ void implAddListener( NodeAccess& rNode, const uno::Reference< css::beans::XPropertiesChangeListener >& xListener, const uno::Sequence< rtl::OUString >& sPropertyNames )
throw(uno::RuntimeException);
void implRemoveListener( NodeAccess& rNode, const uno::Reference< css::beans::XPropertiesChangeListener >& xListener )
diff --git a/configmgr/source/api2/apiserviceinfo.cxx b/configmgr/source/api2/apiserviceinfo.cxx
index 1aa0c41d65..21f9db4b8c 100644
--- a/configmgr/source/api2/apiserviceinfo.cxx
+++ b/configmgr/source/api2/apiserviceinfo.cxx
@@ -91,14 +91,14 @@ namespace configmgr
//-----------------------------------------------------------------------------
-const AsciiServiceName c_aNoServices[] =
+sal_Char const * const c_aNoServices[] =
{
NULL
};
//-----------------------------------------------------------------------------
-const AsciiServiceName c_aCreateAccessServiceNames[] =
+sal_Char const * const c_aCreateAccessServiceNames[] =
{
"com.sun.star.configuration.ConfigurationAccess",
"com.sun.star.configuration.HierarchyAccess",
@@ -106,7 +106,7 @@ const AsciiServiceName c_aCreateAccessServiceNames[] =
NULL
};
-const AsciiServiceName c_aCreateUpdateServiceNames[] =
+sal_Char const * const c_aCreateUpdateServiceNames[] =
{
"com.sun.star.configuration.ConfigurationUpdateAccess",
"com.sun.star.configuration.ConfigurationAccess",
@@ -117,7 +117,7 @@ const AsciiServiceName c_aCreateUpdateServiceNames[] =
//-----------------------------------------------------------------------------
-const AsciiServiceName c_aUserAdministrationServices[] =
+sal_Char const * const c_aUserAdministrationServices[] =
{
"com.sun.star.configuration.UserAdministration",
"com.sun.star.configuration.SimpleSetUpdate",
@@ -126,7 +126,7 @@ const AsciiServiceName c_aUserAdministrationServices[] =
NULL
};
-const AsciiServiceName c_aGroupAdministrationServices[] =
+sal_Char const * const c_aGroupAdministrationServices[] =
{
"com.sun.star.configuration.GroupAdministration",
"com.sun.star.configuration.SimpleSetUpdate",
@@ -139,28 +139,28 @@ const AsciiServiceName c_aGroupAdministrationServices[] =
//-- GroupElements
-const AsciiServiceName c_aInnerGroupAccessServices[] =
+sal_Char const * const c_aInnerGroupAccessServices[] =
{
CFG_SVCLIST_GROUPACCESS,
CFG_SVCLIST_GROUPELEMENT,
NULL
};
-const AsciiServiceName c_aInnerGroupUpdateServices[] =
+sal_Char const * const c_aInnerGroupUpdateServices[] =
{
CFG_SVCLIST_GROUPUPDATE,
CFG_SVCLIST_GROUPELEMENT,
NULL
};
-const AsciiServiceName c_aInnerSetAccessServices[] =
+sal_Char const * const c_aInnerSetAccessServices[] =
{
CFG_SVCLIST_SETACCESS,
CFG_SVCLIST_GROUPELEMENT,
NULL
};
-const AsciiServiceName c_aInnerSetUpdateServices[] =
+sal_Char const * const c_aInnerSetUpdateServices[] =
{
CFG_SVCLIST_SETUPDATE,
CFG_SVCLIST_GROUPELEMENT,
@@ -169,28 +169,28 @@ const AsciiServiceName c_aInnerSetUpdateServices[] =
//-- SetElements
-const AsciiServiceName c_aSetElementGroupAccessServices[] =
+sal_Char const * const c_aSetElementGroupAccessServices[] =
{
CFG_SVCLIST_GROUPACCESS,
CFG_SVCLIST_SETELEMENT,
NULL
};
-const AsciiServiceName c_aSetElementGroupUpdateServices[] =
+sal_Char const * const c_aSetElementGroupUpdateServices[] =
{
CFG_SVCLIST_GROUPUPDATE,
CFG_SVCLIST_SETELEMENT,
NULL
};
-const AsciiServiceName c_aSetElementSetAccessServices[] =
+sal_Char const * const c_aSetElementSetAccessServices[] =
{
CFG_SVCLIST_SETACCESS,
CFG_SVCLIST_SETELEMENT,
NULL
};
-const AsciiServiceName c_aSetElementSetUpdateServices[] =
+sal_Char const * const c_aSetElementSetUpdateServices[] =
{
CFG_SVCLIST_SETUPDATE,
CFG_SVCLIST_SETELEMENT,
@@ -199,28 +199,28 @@ const AsciiServiceName c_aSetElementSetUpdateServices[] =
//-- RootElements
-const AsciiServiceName c_aRootGroupAccessServices[] =
+sal_Char const * const c_aRootGroupAccessServices[] =
{
CFG_SVCLIST_GROUPACCESS,
CFG_SVCLIST_ACCESSROOTELEMENT,
NULL
};
-const AsciiServiceName c_aRootGroupUpdateServices[] =
+sal_Char const * const c_aRootGroupUpdateServices[] =
{
CFG_SVCLIST_GROUPUPDATE,
CFG_SVCLIST_UPDATEROOTELEMENT,
NULL
};
-const AsciiServiceName c_aRootSetAccessServices[] =
+sal_Char const * const c_aRootSetAccessServices[] =
{
CFG_SVCLIST_SETACCESS,
CFG_SVCLIST_ACCESSROOTELEMENT,
NULL
};
-const AsciiServiceName c_aRootSetUpdateServices[] =
+sal_Char const * const c_aRootSetUpdateServices[] =
{
CFG_SVCLIST_SETUPDATE,
CFG_SVCLIST_UPDATEROOTELEMENT,
diff --git a/configmgr/source/api2/apiserviceinfo.hxx b/configmgr/source/api2/apiserviceinfo.hxx
index 71bf24890d..c7bef47c43 100644
--- a/configmgr/source/api2/apiserviceinfo.hxx
+++ b/configmgr/source/api2/apiserviceinfo.hxx
@@ -40,8 +40,8 @@ namespace configmgr
{
//-----------------------------------------------------------------------------
- extern const AsciiServiceName c_aUserAdministrationServices[];
- extern const AsciiServiceName c_aGroupAdministrationServices[];
+ extern sal_Char const * const c_aUserAdministrationServices[];
+ extern sal_Char const * const c_aGroupAdministrationServices[];
//-----------------------------------------------------------------------------
extern ServiceImplementationInfo const aInnerGroupInfoSI;
diff --git a/configmgr/source/api2/apitreeaccess.cxx b/configmgr/source/api2/apitreeaccess.cxx
index 9c30f769fd..14c222618d 100644
--- a/configmgr/source/api2/apitreeaccess.cxx
+++ b/configmgr/source/api2/apitreeaccess.cxx
@@ -53,13 +53,13 @@ void NodeElement::checkAlive() const
}
//-----------------------------------------------------------------------------
-configuration::Tree TreeElement::getTree() const
+rtl::Reference< configuration::Tree > TreeElement::getTree() const
{
- return configuration::Tree(this->getTreeRef());
+ return getTreeRef();
}
//-----------------------------------------------------------------------------
-configuration::TreeRef TreeElement::getTreeRef() const
+rtl::Reference< configuration::Tree > TreeElement::getTreeRef() const
{
return getApiTree().getTree();
}
@@ -76,17 +76,17 @@ Factory& TreeElement::getFactory()
}
//-----------------------------------------------------------------------------
-configuration::ElementRef SetElement::getElementRef() const
+rtl::Reference< configuration::ElementTree > SetElement::getElementRef() const
{
- return configuration::ElementRef::extract(getTreeRef());
+ return dynamic_cast< configuration::ElementTree * >(getTreeRef().get());
}
//-----------------------------------------------------------------------------
-configuration::TemplateInfo SetElement::getTemplateInfo() const
+rtl::Reference< configuration::Template > SetElement::getTemplateInfo() const
{
- configuration::ElementRef aTree = configuration::ElementRef::extract(getTreeRef());
- OSL_ENSURE(aTree.isValid(), "This really must be a set element");
- return configuration::TemplateInfo(aTree.getTemplate());
+ rtl::Reference< configuration::ElementTree > aTree(dynamic_cast< configuration::ElementTree * >(getTreeRef().get()));
+ OSL_ENSURE(aTree.is(), "This really must be a set element");
+ return aTree->getTemplate();
}
//-----------------------------------------------------------------------------
@@ -97,9 +97,6 @@ void SetElement::haveNewParent(NodeSetInfoAccess* pNewParent)
this->getApiTree().haveNewParent( pNewParentImpl );
}
//-----------------------------------------------------------------------------
-// configuration::RootTree RootElement::getRootTree() const;
-
-//-----------------------------------------------------------------------------
bool RootElement::disposeTree()
{
@@ -111,32 +108,6 @@ Committer UpdateRootElement::getCommitter()
{
return Committer(getRootTree());
}
-//-----------------------------------------------------------------------------
-
-TreeReadGuardImpl::TreeReadGuardImpl(TreeElement& rTree)
-: m_rTree(rTree)
-{
- rTree.checkAlive();
-}
-//-----------------------------------------------------------------------------
-
-TreeReadGuardImpl::~TreeReadGuardImpl() throw ()
-{
-}
-//-----------------------------------------------------------------------------
-
-GuardedRootElement::GuardedRootElement(RootElement& rTree)
-: m_aImpl(rTree)
-{
-}
-//-----------------------------------------------------------------------------
-
-configuration::Tree GuardedRootElement::getTree() const
-{
- return this->get().getTree();
-}
-
-//-----------------------------------------------------------------------------
}
}
diff --git a/configmgr/source/api2/apitreeaccess.hxx b/configmgr/source/api2/apitreeaccess.hxx
index cfe03ea352..a0d8659c02 100644
--- a/configmgr/source/api2/apitreeaccess.hxx
+++ b/configmgr/source/api2/apitreeaccess.hxx
@@ -31,6 +31,12 @@
#ifndef CONFIGMGR_API_TREEACCESS_HXX_
#define CONFIGMGR_API_TREEACCESS_HXX_
+#include "sal/config.h"
+
+#include "boost/utility.hpp"
+#include "rtl/ref.hxx"
+
+#include "datalock.hxx"
#include "options.hxx"
#include "utility.hxx"
@@ -43,20 +49,15 @@ namespace configmgr
//-----------------------------------------------------------------------------
namespace configuration
{
- class Name;
+ class ElementTree;
+ class Template;
class Tree;
- class TreeRef;
- class ElementRef;
-
- class TemplateInfo;
}
//-----------------------------------------------------------------------------
namespace configapi
{
//-----------------------------------------------------------------------------
namespace uno = com::sun::star::uno;
- typedef uno::XInterface UnoInterface;
- typedef uno::Any UnoAny;
//-----------------------------------------------------------------------------
class Factory;
class Notifier;
@@ -71,25 +72,23 @@ namespace configmgr
// these objects just provide the pieces needed to navigate and manipulate trees and nodes
// A common base class for 'element' classes
- class NodeElement : Noncopyable
+ class NodeElement: private boost::noncopyable
{
public:
- typedef ServiceImplementationInfo ServiceInfo;
- public:
virtual ~NodeElement() {}
// self-locked methods for dispose handling
void checkAlive() const;
// api object handling
- UnoInterface* getUnoInstance() const
+ uno::XInterface* getUnoInstance() const
{ return doGetUnoInstance(); }
- ServiceInfo const * getServiceInfo() const
+ ServiceImplementationInfo const * getServiceInfo() const
{ return doGetServiceInfo(); }
private:
- virtual UnoInterface* doGetUnoInstance() const = 0;
- virtual ServiceInfo const* doGetServiceInfo() const = 0;
+ virtual uno::XInterface* doGetUnoInstance() const = 0;
+ virtual ServiceImplementationInfo const* doGetServiceInfo() const = 0;
virtual ApiTreeImpl& getApiTree() const = 0;
friend class Factory;
@@ -109,8 +108,8 @@ namespace configmgr
{
public:
// model access
- configuration::TreeRef getTreeRef() const;
- configuration::Tree getTree() const;
+ rtl::Reference< configuration::Tree > getTreeRef() const;
+ rtl::Reference< configuration::Tree > getTree() const;
// api object handling
Factory& getFactory();
@@ -129,8 +128,8 @@ namespace configmgr
void haveNewParent(NodeSetInfoAccess* pNewParent);
- configuration::ElementRef getElementRef() const;
- configuration::TemplateInfo getTemplateInfo() const;
+ rtl::Reference< configuration::ElementTree > getElementRef() const;
+ rtl::Reference< configuration::Template > getTemplateInfo() const;
};
//-----------------------------------------------------------------------------
@@ -150,43 +149,30 @@ namespace configmgr
public:
Committer getCommitter();
};
-//-----------------------------------------------------------------------------
- /// guards a TreeElement; provides an object (read) lock, ensures object was not disposed
- // FIXME: bin this ...
- class TreeReadGuardImpl : Noncopyable
- {
- TreeElement& m_rTree;
- public:
- TreeReadGuardImpl(TreeElement& rTree);
- ~TreeReadGuardImpl() throw ();
- public:
- TreeElement& get() const { return m_rTree; }
- };
// Thin Wrappers around TreeElements: Provide guarding and convenient access
/// wraps a TreeElement; provides an object (read) lock, ensures object was not disposed
- class GuardedTreeElement
- {
- UnoApiLock m_aLock;
- TreeReadGuardImpl m_aImpl;
- public:
- GuardedTreeElement(TreeElement& rTree) : m_aImpl(rTree) {}
+ class GuardedTreeElement {
+ UnoApiLock m_aLock;
+ TreeElement & m_rTree;
+
public:
- TreeElement& get() const { return m_aImpl.get(); }
+ explicit GuardedTreeElement(TreeElement & rTree): m_rTree(rTree)
+ { rTree.checkAlive(); }
+
+ TreeElement & get() const { return m_rTree; }
};
- class GuardedRootElement
- {
- UnoApiLock m_aLock;
- TreeReadGuardImpl m_aImpl;
- public:
- GuardedRootElement(RootElement& rTree);
+ class GuardedRootElement {
+ UnoApiLock m_aLock;
+ RootElement & m_rTree;
+
public:
- RootElement& get() const { return static_cast<RootElement&>(m_aImpl.get()); }
+ explicit GuardedRootElement(RootElement & rTree): m_rTree(rTree)
+ { rTree.checkAlive(); }
- configuration::Tree getTree() const;
+ RootElement & get() const { return m_rTree; }
};
-//-----------------------------------------------------------------------------
}
}
diff --git a/configmgr/source/api2/apitreeimplobj.cxx b/configmgr/source/api2/apitreeimplobj.cxx
index 7788128b09..388f9d444b 100644
--- a/configmgr/source/api2/apitreeimplobj.cxx
+++ b/configmgr/source/api2/apitreeimplobj.cxx
@@ -33,7 +33,6 @@
#include <stdio.h>
#include "apitreeimplobj.hxx"
-#include "confproviderimpl2.hxx"
#include "confignotifier.hxx"
#include "notifierimpl.hxx"
#include "apifactory.hxx"
@@ -41,10 +40,12 @@
#include "nodechangeinfo.hxx"
#include "broadcaster.hxx"
#include "change.hxx"
+#include "providerimpl.hxx"
#include "roottree.hxx"
#include "noderef.hxx"
#include "anynoderef.hxx"
#include "tracer.hxx"
+#include "treemanager.hxx"
#include <cppuhelper/queryinterface.hxx>
#include <vos/refernce.hxx>
@@ -161,7 +162,7 @@ void SAL_CALL ApiTreeImpl::ComponentAdapter::disposing(com::sun::star::lang::Eve
{
CFG_TRACE_INFO("ApiTreeImpl:ComponentAdapter: Providing UNO object is disposed - relaying to my owner");
// ensure our owner stays alive
- UnoInterfaceRef xKeepOwnerAlive( this->pOwner->getUnoInstance() );
+ uno::Reference<uno::XInterface> xKeepOwnerAlive( this->pOwner->getUnoInstance() );
// and we stay alive too
rtl::Reference< ApiTreeImpl::ComponentAdapter > xKeepAlive( this );
@@ -200,28 +201,28 @@ void ApiTreeImpl::ComponentAdapter::clear()
class ApiRootTreeImpl::NodeListener : public INodeListener
{
ApiRootTreeImpl* pParent;
- IConfigBroadcaster* pSource;
+ TreeManager * pSource;
- TreeOptions m_xOptions;
- AbsolutePath m_aLocationPath;
+ vos::ORef< OOptions > m_xOptions;
+ configuration::AbsolutePath m_aLocationPath;
public:
NodeListener(ApiRootTreeImpl& _rParent)
: pParent(&_rParent)
, pSource(NULL)
- , m_aLocationPath( AbsolutePath::root() )
+ , m_aLocationPath( configuration::AbsolutePath::root() )
{}
~NodeListener()
{
unbind();
}
- IConfigBroadcaster* getSource()
+ TreeManager * getSource()
{
UnoApiLock aGuard;
return pSource;
}
- void setSource(IConfigBroadcaster* pNew)
+ void setSource(TreeManager * pNew)
{
UnoApiLock aGuard;
if (pParent)
@@ -247,7 +248,7 @@ public:
}
}
- void setLocation(AbsolutePath const& _aLocation, TreeOptions const& _xOptions)
+ void setLocation(configuration::AbsolutePath const& _aLocation, vos::ORef< OOptions > const& _xOptions)
{
OSL_ASSERT(_xOptions.isValid());
@@ -276,7 +277,7 @@ public:
OSL_ASSERT(m_xOptions.isValid());
pSource->removeListener(m_xOptions->getRequestOptions(), this);
m_xOptions.unbind();
- m_aLocationPath = AbsolutePath::root();
+ m_aLocationPath = configuration::AbsolutePath::root();
}
}
@@ -290,12 +291,12 @@ public:
if (pSource)
{
- IConfigBroadcaster* pOrgSource = pSource;
- TreeOptions xOptions = m_xOptions;
+ TreeManager * pOrgSource = pSource;
+ vos::ORef< OOptions > xOptions = m_xOptions;
pSource = 0;
m_xOptions.unbind();
- m_aLocationPath = AbsolutePath::root();
+ m_aLocationPath = configuration::AbsolutePath::root();
aGuard.clear();
@@ -306,9 +307,9 @@ public:
}
// Interfaces
- virtual void disposing(IConfigBroadcaster* pSource);
- virtual void nodeChanged(Change const& aChange, AbsolutePath const& sPath, IConfigBroadcaster* pSource);
- virtual void nodeDeleted(AbsolutePath const& sPath, IConfigBroadcaster* pSource);
+ virtual void disposing(TreeManager * pSource);
+ virtual void nodeChanged(Change const& aChange, configuration::AbsolutePath const& sPath, TreeManager * pSource);
+ virtual void nodeDeleted(configuration::AbsolutePath const& sPath, TreeManager * pSource);
};
//-------------------------------------------------------------------------
@@ -322,7 +323,7 @@ ApiProvider::ApiProvider(Factory& rFactory, OProviderImpl& rProviderImpl )
{}
//-------------------------------------------------------------------------
-UnoTypeConverter ApiProvider::getTypeConverter() const
+uno::Reference<com::sun::star::script::XTypeConverter> ApiProvider::getTypeConverter() const
{
return m_rProviderImpl.getTypeConverter();
}
@@ -331,12 +332,12 @@ static
inline
configuration::DefaultProvider createDefaultProvider(
ApiProvider& rProvider,
- configuration::Tree const& aTree,
- TreeOptions const& _xOptions
+ rtl::Reference< configuration::Tree > const& aTree,
+ vos::ORef< OOptions > const& _xOptions
)
{
OProviderImpl& rProviderImpl = rProvider.getProviderImpl();
- rtl::Reference< IConfigDefaultProvider > xDefaultProvider = rProviderImpl.getDefaultProvider();
+ rtl::Reference< TreeManager > xDefaultProvider = rProviderImpl.getDefaultProvider();
OSL_ASSERT(_xOptions.isValid());
RequestOptions const aOptions = _xOptions.isValid() ? _xOptions->getRequestOptions() : RequestOptions();
@@ -355,7 +356,7 @@ configuration::DefaultProvider extractDefaultProvider(ApiTreeImpl* pParentTree)
return configuration::DefaultProvider::createEmpty();
}
//-------------------------------------------------------------------------
-ApiTreeImpl::ApiTreeImpl(UnoInterface* pInstance, configuration::TreeRef const& aTree, ApiTreeImpl& rParentTree)
+ApiTreeImpl::ApiTreeImpl(uno::XInterface* pInstance, rtl::Reference< configuration::Tree > const& aTree, ApiTreeImpl& rParentTree)
: m_aTree(aTree)
, m_aNotifier(new NotifierImpl(aTree))
, m_aDefaultProvider(rParentTree.getDefaultProvider())
@@ -364,11 +365,11 @@ ApiTreeImpl::ApiTreeImpl(UnoInterface* pInstance, configuration::TreeRef const&
, m_pParentTree(0)
, m_pInstance(pInstance)
{
- setNodeInstance(aTree.getRootNode(), pInstance);
+ setNodeInstance(aTree->getRootNode(), pInstance);
init(&rParentTree);
}
//-------------------------------------------------------------------------
-ApiTreeImpl::ApiTreeImpl(UnoInterface* pInstance, ApiProvider& rProvider, configuration::TreeRef const& aTree, ApiTreeImpl* pParentTree)
+ApiTreeImpl::ApiTreeImpl(uno::XInterface* pInstance, ApiProvider& rProvider, rtl::Reference< configuration::Tree > const& aTree, ApiTreeImpl* pParentTree)
: m_aTree(aTree)
, m_aNotifier(new NotifierImpl(aTree))
, m_aDefaultProvider(extractDefaultProvider(pParentTree))
@@ -378,11 +379,11 @@ ApiTreeImpl::ApiTreeImpl(UnoInterface* pInstance, ApiProvider& rProvider, config
, m_pInstance(pInstance)
{
OSL_ENSURE(pParentTree == NULL || &rProvider == &pParentTree->m_rProvider,"WARNING: Parent tree has a different provider - trouble may be ahead");
- setNodeInstance(aTree.getRootNode(), pInstance);
+ setNodeInstance(aTree->getRootNode(), pInstance);
init(pParentTree);
}
//-------------------------------------------------------------------------
-ApiTreeImpl::ApiTreeImpl(UnoInterface* _pInstance, ApiProvider& _rProvider, configuration::TreeRef const& _aTree, DefaultProvider const& _aDefaultProvider)
+ApiTreeImpl::ApiTreeImpl(uno::XInterface* _pInstance, ApiProvider& _rProvider, rtl::Reference< configuration::Tree > const& _aTree, configuration::DefaultProvider const& _aDefaultProvider)
: m_aTree(_aTree)
, m_aNotifier(new NotifierImpl(_aTree))
, m_aDefaultProvider(_aDefaultProvider)
@@ -391,7 +392,7 @@ ApiTreeImpl::ApiTreeImpl(UnoInterface* _pInstance, ApiProvider& _rProvider, conf
, m_pParentTree(0)
, m_pInstance(_pInstance)
{
- setNodeInstance(_aTree.getRootNode(), _pInstance);
+ setNodeInstance(_aTree->getRootNode(), _pInstance);
init(NULL);
}
//-------------------------------------------------------------------------
@@ -403,8 +404,8 @@ ApiTreeImpl::~ApiTreeImpl()
}
//-------------------------------------------------------------------------
-ApiRootTreeImpl::ApiRootTreeImpl(UnoInterface* pInstance, ApiProvider& rProvider, configuration::Tree const& aTree, TreeOptions const& _xOptions)
-: m_aTreeImpl(pInstance, rProvider, aTree.getRef(), createDefaultProvider(rProvider, aTree, _xOptions))
+ApiRootTreeImpl::ApiRootTreeImpl(uno::XInterface* pInstance, ApiProvider& rProvider, rtl::Reference< configuration::Tree > const& aTree, vos::ORef< OOptions > const& _xOptions)
+: m_aTreeImpl(pInstance, rProvider, aTree, createDefaultProvider(rProvider, aTree, _xOptions))
, m_aLocationPath( configuration::Path::Rep() )
, m_pNotificationListener(NULL)
, m_xOptions(_xOptions)
@@ -423,10 +424,10 @@ ApiRootTreeImpl::~ApiRootTreeImpl()
}
//-------------------------------------------------------------------------
-void ApiTreeImpl::setNodeInstance(configuration::NodeRef const& aNode, UnoInterface* pInstance)
+void ApiTreeImpl::setNodeInstance(configuration::NodeRef const& aNode, uno::XInterface* pInstance)
{
OSL_ENSURE(aNode.isValid(),"ERROR: adding invalid node to ApiTree");
- OSL_ENSURE(m_aTree.isValidNode(aNode),"ERROR: foreign node being added to ApiTree");
+ OSL_ENSURE(m_aTree->isValidNode(aNode.getOffset()),"ERROR: foreign node being added to ApiTree");
m_aNotifier->m_aListeners.setObjectAt( configuration::NodeID(m_aTree, aNode).toIndex(), pInstance );
}
@@ -452,9 +453,9 @@ Notifier ApiTreeImpl::getNotifier() const
bool ApiRootTreeImpl::enableNotification(bool bEnable)
{
- IConfigBroadcaster* pSource = bEnable ? getApiTree().getProvider().getProviderImpl().getNotifier() : 0;
+ TreeManager * pSource = bEnable ? getApiTree().getProvider().getProviderImpl().getNotifier() : 0;
- IConfigBroadcaster* pOld = this->implSetNotificationSource(pSource);
+ TreeManager * pOld = this->implSetNotificationSource(pSource);
return pOld != 0;
}
@@ -465,9 +466,9 @@ bool ApiTreeImpl::disposeTree(bool bForce)
CFG_TRACE_INFO("ApiTreeImpl: Disposing Tree (may throw if already disposed)");
// ensure our provider stays alive
- UnoInterfaceRef xKeepParentAlive(this->getParentComponent());
+ uno::Reference<uno::XInterface> xKeepParentAlive(this->getParentComponent());
// ensure we stay alive too
- UnoInterfaceRef xKeepAlive(this->getUnoInstance());
+ uno::Reference<uno::XInterface> xKeepAlive(this->getUnoInstance());
// #109077# If already disposed, we may have no source data or data lock
if (!isAlive())
@@ -502,9 +503,9 @@ bool ApiTreeImpl::disposeTreeNow()
//-------------------------------------------------------------------------
bool ApiRootTreeImpl::disposeTree()
{
- CFG_TRACE_INFO("Api Root TreeImpl: Disposing Tree And Releasing (unless disposed)");
+ CFG_TRACE_INFO("Api Root Tree: Disposing Tree And Releasing (unless disposed)");
// ensure our provider stays alive
- UnoInterfaceRef xKeepProvider( m_aTreeImpl.getUnoProviderInstance() );
+ uno::Reference<uno::XInterface> xKeepProvider( m_aTreeImpl.getUnoProviderInstance() );
rtl::Reference<NodeListener> xListener = m_pNotificationListener;
if (xListener.is())
@@ -520,7 +521,7 @@ bool ApiRootTreeImpl::disposeTree()
if (!m_xOptions.isEmpty())
{
OSL_ENSURE(!bDisposed, "Disposing/Releasing should clear the options");
- CFG_TRACE_INFO2("Api Root TreeImpl: data was not released in disposeTree");
+ CFG_TRACE_INFO2("Api Root Tree: data was not released in disposeTree");
}
return bDisposed;
@@ -530,22 +531,17 @@ bool ApiTreeImpl::implDisposeTree()
{
OSL_ENSURE(m_pParentTree == 0,"WARNING: Disposing a tree that still has a parent tree set");
- NotifierImpl::SpecialContainer& aContainer = m_aNotifier->m_aListeners;
+ SpecialListenerContainer <configuration::SubNodeID,SubNodeHash,SubNodeEq,SubNodeToIndex>& aContainer = m_aNotifier->m_aListeners;
if (aContainer.beginDisposing())
{
CFG_TRACE_INFO("ApiTreeImpl: Tree is now disposed");
- using configuration::NodeIDList;
- using configuration::NodeID;
- using configuration::Tree;
- using configuration::getAllContainedNodes;
- using com::sun::star::lang::EventObject;
Factory& rFactory = getFactory();
- NodeIDList aChildNodes;
- getAllContainedNodes( Tree(m_aTree), aChildNodes);
+ std::vector<configuration::NodeID> aChildNodes;
+ configuration::getAllContainedNodes( m_aTree, aChildNodes);
- for (NodeIDList::reverse_iterator it = aChildNodes.rbegin(), stop = aChildNodes.rend();
+ for (std::vector<configuration::NodeID>::reverse_iterator it = aChildNodes.rbegin(), stop = aChildNodes.rend();
it != stop;
++it)
{
@@ -572,24 +568,21 @@ bool ApiTreeImpl::implDisposeTree()
}
}
//-------------------------------------------------------------------------
-void ApiTreeImpl::disposeNode(NodeRef const& aNode, UnoInterface* pInstance)
+void ApiTreeImpl::disposeNode(configuration::NodeRef const& aNode, uno::XInterface* pInstance)
{
// This used to contain 3 nested 'isAlive()' calls; why !?
if (isAlive())
implDisposeNode(aNode,pInstance);
}
//-------------------------------------------------------------------------
-void ApiTreeImpl::implDisposeNode(NodeRef const& aNode, UnoInterface* )
+void ApiTreeImpl::implDisposeNode(configuration::NodeRef const& aNode, uno::XInterface* )
{
CFG_TRACE_INFO("ApiTreeImpl: Disposing a single node.");
OSL_ENSURE(aNode.isValid(),"INTERNAL ERROR: Disposing NULL node");
- OSL_ENSURE(m_aTree.isValidNode(aNode),"INTERNAL ERROR: Disposing: node does not match tree");
- OSL_ENSURE( !m_aTree.isRootNode(aNode),"INTERNAL ERROR: Disposing the root node of the tree");
+ OSL_ENSURE(m_aTree->isValidNode(aNode.getOffset()),"INTERNAL ERROR: Disposing: node does not match tree");
+ OSL_ENSURE( !m_aTree->isRootNode(aNode),"INTERNAL ERROR: Disposing the root node of the tree");
- using configuration::NodeID;
- using com::sun::star::lang::EventObject;
-
- NodeID aNodeID(m_aTree,aNode);
+ configuration::NodeID aNodeID(m_aTree,aNode);
if (m_aNotifier->m_aListeners.disposeOne(aNodeID.toIndex()) )
{
@@ -612,7 +605,7 @@ void ApiTreeImpl::deinit()
{
setParentTree(0);
- ComponentRef xAdapter = m_xProvider;
+ uno::Reference<ComponentAdapter> xAdapter = m_xProvider;
m_xProvider.clear();
if (xAdapter.is())
@@ -641,12 +634,11 @@ void ApiTreeImpl::setParentTree(ApiTreeImpl* pParentTree) // internal implementa
#if OSL_DEBUG_LEVEL > 0
if (pParentTree)
{
- using configuration::NodeID;
- TreeRef aContext = m_aTree.getContextTree();
- TreeRef aParent = pParentTree->m_aTree;
+ rtl::Reference< configuration::Tree > aContext = m_aTree->getContextTree();
+ rtl::Reference< configuration::Tree > aParent = pParentTree->m_aTree;
- NodeID aContextID( aContext, aContext.getRootNode() );
- NodeID aParentID( aParent, aParent.getRootNode() );
+ configuration::NodeID aContextID( aContext, aContext->getRootNode() );
+ configuration::NodeID aParentID( aParent, aParent->getRootNode() );
OSL_ENSURE( aContextID == aParentID, "Parent relationship mismatch !");
}
@@ -654,7 +646,7 @@ void ApiTreeImpl::setParentTree(ApiTreeImpl* pParentTree) // internal implementa
if (m_pParentTree != pParentTree)
{
- ComponentRef xAdapter = m_xProvider;
+ uno::Reference<ComponentAdapter> xAdapter = m_xProvider;
m_pParentTree = pParentTree;
@@ -670,11 +662,11 @@ void ApiTreeImpl::setParentTree(ApiTreeImpl* pParentTree) // internal implementa
}
//-------------------------------------------------------------------------
-UnoInterfaceRef ApiTreeImpl::getUnoProviderInstance() const
+uno::Reference<uno::XInterface> ApiTreeImpl::getUnoProviderInstance() const
{
- ComponentRef xAdapter = m_xProvider;
+ uno::Reference<ComponentAdapter> xAdapter = m_xProvider;
- UnoInterfaceRef xReturn;
+ uno::Reference<uno::XInterface> xReturn;
if (xAdapter.is())
xReturn = xAdapter->getProvider();
return xReturn;
@@ -715,9 +707,9 @@ void ApiTreeImpl::disposing(com::sun::star::lang::EventObject const& ) throw()
// if (xThis.is()) xThis->dispose();
}
//-------------------------------------------------------------------------
-IConfigBroadcaster* ApiRootTreeImpl::implSetNotificationSource(IConfigBroadcaster* pNew)
+TreeManager * ApiRootTreeImpl::implSetNotificationSource(TreeManager * pNew)
{
- IConfigBroadcaster* pOld = m_pNotificationListener.is() ? m_pNotificationListener->getSource() : 0;
+ TreeManager * pOld = m_pNotificationListener.is() ? m_pNotificationListener->getSource() : 0;
if (pOld != pNew)
{
OSL_ENSURE(m_xOptions.isValid(), "Cannot change notification source without options");
@@ -732,17 +724,17 @@ IConfigBroadcaster* ApiRootTreeImpl::implSetNotificationSource(IConfigBroadcaste
}
// ---------------------------------------------------------------------------------------------------
-void ApiRootTreeImpl::implSetLocation(configuration::Tree const& _aTree)
+void ApiRootTreeImpl::implSetLocation(rtl::Reference< configuration::Tree > const& _aTree)
{
- OSL_ASSERT( configuration::equalTreeRef(_aTree.getRef(), getApiTree().getTree()) );
- if (!_aTree.isEmpty())
+ OSL_ASSERT(_aTree == getApiTree().getTree());
+ if (!configuration::isEmpty(_aTree.get()))
{
- m_aLocationPath = _aTree.getRootPath();
- OSL_ENSURE(!m_aLocationPath.isRoot(), "Setting up a RootTree without location");
+ m_aLocationPath = _aTree->getRootPath();
+ OSL_ENSURE(!m_aLocationPath.isRoot(), "Setting up a root tree without location");
}
else
{
- OSL_ENSURE(false, "Setting up a RootTree without data");
+ OSL_ENSURE(false, "Setting up a root tree without data");
m_aLocationPath = configuration::AbsolutePath::root();
}
@@ -758,11 +750,13 @@ void ApiRootTreeImpl::implSetLocation(configuration::Tree const& _aTree)
void ApiRootTreeImpl::releaseData()
{
- CFG_TRACE_INFO("Api Root TreeImpl at %s: releasing the Data",OUSTRING2ASCII(m_aLocationPath.toString()));
- configuration::TreeRef aTree( m_aTreeImpl.getTree() );
+ CFG_TRACE_INFO("Api Root Tree at %s: releasing the Data",OUSTRING2ASCII(m_aLocationPath.toString()));
+ rtl::Reference< configuration::Tree > aTree( m_aTreeImpl.getTree() );
- aTree.disposeData();
- OSL_ASSERT(aTree.isEmpty());
+ if (aTree.is()) {
+ aTree->disposeData();
+ }
+ OSL_ASSERT(configuration::isEmpty(aTree.get()));
OSL_ENSURE( !m_aLocationPath.isRoot() && !m_aLocationPath.isDetached(), "Location still needed to release data" );
OSL_ENSURE( m_xOptions.isValid(), "Options still needed to release data" );
@@ -774,7 +768,7 @@ void ApiRootTreeImpl::releaseData()
}
// ---------------------------------------------------------------------------------------------------
-void ApiRootTreeImpl::NodeListener::disposing(IConfigBroadcaster* _pSource)
+void ApiRootTreeImpl::NodeListener::disposing(TreeManager * _pSource)
{
UnoApiLockClearable aGuard;
@@ -782,19 +776,19 @@ void ApiRootTreeImpl::NodeListener::disposing(IConfigBroadcaster* _pSource)
if (pParent)
{
// this is a non-UNO external entry point - we need to keep this object alive for the duration of the call
- UnoInterfaceRef xKeepAlive( pParent->m_aTreeImpl.getUnoInstance() );
+ uno::Reference<uno::XInterface> xKeepAlive( pParent->m_aTreeImpl.getUnoInstance() );
ApiRootTreeImpl* pKeepParent = pParent;
aGuard.clear();
pKeepParent->disposing(_pSource);
}
}
-void ApiRootTreeImpl::disposing(IConfigBroadcaster* /*pSource*/)
+void ApiRootTreeImpl::disposing(TreeManager *)
{
- CFG_TRACE_INFO("Api Root TreeImpl at %s: Cache data is disposed - dispose and release own data",
+ CFG_TRACE_INFO("Api Root Tree at %s: Cache data is disposed - dispose and release own data",
OUSTRING2ASCII(m_aLocationPath.toString()));
// ensure our provider stays alive
- UnoInterfaceRef xKeepProvider( m_aTreeImpl.getUnoProviderInstance() );
+ uno::Reference<uno::XInterface> xKeepProvider( m_aTreeImpl.getUnoProviderInstance() );
rtl::Reference<NodeListener> xListener = m_pNotificationListener;
if (xListener.is())
@@ -815,13 +809,13 @@ void disposeOneRemovedNode(configuration::NodeChangeInformation const& aRemoveIn
{
OSL_ENSURE(aRemoveInfo.change.element.isDataChange(), "ERROR: Disposing replaced element: Element did not really change !");
- configuration::ElementRef aElementRef( aRemoveInfo.change.element.oldValue.get() );
+ rtl::Reference< configuration::ElementTree > aElementRef( aRemoveInfo.change.element.oldValue.get() );
SetElement* pSetElement = aFactory.findSetElement(aElementRef );
if (pSetElement)
{
// factory always does an extra acquire
- UnoInterfaceRef xReleaseSetElement(pSetElement->getUnoInstance(), uno::UNO_REF_NO_ACQUIRE);
+ uno::Reference<uno::XInterface> xReleaseSetElement(pSetElement->getUnoInstance(), uno::UNO_REF_NO_ACQUIRE);
pSetElement->haveNewParent(0);
pSetElement->disposeTree(true);
@@ -839,20 +833,18 @@ void disposeOneRemovedNode(configuration::NodeChangeInformation const& aRemoveIn
static
void disposeRemovedNodes(configuration::NodeChangesInformation const& aChanges, Factory& aFactory)
{
- using configuration::NodeChangeData;
- using configuration::NodeChangesInformation;
- for (NodeChangesInformation::Iterator it = aChanges.begin(); it != aChanges.end(); ++it)
+ for (std::vector< configuration::NodeChangeInformation >::const_iterator it = aChanges.begin(); it != aChanges.end(); ++it)
{
switch (it->change.type)
{
- case NodeChangeData::eReplaceElement:
+ case configuration::NodeChangeData::eReplaceElement:
// check if element is actually unchanged !
// (cannot dispose of the tree, if it is still in use)
if (! it->change.element.isDataChange()) break;
// else dispose the old one: fall thru
- case NodeChangeData::eRemoveElement:
+ case configuration::NodeChangeData::eRemoveElement:
disposeOneRemovedNode( *it, aFactory );
break;
@@ -862,7 +854,7 @@ void disposeRemovedNodes(configuration::NodeChangesInformation const& aChanges,
}
// ---------------------------------------------------------------------------------------------------
//INodeListener : IConfigListener
-void ApiRootTreeImpl::NodeListener::nodeChanged(Change const& aChange, AbsolutePath const& sPath, IConfigBroadcaster* _pSource)
+void ApiRootTreeImpl::NodeListener::nodeChanged(Change const& aChange, configuration::AbsolutePath const& sPath, TreeManager * _pSource)
{
UnoApiLockClearable aGuard;
@@ -870,7 +862,7 @@ void ApiRootTreeImpl::NodeListener::nodeChanged(Change const& aChange, AbsoluteP
if (pParent)
{
// this is a non-UNO external entry point - we need to keep this object alive for the duration of the call
- UnoInterfaceRef xKeepAlive( pParent->m_aTreeImpl.getUnoInstance() );
+ uno::Reference<uno::XInterface> xKeepAlive( pParent->m_aTreeImpl.getUnoInstance() );
ApiRootTreeImpl* pKeepParent = pParent;
aGuard.clear();
@@ -880,34 +872,29 @@ void ApiRootTreeImpl::NodeListener::nodeChanged(Change const& aChange, AbsoluteP
// ---------------------------------------------------------------------------------------------------
//INodeListener : IConfigListener
-void ApiRootTreeImpl::nodeChanged(Change const& aChange, AbsolutePath const& aChangePath, IConfigBroadcaster* /*pSource*/)
+void ApiRootTreeImpl::nodeChanged(Change const& aChange, configuration::AbsolutePath const& aChangePath, TreeManager *)
{
- using configuration::AnyNodeRef;
- using configuration::NodeChanges;
- using configuration::RelativePath;
- using configuration::AbsolutePath;
-
// do not dipatch if we are dying/dead anyway
if (m_aTreeImpl.isAlive())
try
{
- configuration::Tree aTree(m_aTreeImpl.getTree());
+ rtl::Reference< configuration::Tree > aTree(m_aTreeImpl.getTree());
OSL_ENSURE(configuration::Path::hasPrefix(aChangePath, m_aLocationPath),
"'changed' Path does not indicate this tree or its context: ");
- RelativePath aLocalChangePath = configuration::Path::stripPrefix(aChangePath,m_aLocationPath);
+ configuration::RelativePath aLocalChangePath = configuration::Path::stripPrefix(aChangePath,m_aLocationPath);
// find the node and change
- NodeRef aNode;
+ configuration::NodeRef aNode;
if ( !aLocalChangePath.isEmpty() )
{
- NodeRef aBaseNode = aTree.getRootNode();
+ configuration::NodeRef aBaseNode = aTree->getRootNode();
#ifdef DBG_UTIL
try {
- RelativePath aLocalPathOld = configuration::validateAndReducePath(aChangePath.toString(), aTree, aBaseNode);
+ configuration::RelativePath aLocalPathOld = configuration::validateAndReducePath(aChangePath.toString(), aTree, aBaseNode);
OSL_ENSURE( configuration::matches(aLocalPathOld,aLocalChangePath),
"New local path different from validateAndReducePath(...) result in notification dispatch");
}
@@ -918,7 +905,7 @@ void ApiRootTreeImpl::nodeChanged(Change const& aChange, AbsolutePath const& aCh
}
#endif // DBG_UTIL
- AnyNodeRef aFoundNode = configuration::getDeepDescendant(aTree, aBaseNode, aLocalChangePath);
+ configuration::AnyNodeRef aFoundNode = configuration::getDeepDescendant(aTree, aBaseNode, aLocalChangePath);
if ( aFoundNode.isValid() )
{
if (aFoundNode.isNode())
@@ -934,22 +921,19 @@ void ApiRootTreeImpl::nodeChanged(Change const& aChange, AbsolutePath const& aCh
}
else
{
- aNode = aTree.getRootNode();
+ aNode = aTree->getRootNode();
}
SubtreeChange const* pTreeChange = NULL;
if (aNode.isValid())
{
- if (aChange.ISA(SubtreeChange))
- pTreeChange = static_cast<SubtreeChange const*>(&aChange);
-
- else // TODO: Notify set change using parent (if available) and temporary dummy change
- OSL_ENSURE( false, "Notification broken: Change to inner node is not a subtree change");
+ pTreeChange = dynamic_cast<SubtreeChange const*>(&aChange);
+ OSL_ENSURE(pTreeChange != 0, "Notification broken: Change to inner node is not a subtree change"); // TODO: Notify set change using parent (if available) and temporary dummy change
}
if (pTreeChange != NULL) // implies aNode.isValid()
{
- OSL_ENSURE( aChange.getNodeName() == aTree.getName(aNode).toString(),
+ OSL_ENSURE( aChange.getNodeName() == aTree->getSimpleNodeName(aNode.getOffset()),
"Change's node-name does not match found node's name - erratic notification");
configuration::NodeChangesInformation aChanges;
@@ -984,7 +968,7 @@ void ApiRootTreeImpl::nodeChanged(Change const& aChange, AbsolutePath const& aCh
}
// ---------------------------------------------------------------------------------------------------
-void ApiRootTreeImpl::NodeListener::nodeDeleted(AbsolutePath const& _aPath, IConfigBroadcaster* _pSource)
+void ApiRootTreeImpl::NodeListener::nodeDeleted(configuration::AbsolutePath const& _aPath, TreeManager * _pSource)
{
UnoApiLockClearable aGuard;
@@ -992,7 +976,7 @@ void ApiRootTreeImpl::NodeListener::nodeDeleted(AbsolutePath const& _aPath, ICon
if (pParent)
{
// this is a non-UNO external entry point - we need to keep this object alive for the duration of the call
- UnoInterfaceRef xKeepAlive( pParent->m_aTreeImpl.getUnoInstance() );
+ uno::Reference<uno::XInterface> xKeepAlive( pParent->m_aTreeImpl.getUnoInstance() );
ApiRootTreeImpl* pKeepParent = pParent;
aGuard.clear();
@@ -1000,19 +984,19 @@ void ApiRootTreeImpl::NodeListener::nodeDeleted(AbsolutePath const& _aPath, ICon
}
}
// ---------------------------------------------------------------------------------------------------
-void ApiRootTreeImpl::nodeDeleted(AbsolutePath const& _aDeletedPath, IConfigBroadcaster* /*pSource*/)
+void ApiRootTreeImpl::nodeDeleted(configuration::AbsolutePath const& _aDeletedPath, TreeManager *)
{
{ (void)_aDeletedPath; }
// this is a non-UNO external entry point - we need to keep this object alive for the duration of the call
- UnoInterfaceRef xKeepAlive( m_aTreeImpl.getUnoInstance() );
+ uno::Reference<uno::XInterface> xKeepAlive( m_aTreeImpl.getUnoInstance() );
#ifdef DBG_UTIL
OSL_ENSURE(configuration::Path::hasPrefix(m_aLocationPath, _aDeletedPath),
"'deleted' Path does not indicate this tree or its context: ");
#endif
// ensure our provider stays alive
- UnoInterfaceRef xKeepProvider( m_aTreeImpl.getUnoProviderInstance() );
+ uno::Reference<uno::XInterface> xKeepProvider( m_aTreeImpl.getUnoProviderInstance() );
rtl::Reference<NodeListener> xListener = m_pNotificationListener;
if (xListener.is())
diff --git a/configmgr/source/api2/apitreeimplobj.hxx b/configmgr/source/api2/apitreeimplobj.hxx
index 45e54be584..7e8bd6770d 100644
--- a/configmgr/source/api2/apitreeimplobj.hxx
+++ b/configmgr/source/api2/apitreeimplobj.hxx
@@ -37,6 +37,7 @@
#include "confevents.hxx"
#include "options.hxx"
#include "utility.hxx"
+#include <boost/utility.hpp>
#include <vos/ref.hxx>
#include <rtl/ref.hxx>
#include <osl/mutex.hxx>
@@ -63,20 +64,12 @@ namespace configmgr
class Factory;
class Notifier;
class NotifierImpl;
- typedef vos::ORef<NotifierImpl> NotifierImplHolder;
//-----------------------------------------------------------------------------
class ObjectRegistry;
- typedef rtl::Reference<ObjectRegistry> ObjectRegistryHolder;
-
- typedef uno::XInterface UnoInterface;
- typedef uno::Reference<UnoInterface> UnoInterfaceRef;
- typedef uno::Reference<com::sun::star::script::XTypeConverter> UnoTypeConverter;
-
- typedef vos::ORef< OOptions > TreeOptions;
//-----------------------------------------------------------------------------
// API object implementation wrappers
//-------------------------------------------------------------------------
- class ApiProvider : Noncopyable
+ class ApiProvider: private boost::noncopyable
{
Factory& m_rFactory;
OProviderImpl& m_rProviderImpl;
@@ -86,7 +79,7 @@ namespace configmgr
~ApiProvider()
{}
- UnoTypeConverter getTypeConverter() const;
+ uno::Reference<com::sun::star::script::XTypeConverter> getTypeConverter() const;
Factory& getFactory() { return m_rFactory; }
OProviderImpl& getProviderImpl() { return m_rProviderImpl; }
};
@@ -94,53 +87,48 @@ namespace configmgr
//-----------------------------------------------------------------------------
//-------------------------------------------------------------------------
- class ApiTreeImpl : Noncopyable
+ class ApiTreeImpl: private boost::noncopyable
{
class ComponentAdapter;
- typedef uno::Reference<ComponentAdapter> ComponentRef;
- typedef uno::Reference<com::sun::star::lang::XComponent> UnoComponent;
- typedef configuration::TreeRef TreeRef;
- typedef configuration::DefaultProvider DefaultProvider;
-
- TreeRef m_aTree;
- NotifierImplHolder m_aNotifier;
- DefaultProvider m_aDefaultProvider;
- ComponentRef m_xProvider;
+ rtl::Reference< configuration::Tree > m_aTree;
+ vos::ORef<NotifierImpl> m_aNotifier;
+ configuration::DefaultProvider m_aDefaultProvider;
+ uno::Reference<ComponentAdapter> m_xProvider;
ApiProvider& m_rProvider;
ApiTreeImpl* m_pParentTree;
- UnoInterface* m_pInstance;
+ uno::XInterface* m_pInstance;
public:
- explicit ApiTreeImpl(UnoInterface* pInstance, configuration::TreeRef const& aTree, ApiTreeImpl& rParentTree);
- explicit ApiTreeImpl(UnoInterface* pInstance, ApiProvider& rProvider, configuration::TreeRef const& aTree, ApiTreeImpl* pParentTree);
- explicit ApiTreeImpl(UnoInterface* _pInstance, ApiProvider& _rProvider, configuration::TreeRef const& _aTree, DefaultProvider const & _aDefaultProvider);
+ explicit ApiTreeImpl(uno::XInterface* pInstance, rtl::Reference< configuration::Tree > const& aTree, ApiTreeImpl& rParentTree);
+ explicit ApiTreeImpl(uno::XInterface* pInstance, ApiProvider& rProvider, rtl::Reference< configuration::Tree > const& aTree, ApiTreeImpl* pParentTree);
+ explicit ApiTreeImpl(uno::XInterface* _pInstance, ApiProvider& _rProvider, rtl::Reference< configuration::Tree > const& _aTree, configuration::DefaultProvider const & _aDefaultProvider);
~ApiTreeImpl();
// initialization
- void setNodeInstance(configuration::NodeRef const& aNode, UnoInterface* pInstance);
+ void setNodeInstance(configuration::NodeRef const& aNode, uno::XInterface* pInstance);
// model access
- TreeRef getTree() const { return m_aTree; }
+ rtl::Reference< configuration::Tree > getTree() const { return m_aTree; }
// self-locked methods for dispose handling
bool isAlive() const;
void checkAlive() const;
bool disposeTree(bool bForce);
bool disposeTreeNow();
- void disposeNode(configuration::NodeRef const& aNode, UnoInterface* pInstance);
+ void disposeNode(configuration::NodeRef const& aNode, uno::XInterface* pInstance);
// api object handling
Factory& getFactory() const { return m_rProvider.getFactory(); }
Notifier getNotifier() const;
- DefaultProvider getDefaultProvider() const { return m_aDefaultProvider; }
+ configuration::DefaultProvider getDefaultProvider() const { return m_aDefaultProvider; }
// needs external locking
ApiTreeImpl const* getRootTreeImpl() const;
uno::XInterface* getUnoInstance() const { return m_pInstance; }
ApiProvider& getProvider() { return m_rProvider; }
- UnoInterfaceRef getUnoProviderInstance() const; // { return m_xProvider; }
+ uno::Reference<uno::XInterface> getUnoProviderInstance() const; // { return m_xProvider; }
/// wire this to a new parent tree
void haveNewParent(ApiTreeImpl* pNewParent);
@@ -150,30 +138,27 @@ namespace configmgr
void deinit();
bool implDisposeTree();
- void implDisposeNode(configuration::NodeRef const& aNode, UnoInterface* pInstance);
+ void implDisposeNode(configuration::NodeRef const& aNode, uno::XInterface* pInstance);
friend class ComponentAdapter;
void disposing(com::sun::star::lang::EventObject const& rEvt) throw();
- UnoComponent getProviderComponent();
- UnoComponent getParentComponent();
+ uno::Reference<com::sun::star::lang::XComponent> getProviderComponent();
+ uno::Reference<com::sun::star::lang::XComponent> getParentComponent();
};
//-----------------------------------------------------------------------------
class ApiRootTreeImpl
{
- typedef configuration::AbsolutePath AbsolutePath;
- typedef configuration::DefaultProvider DefaultProvider;
-
public:
- explicit ApiRootTreeImpl(UnoInterface* pInstance, ApiProvider& rProvider, configuration::Tree const& aTree, TreeOptions const& _xOptions);
+ explicit ApiRootTreeImpl(uno::XInterface* pInstance, ApiProvider& rProvider, rtl::Reference< configuration::Tree > const& aTree, vos::ORef< OOptions > const& _xOptions);
~ApiRootTreeImpl();
ApiTreeImpl& getApiTree() { return m_aTreeImpl; }
ApiTreeImpl const& getApiTree() const { return m_aTreeImpl; }
- AbsolutePath const & getLocation() const { return m_aLocationPath; }
- TreeOptions getOptions() const { return m_xOptions; }
+ configuration::AbsolutePath const & getLocation() const { return m_aLocationPath; }
+ vos::ORef< OOptions > getOptions() const { return m_xOptions; }
// self-locked methods for dispose handling
bool disposeTree();
@@ -181,26 +166,25 @@ namespace configmgr
/// toggle whether this object relays notifications from the base provider
bool enableNotification(bool bEnable);
private:
- IConfigBroadcaster* implSetNotificationSource(IConfigBroadcaster* pNew);
- void implSetLocation(configuration::Tree const& _aTree);
+ TreeManager * implSetNotificationSource(TreeManager * pNew);
+ void implSetLocation(rtl::Reference< configuration::Tree > const& _aTree);
void releaseData();
private:
class NodeListener;
friend class NodeListener;
- //IConfigBroadcaster* m_pNotificationSource;
// IConfigListener
- void disposing(IConfigBroadcaster* pSource) ;
+ void disposing(TreeManager * pSource) ;
//INodeListener : IConfigListener
- void nodeChanged(Change const& aChange, AbsolutePath const& aPath, IConfigBroadcaster* pSource);
- void nodeDeleted(AbsolutePath const& aPath, IConfigBroadcaster* pSource);
+ void nodeChanged(Change const& aChange, configuration::AbsolutePath const& aPath, TreeManager * pSource);
+ void nodeDeleted(configuration::AbsolutePath const& aPath, TreeManager * pSource);
private:
ApiTreeImpl m_aTreeImpl;
- AbsolutePath m_aLocationPath;
+ configuration::AbsolutePath m_aLocationPath;
rtl::Reference<NodeListener> m_pNotificationListener;
- TreeOptions m_xOptions;
+ vos::ORef< OOptions > m_xOptions;
};
//-----------------------------------------------------------------------------
}
diff --git a/configmgr/source/api2/broadcaster.cxx b/configmgr/source/api2/broadcaster.cxx
index cfcc085d18..9bd6cf0d27 100644
--- a/configmgr/source/api2/broadcaster.cxx
+++ b/configmgr/source/api2/broadcaster.cxx
@@ -61,19 +61,12 @@ namespace configmgr
namespace configapi
{
// ---------------------------------------------------------------------------------------------------
- using configuration::Tree;
- using configuration::NodeID;
-
- using configuration::NodeChangeInformation;
- using configuration::NodeChangeLocation;
- using configuration::NodeChangesInformation;
-// ---------------------------------------------------------------------------------------------------
// Broadcaster implementation
// ---------------------------------------------------------------------------------------------------
class BroadcasterHelper
{
public:
- static NotifierHolder getImpl(Notifier const& aNotifier) { return aNotifier.m_aImpl; }
+ static vos::ORef<NotifierImpl> getImpl(Notifier const& aNotifier) { return aNotifier.m_aImpl; }
};
// ---------------------------------------------------------------------------------------------------
@@ -83,8 +76,7 @@ namespace configmgr
template <class T>
struct LessORefBodyPtr
{
- typedef vos::ORef<T> Ref;
- bool operator()(Ref const& lhs, Ref const& rhs) const
+ bool operator()(vos::ORef<T> const& lhs, vos::ORef<T> const& rhs) const
{
return ptr_less(lhs.getBodyPtr(), rhs.getBodyPtr());
}
@@ -95,7 +87,7 @@ namespace configmgr
class ApiTreeRef
{
ApiTreeImpl const* m_pApiTree;
- UnoInterfaceRef m_xKeepAlive;
+ uno::Reference<uno::XInterface> m_xKeepAlive;
public:
explicit ApiTreeRef(ApiTreeImpl const* _pApiTree = NULL)
: m_pApiTree(_pApiTree)
@@ -120,8 +112,7 @@ namespace configmgr
{ return lhs.m_pApiTree != rhs.m_pApiTree; }
};
// -----------------------------------------------------------------------------------------------
- typedef std::map< NotifierHolder, ApiTreeRef, LessORefBodyPtr<NotifierImpl> > NotifierSet;
- typedef NotifierSet::value_type NotifierData;
+ typedef std::map< vos::ORef<NotifierImpl>, ApiTreeRef, LessORefBodyPtr<NotifierImpl> > NotifierSet;
// -----------------------------------------------------------------------------------------------
}
@@ -131,219 +122,201 @@ namespace configmgr
class Broadcaster::Impl : public vos::OReference
{
private:
- NotifierData m_aNotifierData;
+ NotifierSet::value_type m_aNotifierData;
public:
- Impl(NotifierData const& aNotifierData) : m_aNotifierData(aNotifierData) {}
+ Impl(NotifierSet::value_type const& aNotifierData) : m_aNotifierData(aNotifierData) {}
- NotifierData getNotifierData() const { return m_aNotifierData; }
+ NotifierSet::value_type getNotifierData() const { return m_aNotifierData; }
- bool translateChanges(NodeChangesInformation& aInfos, NodeChanges const& aChanges, bool bSingleBase) const;
- bool translateChanges(NodeChangesInformation& aInfos, NodeChangesInformation const& aChanges, bool bSingleBase) const;
+ bool translateChanges(configuration::NodeChangesInformation& aInfos, configuration::NodeChanges const& aChanges, bool bSingleBase) const;
+ bool translateChanges(configuration::NodeChangesInformation& aInfos, configuration::NodeChangesInformation const& aChanges, bool bSingleBase) const;
- void queryConstraints(NodeChangesInformation const& aChanges) { this->doQueryConstraints(aChanges); }
- void notifyListeners(NodeChangesInformation const& aChanges) { this->doNotifyListeners(aChanges); }
+ void queryConstraints(configuration::NodeChangesInformation const& aChanges) { this->doQueryConstraints(aChanges); }
+ void notifyListeners(configuration::NodeChangesInformation const& aChanges) { this->doNotifyListeners(aChanges); }
- void notifyRootListeners(NodeChangesInformation const& aChanges);
+ void notifyRootListeners(configuration::NodeChangesInformation const& aChanges);
- static vos::ORef<Impl> create(NotifierHolder const& rNotifierImpl, ApiTreeRef const& pTreeImpl, NodeChange const& aChange, bool bLocal);
- static vos::ORef<Impl> create(NotifierHolder const& rNotifierImpl, ApiTreeRef const& pTreeImpl, NodeChanges const& aChange, bool bLocal);
- static vos::ORef<Impl> create(NotifierHolder const& rNotifierImpl, ApiTreeRef const& pTreeImpl, NodeChangeInformation const& aChange, bool bLocal);
- static vos::ORef<Impl> create(NotifierHolder const& rNotifierImpl, ApiTreeRef const& pTreeImpl, NodeChangesInformation const& aChange, bool bLocal);
+ static vos::ORef<Impl> create(vos::ORef<NotifierImpl> const& rNotifierImpl, ApiTreeRef const& pTreeImpl, configuration::NodeChange const& aChange, bool bLocal);
+ static vos::ORef<Impl> create(vos::ORef<NotifierImpl> const& rNotifierImpl, ApiTreeRef const& pTreeImpl, configuration::NodeChanges const& aChange, bool bLocal);
+ static vos::ORef<Impl> create(vos::ORef<NotifierImpl> const& rNotifierImpl, ApiTreeRef const& pTreeImpl, configuration::NodeChangeInformation const& aChange, bool bLocal);
+ static vos::ORef<Impl> create(vos::ORef<NotifierImpl> const& rNotifierImpl, ApiTreeRef const& pTreeImpl, configuration::NodeChangesInformation const& aChange, bool bLocal);
private:
- virtual void doQueryConstraints(NodeChangesInformation const& aChanges) = 0;
- virtual void doNotifyListeners(NodeChangesInformation const& aChanges) = 0;
+ virtual void doQueryConstraints(configuration::NodeChangesInformation const& aChanges) = 0;
+ virtual void doNotifyListeners(configuration::NodeChangesInformation const& aChanges) = 0;
};
// ---------------------------------------------------------------------------------------------------
namespace
{
// -----------------------------------------------------------------------------------------------
- using configuration::Tree;
- using configuration::TreeRef;
- using configuration::NodeRef;
- using configuration::NodeID;
- using configuration::SubNodeID;
- using configuration::NodeOffset;
- using configuration::NodeChange;
- using configuration::NodeChangeInformation;
- using configuration::NodeChangeData;
-
- typedef std::set< configuration::NodeID > NodeSet;
- typedef std::set< configuration::SubNodeID > SubNodeSet;
- // -----------------------------------------------------------------------------------------------
- typedef vos::ORef< Broadcaster::Impl > BroadcasterImplRef;
- // -----------------------------------------------------------------------------------------------
class EmptyBroadcaster_Impl : public Broadcaster::Impl
{
- EmptyBroadcaster_Impl(NotifierData const& rNotifierData)
+ EmptyBroadcaster_Impl(NotifierSet::value_type const& rNotifierData)
: Broadcaster::Impl(rNotifierData)
{
}
public:
static
- BroadcasterImplRef create(NotifierData const& rRootNotifier)
+ vos::ORef< Broadcaster::Impl > create(NotifierSet::value_type const& rRootNotifier)
{
return new EmptyBroadcaster_Impl(rRootNotifier);
}
private:
- virtual void doQueryConstraints(NodeChangesInformation const& aChanges);
- virtual void doNotifyListeners(NodeChangesInformation const& aChanges);
+ virtual void doQueryConstraints(configuration::NodeChangesInformation const& aChanges);
+ virtual void doNotifyListeners(configuration::NodeChangesInformation const& aChanges);
};
- void EmptyBroadcaster_Impl::doQueryConstraints(NodeChangesInformation const&) {}
- void EmptyBroadcaster_Impl::doNotifyListeners(NodeChangesInformation const&) {}
+ void EmptyBroadcaster_Impl::doQueryConstraints(configuration::NodeChangesInformation const&) {}
+ void EmptyBroadcaster_Impl::doNotifyListeners(configuration::NodeChangesInformation const&) {}
// -----------------------------------------------------------------------------------------------
class NodeLocalBroadcaster_Impl : public Broadcaster::Impl
{
- NodeID aAffectedNode;
+ configuration::NodeID aAffectedNode;
public:
- NodeLocalBroadcaster_Impl(NotifierData const& rTreeNotifierData, NodeID const& aAffectedID)
+ NodeLocalBroadcaster_Impl(NotifierSet::value_type const& rTreeNotifierData, configuration::NodeID const& aAffectedID)
: Broadcaster::Impl(rTreeNotifierData)
, aAffectedNode(aAffectedID)
{
}
- NodeID getAffectedNodeID() const { return aAffectedNode; }
- NodeOffset getNodeIndex() const { return aAffectedNode.toIndex(); }
+ configuration::NodeID getAffectedNodeID() const { return aAffectedNode; }
+ unsigned int getNodeIndex() const { return aAffectedNode.toIndex(); }
protected:
- void querySingleConstraint(NodeChangeInformation const& aChange, bool bMore);
- void notifySingleChange(NodeChangeInformation const& aChange, bool bMore, css::beans::PropertyChangeEvent*& pCurEvent);
+ void querySingleConstraint(configuration::NodeChangeInformation const& aChange, bool bMore);
+ void notifySingleChange(configuration::NodeChangeInformation const& aChange, bool bMore, css::beans::PropertyChangeEvent*& pCurEvent);
};
// -----------------------------------------------------------------------------------------------
class SingleChangeBroadcaster_Impl : public NodeLocalBroadcaster_Impl
{
- SubNodeID m_aChangingValue;
+ configuration::SubNodeID m_aChangingValue;
- SingleChangeBroadcaster_Impl(NotifierData const& rTreeNotifierData, NodeID const& aAffectedID, SubNodeID const& aChangedValue);
+ SingleChangeBroadcaster_Impl(NotifierSet::value_type const& rTreeNotifierData, configuration::NodeID const& aAffectedID, configuration::SubNodeID const& aChangedValue);
public:
static
NodeLocalBroadcaster_Impl* create(
- NotifierData const& rLocalNotifier,
- NodeChangeLocation const& aChange);
+ NotifierSet::value_type const& rLocalNotifier,
+ configuration::NodeChangeLocation const& aChange);
static
NodeLocalBroadcaster_Impl* create(
- NotifierData const& rLocalNotifier,
- NodeID const& aAffectedID,
- NodeChangeLocation const& aChange);
+ NotifierSet::value_type const& rLocalNotifier,
+ configuration::NodeID const& aAffectedID,
+ configuration::NodeChangeLocation const& aChange);
static
NodeLocalBroadcaster_Impl* create(
- NotifierData const& rLocalNotifier,
- NodeID const& aAffectedID,
- SubNodeID const& aChangedNode,
- NodeChangeLocation const& aChange);
+ NotifierSet::value_type const& rLocalNotifier,
+ configuration::NodeID const& aAffectedID,
+ configuration::SubNodeID const& aChangedNode,
+ configuration::NodeChangeLocation const& aChange);
private:
- virtual void doQueryConstraints(NodeChangesInformation const& aChanges);
- virtual void doNotifyListeners(NodeChangesInformation const& aChanges);
+ virtual void doQueryConstraints(configuration::NodeChangesInformation const& aChanges);
+ virtual void doNotifyListeners(configuration::NodeChangesInformation const& aChanges);
};
// -----------------------------------------------------------------------------------------------
class MultiChangeBroadcaster_Impl : public NodeLocalBroadcaster_Impl
{
- SubNodeSet m_aChangingNodes;
+ std::set< configuration::SubNodeID > m_aChangingNodes;
- MultiChangeBroadcaster_Impl(NotifierData const& rTreeNotifierData, NodeID const& aAffectedID, SubNodeSet& aChangedNodes);
+ MultiChangeBroadcaster_Impl(NotifierSet::value_type const& rTreeNotifierData, configuration::NodeID const& aAffectedID, std::set< configuration::SubNodeID >& aChangedNodes);
public:
static
NodeLocalBroadcaster_Impl* create(
- NotifierData const& rLocalNotifier,
- NodeChangesInformation const& aChanges);
+ NotifierSet::value_type const& rLocalNotifier,
+ configuration::NodeChangesInformation const& aChanges);
static
NodeLocalBroadcaster_Impl* create(
- NotifierData const& rLocalNotifier,
- NodeID const& aAffectedID,
- NodeChangesInformation const& aChanges);
+ NotifierSet::value_type const& rLocalNotifier,
+ configuration::NodeID const& aAffectedID,
+ configuration::NodeChangesInformation const& aChanges);
private:
- virtual void doQueryConstraints(NodeChangesInformation const& aChanges);
- virtual void doNotifyListeners(NodeChangesInformation const& aChanges);
+ virtual void doQueryConstraints(configuration::NodeChangesInformation const& aChanges);
+ virtual void doNotifyListeners(configuration::NodeChangesInformation const& aChanges);
};
// -----------------------------------------------------------------------------------------------
class SingleTreeBroadcaster_Impl : public Broadcaster::Impl
{
- typedef std::vector< vos::ORef<NodeLocalBroadcaster_Impl> > BroadcasterList;
- BroadcasterList m_aBroadcasters;
+ std::vector< vos::ORef<NodeLocalBroadcaster_Impl> > m_aBroadcasters;
- SingleTreeBroadcaster_Impl(NotifierData const& rTreeNotifierData, BroadcasterList& aBroadcasters);
+ SingleTreeBroadcaster_Impl(NotifierSet::value_type const& rTreeNotifierData, std::vector< vos::ORef<NodeLocalBroadcaster_Impl> >& aBroadcasters);
public:
//--------------------------
static
- BroadcasterImplRef create(
- NotifierData const& rRootNotifier,
- NotifierData const& rLocalNotifier,
- NodeChangesInformation const& aChanges);
+ vos::ORef< Broadcaster::Impl > create(
+ NotifierSet::value_type const& rRootNotifier,
+ NotifierSet::value_type const& rLocalNotifier,
+ configuration::NodeChangesInformation const& aChanges);
- static bool selectChanges(NodeChangesInformation& rSelected, NodeChangesInformation const& aOriginal, NodeID const& aSelector);
+ static bool selectChanges(configuration::NodeChangesInformation& rSelected, configuration::NodeChangesInformation const& aOriginal, configuration::NodeID const& aSelector);
//--------------------------
private:
- virtual void doQueryConstraints(NodeChangesInformation const& aChanges);
- virtual void doNotifyListeners(NodeChangesInformation const& aChanges);
+ virtual void doQueryConstraints(configuration::NodeChangesInformation const& aChanges);
+ virtual void doNotifyListeners(configuration::NodeChangesInformation const& aChanges);
};
// -----------------------------------------------------------------------------------------------
class MultiTreeBroadcaster_Impl : public Broadcaster::Impl
{
- typedef std::vector< BroadcasterImplRef > BroadcasterList;
- BroadcasterList m_aBroadcasters;
+ std::vector< vos::ORef< Broadcaster::Impl > > m_aBroadcasters;
- MultiTreeBroadcaster_Impl(NotifierData const& rRootNotifierData, BroadcasterList& aBroadcasters);
+ MultiTreeBroadcaster_Impl(NotifierSet::value_type const& rRootNotifierData, std::vector< vos::ORef< Broadcaster::Impl > >& aBroadcasters);
public:
//--------------------------
static
- BroadcasterImplRef create(
- NotifierData const& rRootNotifier,
+ vos::ORef< Broadcaster::Impl > create(
+ NotifierSet::value_type const& rRootNotifier,
NotifierSet const& rNotifiers,
- NodeChangesInformation const& aChanges);
+ configuration::NodeChangesInformation const& aChanges);
- static bool selectChanges(NodeChangesInformation& rSelected, NodeChangesInformation const& aOriginal, NotifierData const& aSelector);
+ static bool selectChanges(configuration::NodeChangesInformation& rSelected, configuration::NodeChangesInformation const& aOriginal, NotifierSet::value_type const& aSelector);
//--------------------------
private:
- virtual void doQueryConstraints(NodeChangesInformation const& aChanges);
- virtual void doNotifyListeners(NodeChangesInformation const& aChanges);
+ virtual void doQueryConstraints(configuration::NodeChangesInformation const& aChanges);
+ virtual void doNotifyListeners(configuration::NodeChangesInformation const& aChanges);
};
// -----------------------------------------------------------------------------------------------
- inline NodeID makeRootID( Tree const& aTree ) { return NodeID( aTree, aTree.getRootNode() ); }
- inline NodeID makeRootID( TreeRef const& aTree ) { return NodeID( aTree, aTree.getRootNode() ); }
- inline NodeID makeRootID( ApiTreeRef const& pTreeImpl ) { return makeRootID( pTreeImpl->getTree() ); }
+ inline configuration::NodeID makeRootID( rtl::Reference< configuration::Tree > const& aTree ) { return configuration::NodeID( aTree, aTree->getRootNode() ); }
+ inline configuration::NodeID makeRootID( ApiTreeRef const& pTreeImpl ) { return makeRootID( pTreeImpl->getTree() ); }
// -----------------------------------------------------------------------------------------------
- NotifierData findNotifier(NodeChangeLocation const& aChange, ApiTreeRef const& pTreeImpl)
+ NotifierSet::value_type findNotifier(configuration::NodeChangeLocation const& aChange, ApiTreeRef const& pTreeImpl)
{
OSL_ENSURE(aChange.isValidData(),"Invalid change location - cannot find notifier");
- NodeID aAffectedNode = aChange.getAffectedNodeID();
+ configuration::NodeID aAffectedNode = aChange.getAffectedNodeID();
if (aAffectedNode.isEmpty())
- return NotifierData();
+ return NotifierSet::value_type();
ApiTreeRef aAffectedImpl( Factory::findDescendantTreeImpl(aAffectedNode, pTreeImpl.get()) );
if (aAffectedImpl.is())
{
- NotifierHolder aAffectedNotifier = BroadcasterHelper::getImpl(aAffectedImpl->getNotifier());
+ vos::ORef<NotifierImpl> aAffectedNotifier = BroadcasterHelper::getImpl(aAffectedImpl->getNotifier());
- return NotifierData(aAffectedNotifier, aAffectedImpl);
+ return NotifierSet::value_type(aAffectedNotifier, aAffectedImpl);
}
else
- return NotifierData();
+ return NotifierSet::value_type();
}
// -----------------------------------------------------------------------------------------------
inline
- NotifierData findNotifier(NodeChangeInformation const& aChange, ApiTreeRef const& pTreeImpl)
+ NotifierSet::value_type findNotifier(configuration::NodeChangeInformation const& aChange, ApiTreeRef const& pTreeImpl)
{
return findNotifier(aChange.location,pTreeImpl);
}
// -----------------------------------------------------------------------------------------------
- void findNotifiers(NotifierSet& aNotifiers, NodeChangesInformation const& aChanges, ApiTreeRef const& pTreeImpl )
+ void findNotifiers(NotifierSet& aNotifiers, configuration::NodeChangesInformation const& aChanges, ApiTreeRef const& pTreeImpl )
{
- for (NodeChangesInformation::Iterator it = aChanges.begin(); it != aChanges.end(); ++it)
+ for (std::vector< configuration::NodeChangeInformation >::const_iterator it = aChanges.begin(); it != aChanges.end(); ++it)
{
- NotifierData aNotifierData( findNotifier(*it,pTreeImpl) );
+ NotifierSet::value_type aNotifierData( findNotifier(*it,pTreeImpl) );
if (aNotifierData.first.isValid())
{
@@ -355,17 +328,14 @@ namespace configmgr
// -----------------------------------------------------------------------------------------------
// NodeLocalBroadcaster_Impl
// -----------------------------------------------------------------------------------------------
- void NodeLocalBroadcaster_Impl::querySingleConstraint(NodeChangeInformation const& aChange, bool bMore)
+ void NodeLocalBroadcaster_Impl::querySingleConstraint(configuration::NodeChangeInformation const& aChange, bool bMore)
{
- using css::beans::XVetoableChangeListener;
-
- typedef ListenerContainerIterator< XVetoableChangeListener > ListenerIterator;
- uno::Reference< XVetoableChangeListener > const * const SelectListener = 0;
+ uno::Reference< css::beans::XVetoableChangeListener > const * const SelectListener = 0;
- NotifierImplHolder pNotifierImpl = getNotifierData().first;
+ vos::ORef<NotifierImpl> pNotifierImpl = getNotifierData().first;
- ListenerContainer* pListeners = pNotifierImpl->m_aListeners.getContainer( getNodeIndex(), getCppuType(SelectListener) );
- ListenerContainer* pSpecial = pNotifierImpl->m_aListeners.getSpecialContainer( aChange.location.getChangingValueID() );
+ cppu::OInterfaceContainerHelper* pListeners = pNotifierImpl->m_aListeners.getContainer( getNodeIndex(), getCppuType(SelectListener) );
+ cppu::OInterfaceContainerHelper* pSpecial = pNotifierImpl->m_aListeners.getSpecialContainer( aChange.location.getChangingValueID() );
if (pSpecial || pListeners)
{
@@ -378,7 +348,7 @@ namespace configmgr
// a PropertyVetoException (which is not a RuntimeException)
if (pListeners)
{
- ListenerIterator aIterator(*pListeners);
+ ListenerContainerIterator< css::beans::XVetoableChangeListener > aIterator(*pListeners);
UnoApiLockReleaser aGuardReleaser;
while (aIterator.hasMoreElements())
@@ -391,7 +361,7 @@ namespace configmgr
}
if (pSpecial)
{
- ListenerIterator aIterator(*pSpecial);
+ ListenerContainerIterator< css::beans::XVetoableChangeListener > aIterator(*pSpecial);
UnoApiLockReleaser aGuardReleaser;
while (aIterator.hasMoreElements())
@@ -407,19 +377,14 @@ namespace configmgr
}
// -----------------------------------------------------------------------------------------------
- void NodeLocalBroadcaster_Impl::notifySingleChange(NodeChangeInformation const& aChange, bool bMore, css::beans::PropertyChangeEvent*& pCurEvent)
+ void NodeLocalBroadcaster_Impl::notifySingleChange(configuration::NodeChangeInformation const& aChange, bool bMore, css::beans::PropertyChangeEvent*& pCurEvent)
{
- using css::beans::XPropertyChangeListener;
- using css::container::XContainerListener;
+ uno::Reference< css::beans::XPropertyChangeListener > const * const SelectPropertyListener = 0;
+ uno::Reference< css::container::XContainerListener > const * const SelectContainerListener = 0;
- typedef ListenerContainerIterator< XPropertyChangeListener > PropertyListenerIterator;
- typedef ListenerContainerIterator< XContainerListener > ContainerListenerIterator;
- uno::Reference< XPropertyChangeListener > const * const SelectPropertyListener = 0;
- uno::Reference< XContainerListener > const * const SelectContainerListener = 0;
+ vos::ORef<NotifierImpl> pNotifierImpl = getNotifierData().first;
- NotifierImplHolder pNotifierImpl = getNotifierData().first;
-
- ListenerContainer* pContainerListeners = pNotifierImpl->m_aListeners.getContainer( getNodeIndex(), getCppuType(SelectContainerListener) );
+ cppu::OInterfaceContainerHelper* pContainerListeners = pNotifierImpl->m_aListeners.getContainer( getNodeIndex(), getCppuType(SelectContainerListener) );
if (pContainerListeners)
{
@@ -429,35 +394,35 @@ namespace configmgr
if (configapi::fillEventDataFromResolved(aEvent,aChange))
{
- ContainerListenerIterator aIterator(*pContainerListeners);
+ ListenerContainerIterator< css::container::XContainerListener > aIterator(*pContainerListeners);
UnoApiLockReleaser aGuardReleaser;
while (aIterator.hasMoreElements())
try
{
- uno::Reference<XContainerListener> xListener( aIterator.next() );
+ uno::Reference<css::container::XContainerListener> xListener( aIterator.next() );
OSL_ASSERT( xListener.is() );
switch (aChange.change.type)
{
- case NodeChangeData::eSetValue:
- case NodeChangeData::eSetDefault:
- case NodeChangeData::eReplaceElement:
+ case configuration::NodeChangeData::eSetValue:
+ case configuration::NodeChangeData::eSetDefault:
+ case configuration::NodeChangeData::eReplaceElement:
xListener->elementReplaced(aEvent);
break;
- case NodeChangeData::eInsertElement:
+ case configuration::NodeChangeData::eInsertElement:
xListener->elementInserted(aEvent);
break;
- case NodeChangeData::eRemoveElement:
+ case configuration::NodeChangeData::eRemoveElement:
xListener->elementRemoved(aEvent);
break;
- case NodeChangeData::eResetSetDefault:
- case NodeChangeData::eRenameElementTree:
- case NodeChangeData::eNoChange:
+ case configuration::NodeChangeData::eResetSetDefault:
+ case configuration::NodeChangeData::eRenameElementTree:
+ case configuration::NodeChangeData::eNoChange:
OSL_ASSERT(false);
break;
}
@@ -475,19 +440,19 @@ namespace configmgr
if (configapi::fillEventDataFromResolved(rEvent,aChange,bMore))
{
- ListenerContainer* pPropertyListeners = pNotifierImpl->m_aListeners.getContainer( getNodeIndex(), getCppuType(SelectPropertyListener) );
+ cppu::OInterfaceContainerHelper* pPropertyListeners = pNotifierImpl->m_aListeners.getContainer( getNodeIndex(), getCppuType(SelectPropertyListener) );
if (pPropertyListeners)
{
- PropertyListenerIterator aIterator(*pPropertyListeners);
+ ListenerContainerIterator< css::beans::XPropertyChangeListener > aIterator(*pPropertyListeners);
UnoApiLockReleaser aGuardReleaser;
while (aIterator.hasMoreElements())
try { aIterator.next()->propertyChange(rEvent); } catch (uno::Exception & ) {}
}
- ListenerContainer* pSpecialListeners = pNotifierImpl->m_aListeners.getSpecialContainer( aChange.location.getChangingValueID() );
+ cppu::OInterfaceContainerHelper* pSpecialListeners = pNotifierImpl->m_aListeners.getSpecialContainer( aChange.location.getChangingValueID() );
if (pSpecialListeners)
{
- PropertyListenerIterator aIterator(*pSpecialListeners);
+ ListenerContainerIterator< css::beans::XPropertyChangeListener > aIterator(*pSpecialListeners);
UnoApiLockReleaser aGuardReleaser;
while (aIterator.hasMoreElements())
try { aIterator.next()->propertyChange(rEvent); } catch (uno::Exception & ) {}
@@ -503,8 +468,8 @@ namespace configmgr
// SingleBroadcaster_Impl
// -----------------------------------------------------------------------------------------------
SingleChangeBroadcaster_Impl::SingleChangeBroadcaster_Impl(
- NotifierData const& rTreeNotifierData,
- NodeID const& aAffectedID, SubNodeID const& aChangedNode
+ NotifierSet::value_type const& rTreeNotifierData,
+ configuration::NodeID const& aAffectedID, configuration::SubNodeID const& aChangedNode
)
: NodeLocalBroadcaster_Impl(rTreeNotifierData,aAffectedID)
, m_aChangingValue(aChangedNode)
@@ -512,15 +477,15 @@ namespace configmgr
}
// -----------------------------------------------------------------------------------------------
NodeLocalBroadcaster_Impl* SingleChangeBroadcaster_Impl::create(
- NotifierData const& rLocalNotifier,
- NodeChangeLocation const& aChange)
+ NotifierSet::value_type const& rLocalNotifier,
+ configuration::NodeChangeLocation const& aChange)
{
- OSL_ENSURE(configuration::equalTreeRef(rLocalNotifier.second->getTree(), aChange.getAffectedTreeRef()),
+ OSL_ENSURE(rLocalNotifier.second->getTree() == aChange.getAffectedTreeRef(),
"ERROR: Tree Mismatch creating Single Broadcaster");
OSL_ENSURE(aChange.isValidData(), "ERROR: Invalid Change Location for Broadcaster");
- NodeID aAffectedNodeID = aChange.getAffectedNodeID();
+ configuration::NodeID aAffectedNodeID = aChange.getAffectedNodeID();
if (aAffectedNodeID.isEmpty())
return 0;
@@ -528,25 +493,25 @@ namespace configmgr
}
// -----------------------------------------------------------------------------------------------
NodeLocalBroadcaster_Impl* SingleChangeBroadcaster_Impl::create(
- NotifierData const& rLocalNotifier,
- NodeID const& aAffectedID,
- NodeChangeLocation const& aChange)
+ NotifierSet::value_type const& rLocalNotifier,
+ configuration::NodeID const& aAffectedID,
+ configuration::NodeChangeLocation const& aChange)
{
return create(rLocalNotifier,aAffectedID,aChange.getChangingValueID(),aChange);
}
// -----------------------------------------------------------------------------------------------
NodeLocalBroadcaster_Impl* SingleChangeBroadcaster_Impl::create(
- NotifierData const& rLocalNotifier,
- NodeID const& aAffectedID,
- SubNodeID const& aChangedNodeID,
- NodeChangeLocation const& aChange)
+ NotifierSet::value_type const& rLocalNotifier,
+ configuration::NodeID const& aAffectedID,
+ configuration::SubNodeID const& aChangedNodeID,
+ configuration::NodeChangeLocation const& aChange)
{
{ (void)aChange; }
OSL_ENSURE(aChange.isValidData(), "ERROR: Invalid Change Location for Broadcaster");
OSL_ENSURE(aAffectedID.isValidNode(),"Cannot broadcast without affected node");
- OSL_ENSURE(configuration::equalTreeRef(rLocalNotifier.second->getTree(), aChange.getAffectedTreeRef()),
+ OSL_ENSURE(rLocalNotifier.second->getTree() == aChange.getAffectedTreeRef(),
"ERROR: Tree Mismatch creating Single Broadcaster");
OSL_ENSURE( aChange.getAffectedNodeID() == aAffectedID,
"ERROR: Node Mismatch creating Single Broadcaster");
@@ -556,12 +521,12 @@ namespace configmgr
return new SingleChangeBroadcaster_Impl(rLocalNotifier,aAffectedID,aChangedNodeID);
}
// -----------------------------------------------------------------------------------------------
- void SingleChangeBroadcaster_Impl::doQueryConstraints(NodeChangesInformation const& aChanges)
+ void SingleChangeBroadcaster_Impl::doQueryConstraints(configuration::NodeChangesInformation const& aChanges)
{
OSL_ASSERT(aChanges.size() <= 1);
if (!aChanges.empty())
{
- NodeChangesInformation::Iterator it = aChanges.begin();
+ std::vector< configuration::NodeChangeInformation >::const_iterator it = aChanges.begin();
OSL_ENSURE( m_aChangingValue == it->location.getChangingValueID(), "Broadcasting unanticipated change");
@@ -570,18 +535,15 @@ namespace configmgr
}
// -----------------------------------------------------------------------------------------------
- void SingleChangeBroadcaster_Impl::doNotifyListeners(NodeChangesInformation const& aChanges)
+ void SingleChangeBroadcaster_Impl::doNotifyListeners(configuration::NodeChangesInformation const& aChanges)
{
- using css::beans::XPropertiesChangeListener;
- using css::beans::PropertyChangeEvent;
-
OSL_ASSERT(aChanges.size() <= 1);
if (!aChanges.empty())
{
- PropertyChangeEvent aEvent;
- PropertyChangeEvent * pEventNext = &aEvent;
+ css::beans::PropertyChangeEvent aEvent;
+ css::beans::PropertyChangeEvent * pEventNext = &aEvent;
- NodeChangesInformation::Iterator it = aChanges.begin();
+ std::vector< configuration::NodeChangeInformation >::const_iterator it = aChanges.begin();
OSL_ENSURE( m_aChangingValue == it->location.getChangingValueID(), "Broadcasting unanticipated change");
@@ -589,18 +551,17 @@ namespace configmgr
if (pEventNext != &aEvent)
{
- uno::Sequence< PropertyChangeEvent > aPropertyEvents(&aEvent,1);
+ uno::Sequence< css::beans::PropertyChangeEvent > aPropertyEvents(&aEvent,1);
- typedef ListenerContainerIterator< XPropertiesChangeListener > ListenerIterator;
- uno::Reference< XPropertiesChangeListener > const * const SelectListener = 0;
+ uno::Reference< css::beans::XPropertiesChangeListener > const * const SelectListener = 0;
- NotifierImplHolder pNotifierImpl = getNotifierData().first;
+ vos::ORef<NotifierImpl> pNotifierImpl = getNotifierData().first;
- ListenerContainer* pContainer = pNotifierImpl->m_aListeners.getContainer( getNodeIndex(), getCppuType(SelectListener) );
+ cppu::OInterfaceContainerHelper* pContainer = pNotifierImpl->m_aListeners.getContainer( getNodeIndex(), getCppuType(SelectListener) );
if (pContainer)
{
- ListenerIterator aIterator(*pContainer);
+ ListenerContainerIterator< css::beans::XPropertiesChangeListener > aIterator(*pContainer);
UnoApiLockReleaser aGuardReleaser;
while (aIterator.hasMoreElements())
try { aIterator.next()->propertiesChange(aPropertyEvents); } catch (uno::Exception & ) {}
@@ -614,8 +575,8 @@ namespace configmgr
// -----------------------------------------------------------------------------------------------
MultiChangeBroadcaster_Impl::MultiChangeBroadcaster_Impl(
- NotifierData const& rTreeNotifierData,
- NodeID const& aAffectedID, SubNodeSet& aChangedNodes
+ NotifierSet::value_type const& rTreeNotifierData,
+ configuration::NodeID const& aAffectedID, std::set< configuration::SubNodeID >& aChangedNodes
)
: NodeLocalBroadcaster_Impl(rTreeNotifierData,aAffectedID)
, m_aChangingNodes()
@@ -624,15 +585,15 @@ namespace configmgr
}
// -----------------------------------------------------------------------------------------------
NodeLocalBroadcaster_Impl* MultiChangeBroadcaster_Impl::create(
- NotifierData const& rLocalNotifier,
- NodeChangesInformation const& aChanges)
+ NotifierSet::value_type const& rLocalNotifier,
+ configuration::NodeChangesInformation const& aChanges)
{
if (aChanges.empty())
return 0;
OSL_ENSURE(aChanges.begin()->hasValidLocation(), "ERROR: Invalid Change Location for Broadcaster");
- NodeID aAffectedNodeID = aChanges.begin()->location.getAffectedNodeID();
+ configuration::NodeID aAffectedNodeID = aChanges.begin()->location.getAffectedNodeID();
if (aAffectedNodeID.isEmpty())
return 0;
@@ -640,9 +601,9 @@ namespace configmgr
}
// -----------------------------------------------------------------------------------------------
NodeLocalBroadcaster_Impl* MultiChangeBroadcaster_Impl::create(
- NotifierData const& rLocalNotifier,
- NodeID const& aAffectedNodeID,
- NodeChangesInformation const& aChanges)
+ NotifierSet::value_type const& rLocalNotifier,
+ configuration::NodeID const& aAffectedNodeID,
+ configuration::NodeChangesInformation const& aChanges)
{
if (aChanges.empty())
return 0;
@@ -654,16 +615,16 @@ namespace configmgr
{
OSL_ENSURE(aAffectedNodeID.isValidNode(),"Cannot broadcast without affected node");
- SubNodeSet aChangedNodes;
- for (NodeChangesInformation::Iterator it = aChanges.begin(); it != aChanges.end(); ++it)
+ std::set< configuration::SubNodeID > aChangedNodes;
+ for (std::vector< configuration::NodeChangeInformation >::const_iterator it = aChanges.begin(); it != aChanges.end(); ++it)
{
OSL_ENSURE(it->hasValidLocation(), "ERROR: Invalid Change Location for Broadcaster");
OSL_ENSURE(it->location.getAffectedNodeID() == aAffectedNodeID, "ERROR: Change is not local to affected node (as advertised)");
- OSL_ENSURE(configuration::equalTreeRef(rLocalNotifier.second->getTree(), it->location.getAffectedTreeRef()),
+ OSL_ENSURE(rLocalNotifier.second->getTree() == it->location.getAffectedTreeRef(),
"ERROR: Tree Mismatch creating Multi Change Broadcaster");
- SubNodeID aChangedValueID = it->location.getChangingValueID();
+ configuration::SubNodeID aChangedValueID = it->location.getChangingValueID();
aChangedNodes.insert(aChangedValueID);
}
@@ -675,11 +636,11 @@ namespace configmgr
}
}
// -----------------------------------------------------------------------------------------------
- void MultiChangeBroadcaster_Impl::doQueryConstraints(NodeChangesInformation const& aChanges)
+ void MultiChangeBroadcaster_Impl::doQueryConstraints(configuration::NodeChangesInformation const& aChanges)
{
- NodeChangesInformation::Iterator const stop = aChanges.end(), last = stop-1;
+ std::vector< configuration::NodeChangeInformation >::const_iterator const stop = aChanges.end(), last = stop-1;
- for (NodeChangesInformation::Iterator it = aChanges.begin(); it != stop; ++it)
+ for (std::vector< configuration::NodeChangeInformation >::const_iterator it = aChanges.begin(); it != stop; ++it)
{
OSL_ENSURE( m_aChangingNodes.find( it->location.getChangingValueID() ) != m_aChangingNodes.end(), "Broadcasting unanticipated change");
@@ -688,19 +649,16 @@ namespace configmgr
}
// -----------------------------------------------------------------------------------------------
- void MultiChangeBroadcaster_Impl::doNotifyListeners(NodeChangesInformation const& aChanges)
+ void MultiChangeBroadcaster_Impl::doNotifyListeners(configuration::NodeChangesInformation const& aChanges)
{
- using css::beans::XPropertiesChangeListener;
- using css::beans::PropertyChangeEvent;
-
- uno::Sequence< PropertyChangeEvent > aPropertyEvents(aChanges.size());
+ uno::Sequence< css::beans::PropertyChangeEvent > aPropertyEvents(aChanges.size());
- PropertyChangeEvent * const pEventStart = aPropertyEvents.getArray();
- PropertyChangeEvent * pEventNext = pEventStart;
+ css::beans::PropertyChangeEvent * const pEventStart = aPropertyEvents.getArray();
+ css::beans::PropertyChangeEvent * pEventNext = pEventStart;
- NodeChangesInformation::Iterator const stop = aChanges.end(), last = stop-1;
+ std::vector< configuration::NodeChangeInformation >::const_iterator const stop = aChanges.end(), last = stop-1;
- for (NodeChangesInformation::Iterator it = aChanges.begin(); it != stop; ++it)
+ for (std::vector< configuration::NodeChangeInformation >::const_iterator it = aChanges.begin(); it != stop; ++it)
{
// #92463# Skip nodes that are not in the tree
if (it->location.getAffectedNodeID().isEmpty()) continue;
@@ -718,16 +676,15 @@ namespace configmgr
if (nPropertyEvents != aPropertyEvents.getLength())
aPropertyEvents.realloc(nPropertyEvents);
- typedef ListenerContainerIterator< XPropertiesChangeListener > ListenerIterator;
- uno::Reference< XPropertiesChangeListener > const * const SelectListener = 0;
+ uno::Reference< css::beans::XPropertiesChangeListener > const * const SelectListener = 0;
- NotifierImplHolder pNotifierImpl = getNotifierData().first;
+ vos::ORef<NotifierImpl> pNotifierImpl = getNotifierData().first;
- ListenerContainer* pContainer = pNotifierImpl->m_aListeners.getContainer( getNodeIndex(), getCppuType(SelectListener) );
+ cppu::OInterfaceContainerHelper* pContainer = pNotifierImpl->m_aListeners.getContainer( getNodeIndex(), getCppuType(SelectListener) );
if (pContainer)
{
- ListenerIterator aIterator(*pContainer);
+ ListenerContainerIterator< css::beans::XPropertiesChangeListener > aIterator(*pContainer);
UnoApiLockReleaser aGuardReleaser;
while (aIterator.hasMoreElements())
try { aIterator.next()->propertiesChange(aPropertyEvents); } catch (uno::Exception & ) {}
@@ -739,8 +696,8 @@ namespace configmgr
// -----------------------------------------------------------------------------------------------
SingleTreeBroadcaster_Impl::SingleTreeBroadcaster_Impl(
- NotifierData const& aTreeNotifierData,
- BroadcasterList& aBroadcasters
+ NotifierSet::value_type const& aTreeNotifierData,
+ std::vector< vos::ORef<NodeLocalBroadcaster_Impl> >& aBroadcasters
)
: Broadcaster::Impl(aTreeNotifierData)
, m_aBroadcasters()
@@ -750,11 +707,11 @@ namespace configmgr
// -----------------------------------------------------------------------------------------------
- bool SingleTreeBroadcaster_Impl::selectChanges(NodeChangesInformation& rSelected, NodeChangesInformation const& aOriginal, NodeID const& aSelector)
+ bool SingleTreeBroadcaster_Impl::selectChanges(configuration::NodeChangesInformation& rSelected, configuration::NodeChangesInformation const& aOriginal, configuration::NodeID const& aSelector)
{
OSL_ASSERT(rSelected.empty()); // nothing in there yet
- for (NodeChangesInformation::Iterator it = aOriginal.begin(); it != aOriginal.end(); ++it)
+ for (std::vector< configuration::NodeChangeInformation >::const_iterator it = aOriginal.begin(); it != aOriginal.end(); ++it)
{
if ( it->location.getAffectedNodeID() == aSelector )
{
@@ -765,27 +722,27 @@ namespace configmgr
}
// -----------------------------------------------------------------------------------------------
- BroadcasterImplRef SingleTreeBroadcaster_Impl::create(
- NotifierData const& rRootNotifier,
- NotifierData const& rLocalNotifier,
- NodeChangesInformation const& aChanges)
+ vos::ORef< Broadcaster::Impl > SingleTreeBroadcaster_Impl::create(
+ NotifierSet::value_type const& rRootNotifier,
+ NotifierSet::value_type const& rLocalNotifier,
+ configuration::NodeChangesInformation const& aChanges)
{
- NodeSet aNodes;
- for (NodeChangesInformation::Iterator itChanges = aChanges.begin(); itChanges != aChanges.end(); ++itChanges)
+ std::set< configuration::NodeID > aNodes;
+ for (std::vector< configuration::NodeChangeInformation >::const_iterator itChanges = aChanges.begin(); itChanges != aChanges.end(); ++itChanges)
{
OSL_ENSURE(itChanges->hasValidLocation(), "ERROR: Invalid Change Location for Broadcaster");
- NodeID aAffectedNodeID = itChanges->location.getAffectedNodeID();
+ configuration::NodeID aAffectedNodeID = itChanges->location.getAffectedNodeID();
if (!aAffectedNodeID.isEmpty())
aNodes.insert(aAffectedNodeID);
}
- BroadcasterList aNodecasters;
- for (NodeSet::const_iterator itNodes = aNodes.begin(); itNodes != aNodes.end(); ++itNodes)
+ std::vector< vos::ORef<NodeLocalBroadcaster_Impl> > aNodecasters;
+ for (std::set< configuration::NodeID >::const_iterator itNodes = aNodes.begin(); itNodes != aNodes.end(); ++itNodes)
{
OSL_ASSERT(itNodes->isValidNode()); // filtered empty ones above
- NodeChangesInformation aSelectedChanges;
+ configuration::NodeChangesInformation aSelectedChanges;
if ( selectChanges(aSelectedChanges, aChanges, *itNodes))
{
NodeLocalBroadcaster_Impl* pSelectedImpl = MultiChangeBroadcaster_Impl::create(rLocalNotifier, *itNodes, aSelectedChanges);
@@ -804,21 +761,21 @@ namespace configmgr
return new SingleTreeBroadcaster_Impl(rRootNotifier, aNodecasters);
}
// -----------------------------------------------------------------------------------------------
- void SingleTreeBroadcaster_Impl::doQueryConstraints(NodeChangesInformation const& aChanges)
+ void SingleTreeBroadcaster_Impl::doQueryConstraints(configuration::NodeChangesInformation const& aChanges)
{
- for(BroadcasterList::iterator it = m_aBroadcasters.begin(); it != m_aBroadcasters.end(); ++it)
+ for(std::vector< vos::ORef<NodeLocalBroadcaster_Impl> >::iterator it = m_aBroadcasters.begin(); it != m_aBroadcasters.end(); ++it)
{
- NodeChangesInformation aSelectedInfos;
+ configuration::NodeChangesInformation aSelectedInfos;
if ( selectChanges(aSelectedInfos, aChanges, (*it)->getAffectedNodeID()) )
(*it)->queryConstraints(aSelectedInfos);
}
}
// -----------------------------------------------------------------------------------------------
- void SingleTreeBroadcaster_Impl::doNotifyListeners(NodeChangesInformation const& aChanges)
+ void SingleTreeBroadcaster_Impl::doNotifyListeners(configuration::NodeChangesInformation const& aChanges)
{
- for(BroadcasterList::iterator it = m_aBroadcasters.begin(); it != m_aBroadcasters.end(); ++it)
+ for(std::vector< vos::ORef<NodeLocalBroadcaster_Impl> >::iterator it = m_aBroadcasters.begin(); it != m_aBroadcasters.end(); ++it)
{
- NodeChangesInformation aSelectedInfos;
+ configuration::NodeChangesInformation aSelectedInfos;
if ( selectChanges(aSelectedInfos, aChanges, (*it)->getAffectedNodeID()) )
(*it)->notifyListeners(aSelectedInfos);
}
@@ -826,7 +783,7 @@ namespace configmgr
// -----------------------------------------------------------------------------------------------
// MultiTreeBroadcaster_Impl
// -----------------------------------------------------------------------------------------------
- MultiTreeBroadcaster_Impl::MultiTreeBroadcaster_Impl(NotifierData const& aRootSelector, BroadcasterList& aBroadcasters)
+ MultiTreeBroadcaster_Impl::MultiTreeBroadcaster_Impl(NotifierSet::value_type const& aRootSelector, std::vector< vos::ORef< Broadcaster::Impl > >& aBroadcasters)
: Broadcaster::Impl(aRootSelector)
, m_aBroadcasters()
{
@@ -835,18 +792,18 @@ namespace configmgr
// -----------------------------------------------------------------------------------------------
- bool MultiTreeBroadcaster_Impl::selectChanges(NodeChangesInformation& rSelected, NodeChangesInformation const& aOriginal, NotifierData const& aSelector)
+ bool MultiTreeBroadcaster_Impl::selectChanges(configuration::NodeChangesInformation& rSelected, configuration::NodeChangesInformation const& aOriginal, NotifierSet::value_type const& aSelector)
{
OSL_ASSERT(aSelector.first.isValid());
OSL_ASSERT(aSelector.second.is());
OSL_ASSERT(rSelected.empty()); // nothing in there yet
- TreeRef const aSelectedTree( aSelector.second->getTree() );
+ rtl::Reference< configuration::Tree > const aSelectedTree( aSelector.second->getTree() );
- for (NodeChangesInformation::Iterator it = aOriginal.begin(); it != aOriginal.end(); ++it)
+ for (std::vector< configuration::NodeChangeInformation >::const_iterator it = aOriginal.begin(); it != aOriginal.end(); ++it)
{
- if ( configuration::equalTreeRef(it->location.getAffectedTreeRef(),aSelectedTree) )
+ if (it->location.getAffectedTreeRef() == aSelectedTree)
{
rSelected.push_back(*it);
}
@@ -855,15 +812,15 @@ namespace configmgr
}
// -------------------------------------------------------------------------------------------
- BroadcasterImplRef MultiTreeBroadcaster_Impl::create(NotifierData const& rRootNotifier, NotifierSet const& rNotifiers, NodeChangesInformation const& aChanges)
+ vos::ORef< Broadcaster::Impl > MultiTreeBroadcaster_Impl::create(NotifierSet::value_type const& rRootNotifier, NotifierSet const& rNotifiers, configuration::NodeChangesInformation const& aChanges)
{
- BroadcasterList aTreecasters;
+ std::vector< vos::ORef< Broadcaster::Impl > > aTreecasters;
for (NotifierSet::const_iterator it = rNotifiers.begin(); it != rNotifiers.end(); ++it)
{
- NodeChangesInformation aSelectedChanges;
+ configuration::NodeChangesInformation aSelectedChanges;
if ( selectChanges(aSelectedChanges, aChanges, *it))
{
- BroadcasterImplRef pSelectedImpl = SingleTreeBroadcaster_Impl::create(rRootNotifier, *it, aSelectedChanges);
+ vos::ORef< Broadcaster::Impl > pSelectedImpl = SingleTreeBroadcaster_Impl::create(rRootNotifier, *it, aSelectedChanges);
if (pSelectedImpl.isValid())
aTreecasters.push_back(pSelectedImpl);
}
@@ -880,22 +837,22 @@ namespace configmgr
}
// -------------------------------------------------------------------------------------------
- void MultiTreeBroadcaster_Impl::doQueryConstraints(NodeChangesInformation const& aChanges)
+ void MultiTreeBroadcaster_Impl::doQueryConstraints(configuration::NodeChangesInformation const& aChanges)
{
- for(BroadcasterList::iterator it = m_aBroadcasters.begin(); it != m_aBroadcasters.end(); ++it)
+ for(std::vector< vos::ORef< Broadcaster::Impl > >::iterator it = m_aBroadcasters.begin(); it != m_aBroadcasters.end(); ++it)
{
- NodeChangesInformation aSelectedInfos;
+ configuration::NodeChangesInformation aSelectedInfos;
if ( selectChanges(aSelectedInfos, aChanges, (*it)->getNotifierData()) )
(*it)->queryConstraints(aSelectedInfos);
}
}
// -------------------------------------------------------------------------------------------
- void MultiTreeBroadcaster_Impl::doNotifyListeners(NodeChangesInformation const& aChanges)
+ void MultiTreeBroadcaster_Impl::doNotifyListeners(configuration::NodeChangesInformation const& aChanges)
{
- for(BroadcasterList::iterator it = m_aBroadcasters.begin(); it != m_aBroadcasters.end(); ++it)
+ for(std::vector< vos::ORef< Broadcaster::Impl > >::iterator it = m_aBroadcasters.begin(); it != m_aBroadcasters.end(); ++it)
{
- NodeChangesInformation aSelectedInfos;
+ configuration::NodeChangesInformation aSelectedInfos;
if ( selectChanges(aSelectedInfos, aChanges, (*it)->getNotifierData()) )
(*it)->notifyListeners(aSelectedInfos);
}
@@ -904,22 +861,22 @@ namespace configmgr
}
// ---------------------------------------------------------------------------------------------------
- BroadcasterImplRef Broadcaster::Impl::create(NotifierHolder const& rNotifierImpl, ApiTreeRef const& pTreeImpl, NodeChange const& aChange, bool bLocal)
+ vos::ORef< Broadcaster::Impl > Broadcaster::Impl::create(vos::ORef<NotifierImpl> const& rNotifierImpl, ApiTreeRef const& pTreeImpl, configuration::NodeChange const& aChange, bool bLocal)
{
OSL_ASSERT(pTreeImpl.is());
- BroadcasterImplRef pRet;
+ vos::ORef< Broadcaster::Impl > pRet;
- NodeChangeLocation aLocation;
+ configuration::NodeChangeLocation aLocation;
if (aChange.getChangeLocation(aLocation))
{
if (bLocal)
{
- pRet = SingleChangeBroadcaster_Impl::create( NotifierData(rNotifierImpl,pTreeImpl), aLocation);
+ pRet = SingleChangeBroadcaster_Impl::create( NotifierSet::value_type(rNotifierImpl,pTreeImpl), aLocation);
}
else
{
- NotifierData aAffectedNotifier( findNotifier(aLocation, pTreeImpl) );
+ NotifierSet::value_type aAffectedNotifier( findNotifier(aLocation, pTreeImpl) );
if (aAffectedNotifier.second.is()) // only if we found a notifier we are able to create a broadcaster (DG)
pRet = SingleChangeBroadcaster_Impl::create( aAffectedNotifier, aLocation);
}
@@ -931,17 +888,17 @@ namespace configmgr
}
if (pRet.isEmpty())
- pRet = EmptyBroadcaster_Impl::create( NotifierData(rNotifierImpl,pTreeImpl) );
+ pRet = EmptyBroadcaster_Impl::create( NotifierSet::value_type(rNotifierImpl,pTreeImpl) );
return pRet;
}
// ---------------------------------------------------------------------------------------------------
- BroadcasterImplRef Broadcaster::Impl::create(NotifierHolder const& rNotifierImpl, ApiTreeRef const& pTreeImpl, NodeChanges const& aChanges, bool bLocal)
+ vos::ORef< Broadcaster::Impl > Broadcaster::Impl::create(vos::ORef<NotifierImpl> const& rNotifierImpl, ApiTreeRef const& pTreeImpl, configuration::NodeChanges const& aChanges, bool bLocal)
{
- NotifierData aRootData(rNotifierImpl, pTreeImpl);
+ NotifierSet::value_type aRootData(rNotifierImpl, pTreeImpl);
- NodeChangesInformation aChangeInfos;
+ configuration::NodeChangesInformation aChangeInfos;
if (aChanges.getChangesInfos(aChangeInfos))
{
return create(rNotifierImpl,pTreeImpl,aChangeInfos,bLocal);
@@ -951,7 +908,7 @@ namespace configmgr
OSL_ENSURE(aChanges.isEmpty(), "Cannot get information for changes - cannot notify");
// make an empty one below
- BroadcasterImplRef pRet = EmptyBroadcaster_Impl::create( aRootData );
+ vos::ORef< Broadcaster::Impl > pRet = EmptyBroadcaster_Impl::create( aRootData );
return pRet;
}
@@ -959,21 +916,21 @@ namespace configmgr
}
// ---------------------------------------------------------------------------------------------------
- BroadcasterImplRef Broadcaster::Impl::create(NotifierHolder const& rNotifierImpl, ApiTreeRef const& pTreeImpl, NodeChangeInformation const& aChange, bool bLocal)
+ vos::ORef< Broadcaster::Impl > Broadcaster::Impl::create(vos::ORef<NotifierImpl> const& rNotifierImpl, ApiTreeRef const& pTreeImpl, configuration::NodeChangeInformation const& aChange, bool bLocal)
{
OSL_ASSERT(pTreeImpl.is());
- BroadcasterImplRef pRet;
+ vos::ORef< Broadcaster::Impl > pRet;
if (aChange.hasValidLocation())
{
if (bLocal)
{
- pRet = SingleChangeBroadcaster_Impl::create( NotifierData(rNotifierImpl,pTreeImpl), aChange.location);
+ pRet = SingleChangeBroadcaster_Impl::create( NotifierSet::value_type(rNotifierImpl,pTreeImpl), aChange.location);
}
else
{
- NotifierData aAffectedNotifier( findNotifier(aChange.location, pTreeImpl) );
+ NotifierSet::value_type aAffectedNotifier( findNotifier(aChange.location, pTreeImpl) );
if (aAffectedNotifier.second.is()) // only if we found a notifier we are able to create a broadcaster (DG)
pRet = SingleChangeBroadcaster_Impl::create( aAffectedNotifier, aChange.location);
}
@@ -985,17 +942,17 @@ namespace configmgr
}
if (pRet.isEmpty())
- pRet = EmptyBroadcaster_Impl::create( NotifierData(rNotifierImpl,pTreeImpl) );
+ pRet = EmptyBroadcaster_Impl::create( NotifierSet::value_type(rNotifierImpl,pTreeImpl) );
return pRet;
}
// ---------------------------------------------------------------------------------------------------
- BroadcasterImplRef Broadcaster::Impl::create(NotifierHolder const& rNotifierImpl, ApiTreeRef const& pTreeImpl, NodeChangesInformation const& aChanges, bool bLocal)
+ vos::ORef< Broadcaster::Impl > Broadcaster::Impl::create(vos::ORef<NotifierImpl> const& rNotifierImpl, ApiTreeRef const& pTreeImpl, configuration::NodeChangesInformation const& aChanges, bool bLocal)
{
- BroadcasterImplRef pRet;
+ vos::ORef< Broadcaster::Impl > pRet;
- NotifierData aRootData(rNotifierImpl, pTreeImpl);
+ NotifierSet::value_type aRootData(rNotifierImpl, pTreeImpl);
if (aChanges.size() == 1)
{
@@ -1028,27 +985,24 @@ namespace configmgr
}
// ---------------------------------------------------------------------------------------------------
- bool Broadcaster::Impl::translateChanges(NodeChangesInformation& _rInfos, NodeChanges const& aChanges, bool /*bSingleBase*/) const
+ bool Broadcaster::Impl::translateChanges(configuration::NodeChangesInformation& _rInfos, configuration::NodeChanges const& aChanges, bool /*bSingleBase*/) const
{
- TreeRef aBaseTree = m_aNotifierData.second->getTree();
+ rtl::Reference< configuration::Tree > aBaseTree = m_aNotifierData.second->getTree();
Factory& rFactory = m_aNotifierData.second->getFactory();
- NodeChangesInformation aRawInfos;
+ configuration::NodeChangesInformation aRawInfos;
sal_uInt32 nChanges = aChanges.getChangesInfos(aRawInfos);
OSL_ENSURE(nChanges, "Cannot get info(s) for change - skipping for notification");
OSL_ENSURE(nChanges == aRawInfos.size(), "Incorrect change count returned");
- NodeChangesInformation aNewInfos;
+ configuration::NodeChangesInformation aNewInfos;
aNewInfos.reserve(nChanges);
- // enabling the Single base optimization requires a base node (not only a base tree) for correct accessors
- //if (!bSingleBase || !configuration::equalTree(aBaseTree,aNewChange.info.baseTree))
-
- for (NodeChangesInformation::Iterator pos = aRawInfos.begin(); pos != aRawInfos.end(); ++pos)
+ for (std::vector< configuration::NodeChangeInformation >::const_iterator pos = aRawInfos.begin(); pos != aRawInfos.end(); ++pos)
{
- NodeChangeInformation aInfo = *pos;
+ configuration::NodeChangeInformation aInfo = *pos;
if( !configapi::rebaseChange(aInfo.location,aBaseTree) )
{
OSL_TRACE("Change is not within expected tree - skipping for notification");
@@ -1069,19 +1023,17 @@ namespace configmgr
// ---------------------------------------------------------------------------------------------------
- bool Broadcaster::Impl::translateChanges(NodeChangesInformation& aInfos, NodeChangesInformation const& aChanges, bool /*bSingleBase*/) const
+ bool Broadcaster::Impl::translateChanges(configuration::NodeChangesInformation& aInfos, configuration::NodeChangesInformation const& aChanges, bool /*bSingleBase*/) const
{
- NodeChangesInformation aNewInfos;
+ configuration::NodeChangesInformation aNewInfos;
aNewInfos.reserve( aChanges.size() );
- TreeRef aBaseTree = m_aNotifierData.second->getTree();
+ rtl::Reference< configuration::Tree > aBaseTree = m_aNotifierData.second->getTree();
Factory& rFactory = m_aNotifierData.second->getFactory();
- for (NodeChangesInformation::Iterator it = aChanges.begin(); it != aChanges.end(); ++it)
+ for (std::vector< configuration::NodeChangeInformation >::const_iterator it = aChanges.begin(); it != aChanges.end(); ++it)
{
- NodeChangeInformation aInfo(*it);
- // enabling the Single base optimization requires a base node (not only a base tree) for correct accessors
- //if (!bSingleBase || !configuration::equalTree(aBaseTree,aNewChange.info.baseTree))
+ configuration::NodeChangeInformation aInfo(*it);
if( !configapi::rebaseChange(aInfo.location,aBaseTree) )
{
OSL_TRACE("Change is not within expected tree - skipping for notification");
@@ -1102,33 +1054,33 @@ namespace configmgr
}
// ---------------------------------------------------------------------------------------------------
- void Broadcaster::Impl::notifyRootListeners(NodeChangesInformation const& aChanges)
+ void Broadcaster::Impl::notifyRootListeners(configuration::NodeChangesInformation const& aChanges)
{
if (aChanges.empty()) return;
ApiTreeRef pRootTree( m_aNotifierData.second->getRootTreeImpl() );
if (pRootTree.is())
{
- NotifierHolder aRootNotifier = BroadcasterHelper::getImpl(pRootTree->getNotifier());
+ vos::ORef<NotifierImpl> aRootNotifier = BroadcasterHelper::getImpl(pRootTree->getNotifier());
if (aRootNotifier.isValid())
{
uno::Reference< css::util::XChangesListener > const * const pSelect = 0;
- NodeID aNotifiedNode = makeRootID( pRootTree );
+ configuration::NodeID aNotifiedNode = makeRootID( pRootTree );
- if (ListenerContainer* pContainer = aRootNotifier->m_aListeners.getContainer(aNotifiedNode.toIndex(), ::getCppuType(pSelect)) )
+ if (cppu::OInterfaceContainerHelper* pContainer = aRootNotifier->m_aListeners.getContainer(aNotifiedNode.toIndex(), ::getCppuType(pSelect)) )
{
css::util::ChangesEvent aEvent;
aEvent.Source = pRootTree->getUnoInstance();
- UnoInterfaceRef xBaseInstance = m_aNotifierData.second->getUnoInstance();
+ uno::Reference<uno::XInterface> xBaseInstance = m_aNotifierData.second->getUnoInstance();
aEvent.Base <<= xBaseInstance;
// translate and collect the changes
aEvent.Changes.realloc(aChanges.size());
css::util::ElementChange* pChange = aEvent.Changes.getArray();
- for (NodeChangesInformation::Iterator it = aChanges.begin(); it != aChanges.end(); ++it)
+ for (std::vector< configuration::NodeChangeInformation >::const_iterator it = aChanges.begin(); it != aChanges.end(); ++it)
{
fillChangeFromResolved(*pChange, *it);
++pChange;
@@ -1148,25 +1100,25 @@ namespace configmgr
// ---------------------------------------------------------------------------------------------------
// class Broadcaster
// ---------------------------------------------------------------------------------------------------
-Broadcaster::Broadcaster(Notifier const& aNotifier, NodeChange const& aChange, bool bLocal)
+Broadcaster::Broadcaster(Notifier const& aNotifier, configuration::NodeChange const& aChange, bool bLocal)
: m_pImpl( Impl::create(aNotifier.m_aImpl,ApiTreeRef(aNotifier.m_pTree),aChange,bLocal) )
{
OSL_ASSERT(m_pImpl.isValid());
}
// ---------------------------------------------------------------------------------------------------
-Broadcaster::Broadcaster(Notifier const& aNotifier, NodeChanges const& aChanges, bool bLocal)
+Broadcaster::Broadcaster(Notifier const& aNotifier, configuration::NodeChanges const& aChanges, bool bLocal)
: m_pImpl( Impl::create(aNotifier.m_aImpl,ApiTreeRef(aNotifier.m_pTree),aChanges,bLocal) )
{
OSL_ASSERT(m_pImpl.isValid());
}
// ---------------------------------------------------------------------------------------------------
-Broadcaster::Broadcaster(Notifier const& aNotifier, NodeChangeInformation const& aChange, bool bLocal)
+Broadcaster::Broadcaster(Notifier const& aNotifier, configuration::NodeChangeInformation const& aChange, bool bLocal)
: m_pImpl( Impl::create(aNotifier.m_aImpl,ApiTreeRef(aNotifier.m_pTree),aChange,bLocal) )
{
OSL_ASSERT(m_pImpl.isValid());
}
// ---------------------------------------------------------------------------------------------------
-Broadcaster::Broadcaster(Notifier const& aNotifier, NodeChangesInformation const& aChanges, bool bLocal)
+Broadcaster::Broadcaster(Notifier const& aNotifier, configuration::NodeChangesInformation const& aChanges, bool bLocal)
: m_pImpl( Impl::create(aNotifier.m_aImpl,ApiTreeRef(aNotifier.m_pTree),aChanges,bLocal) )
{
OSL_ASSERT(m_pImpl.isValid());
@@ -1185,23 +1137,23 @@ Broadcaster::~Broadcaster()
}
// ---------------------------------------------------------------------------------------------------
-void Broadcaster::queryConstraints(NodeChange const& aChange) throw(beans::PropertyVetoException)
+void Broadcaster::queryConstraints(configuration::NodeChange const& aChange) throw(beans::PropertyVetoException)
{
OSL_ENSURE(aChange.isChange(),"Constraint query without a change !");
- NodeChanges aChanges;
+ configuration::NodeChanges aChanges;
aChanges.add(aChange);
this->queryConstraints(aChanges,true);
}
// ---------------------------------------------------------------------------------------------------
-void Broadcaster::queryConstraints(NodeChanges const& aChanges, bool bSingleBase) throw(beans::PropertyVetoException)
+void Broadcaster::queryConstraints(configuration::NodeChanges const& aChanges, bool bSingleBase) throw(beans::PropertyVetoException)
{
OSL_ENSURE(!aChanges.isEmpty(),"Constraint query without a change !");
try
{
- NodeChangesInformation aInfos;
+ configuration::NodeChangesInformation aInfos;
if (m_pImpl->translateChanges(aInfos,aChanges,bSingleBase))
{
m_pImpl->queryConstraints(aInfos);
@@ -1222,33 +1174,33 @@ void Broadcaster::queryConstraints(NodeChanges const& aChanges, bool bSingleBase
}
// ---------------------------------------------------------------------------------------------------
-void Broadcaster::notifyListeners(NodeChange const& aChange) throw()
+void Broadcaster::notifyListeners(configuration::NodeChange const& aChange) throw()
{
OSL_ENSURE(aChange.isChange(),"Notifying without a change !");
- NodeChanges aChanges;
+ configuration::NodeChanges aChanges;
aChanges.add(aChange);
this->notifyListeners(aChanges, true);
}
// ---------------------------------------------------------------------------------------------------
-void Broadcaster::notifyListeners(NodeChangeInformation const& aChange) throw()
+void Broadcaster::notifyListeners(configuration::NodeChangeInformation const& aChange) throw()
{
OSL_ENSURE(!aChange.isEmptyChange(),"Notifying without a change !");
- NodeChangesInformation aChanges;
+ configuration::NodeChangesInformation aChanges;
aChanges.push_back(aChange);
this->notifyListeners(aChanges, true);
}
// ---------------------------------------------------------------------------------------------------
-void Broadcaster::notifyListeners(NodeChanges const& aChanges, bool bSingleBase) throw()
+void Broadcaster::notifyListeners(configuration::NodeChanges const& aChanges, bool bSingleBase) throw()
{
OSL_ENSURE(!aChanges.isEmpty(),"Notifying without a change !");
try
{
- NodeChangesInformation aInfos;
+ configuration::NodeChangesInformation aInfos;
if (m_pImpl->translateChanges(aInfos,aChanges, bSingleBase))
{
m_pImpl->notifyListeners(aInfos);
@@ -1266,13 +1218,13 @@ void Broadcaster::notifyListeners(NodeChanges const& aChanges, bool bSingleBase)
}
// ---------------------------------------------------------------------------------------------------
-void Broadcaster::notifyListeners(NodeChangesInformation const& aChanges, bool bSingleBase) throw()
+void Broadcaster::notifyListeners(configuration::NodeChangesInformation const& aChanges, bool bSingleBase) throw()
{
OSL_ENSURE(!aChanges.empty(),"Notifying without a change !");
try
{
- NodeChangesInformation aInfos;
+ configuration::NodeChangesInformation aInfos;
if (m_pImpl->translateChanges(aInfos,aChanges, bSingleBase))
{
m_pImpl->notifyListeners(aInfos);
diff --git a/configmgr/source/api2/broadcaster.hxx b/configmgr/source/api2/broadcaster.hxx
index 70b37ec089..3923e05b44 100644
--- a/configmgr/source/api2/broadcaster.hxx
+++ b/configmgr/source/api2/broadcaster.hxx
@@ -48,11 +48,6 @@ namespace configmgr
// ---------------------------------------------------------------------------------------------------
namespace configapi
{
- using configuration::NodeChange;
- using configuration::NodeChanges;
- using configuration::NodeChangeInformation;
- using configuration::NodeChangesInformation;
-
class Notifier;
namespace css = ::com::sun::star;
@@ -63,26 +58,26 @@ namespace configmgr
{
public:
/// construct a broadcaster
- Broadcaster(Notifier const& aNotifier, NodeChange const& aChange, bool bLocal);
- Broadcaster(Notifier const& aNotifier, NodeChanges const& aChanges, bool bLocal);
- Broadcaster(Notifier const& aNotifier, NodeChangeInformation const& aChange, bool bLocal);
- Broadcaster(Notifier const& aNotifier, NodeChangesInformation const& aChanges, bool bLocal);
+ Broadcaster(Notifier const& aNotifier, configuration::NodeChange const& aChange, bool bLocal);
+ Broadcaster(Notifier const& aNotifier, configuration::NodeChanges const& aChanges, bool bLocal);
+ Broadcaster(Notifier const& aNotifier, configuration::NodeChangeInformation const& aChange, bool bLocal);
+ Broadcaster(Notifier const& aNotifier, configuration::NodeChangesInformation const& aChanges, bool bLocal);
Broadcaster(Broadcaster const& aOther);
~Broadcaster();
/// give all property veto listeners on the affected node a chance to veto
- void queryConstraints(NodeChange const& aChange) throw(css::beans::PropertyVetoException);
+ void queryConstraints(configuration::NodeChange const& aChange) throw(css::beans::PropertyVetoException);
/// give all property veto listeners on any of the affected nodes a chance to veto
- void queryConstraints(NodeChanges const& aChanges, bool bSingleBase = true) throw(css::beans::PropertyVetoException);
+ void queryConstraints(configuration::NodeChanges const& aChanges, bool bSingleBase = true) throw(css::beans::PropertyVetoException);
/// notify all listeners which are affected by this change
- void notifyListeners(NodeChange const& aChange) throw();
+ void notifyListeners(configuration::NodeChange const& aChange) throw();
/// notify all listeners which are affected by any of these changes (potentially from many different bases)
- void notifyListeners(NodeChanges const& aChanges, bool bSingleBase) throw();
+ void notifyListeners(configuration::NodeChanges const& aChanges, bool bSingleBase) throw();
/// notify all listeners which are affected by this change
- void notifyListeners(NodeChangeInformation const& aChange) throw();
+ void notifyListeners(configuration::NodeChangeInformation const& aChange) throw();
/// notify all listeners which are affected by any of these changes (potentially from many different bases)
- void notifyListeners(NodeChangesInformation const& aChanges, bool bSingleBase = false) throw();
+ void notifyListeners(configuration::NodeChangesInformation const& aChanges, bool bSingleBase = false) throw();
class Impl;
private:
diff --git a/configmgr/source/api2/committer.cxx b/configmgr/source/api2/committer.cxx
index 2f50df1c7e..ffbd3bebe6 100644
--- a/configmgr/source/api2/committer.cxx
+++ b/configmgr/source/api2/committer.cxx
@@ -33,9 +33,8 @@
#include <stdio.h>
#include "committer.hxx"
#include "apitreeimplobj.hxx"
+#include "providerimpl.hxx"
#include "roottree.hxx"
-#include "confproviderimpl2.hxx"
-#include "treeaccessor.hxx"
#include "treechangelist.hxx"
namespace configmgr
@@ -44,9 +43,6 @@ namespace configmgr
namespace configapi
{
//-----------------------------------------------------------------------------
- using configuration::Tree;
- using configuration::CommitHelper;
-//-----------------------------------------------------------------------------
namespace
{
//-------------------------------------------------------------------------
@@ -78,7 +74,7 @@ Committer::Committer(ApiRootTreeImpl& rTree)
{}
//-----------------------------------------------------------------------------
-ITreeManager* Committer::getUpdateProvider()
+OProviderImpl * Committer::getUpdateProvider()
{
return &m_rTree.getApiTree().getProvider().getProviderImpl();
}
@@ -95,18 +91,18 @@ void Committer::commit()
RequestOptions aOptions = m_rTree.getOptions()->getRequestOptions();
- ITreeManager* pUpdateProvider = getUpdateProvider();
+ OProviderImpl * pUpdateProvider = getUpdateProvider();
OSL_ASSERT(pUpdateProvider);
- Tree aTree( rApiTree.getTree());
- if (!aTree.hasChanges()) return;
+ rtl::Reference< configuration::Tree > aTree( rApiTree.getTree());
+ if (!aTree->hasChanges()) return;
TreeChangeList aChangeList(aOptions,
- aTree.getRootPath(),
- aTree.getAttributes(aTree.getRootNode()));
+ aTree->getRootPath(),
+ aTree->getAttributes(aTree->getRootNode()));
// now do the commit
- CommitHelper aHelper(rApiTree.getTree());
+ configuration::CommitHelper aHelper(rApiTree.getTree());
if (aHelper.prepareCommit(aChangeList))
try
{
diff --git a/configmgr/source/api2/committer.hxx b/configmgr/source/api2/committer.hxx
index 7917bc747c..88011297c3 100644
--- a/configmgr/source/api2/committer.hxx
+++ b/configmgr/source/api2/committer.hxx
@@ -33,7 +33,7 @@
namespace configmgr
{
- class ITreeManager;
+ class OProviderImpl;
//-----------------------------------------------------------------------------
namespace configapi
{
@@ -51,7 +51,7 @@ namespace configmgr
void commit();
private:
- ITreeManager* getUpdateProvider();
+ OProviderImpl * getUpdateProvider();
};
//-----------------------------------------------------------------------------
}
diff --git a/configmgr/source/api2/confignotifier.cxx b/configmgr/source/api2/confignotifier.cxx
index 9995835c06..59413e0f4c 100644
--- a/configmgr/source/api2/confignotifier.cxx
+++ b/configmgr/source/api2/confignotifier.cxx
@@ -52,16 +52,10 @@ namespace configmgr
namespace configapi
{
// ---------------------------------------------------------------------------------------------------
-
- using configuration::Tree;
- using configuration::NodeID;
- using configuration::SubNodeID;
-
-// ---------------------------------------------------------------------------------------------------
// class Notifier (-Impl)
// ---------------------------------------------------------------------------------------------------
-Notifier::Notifier(NotifierHolder const& aImpl,ApiTreeImpl const* pTree)
+Notifier::Notifier(vos::ORef<NotifierImpl> const& aImpl,ApiTreeImpl const* pTree)
: m_aImpl(aImpl)
, m_pTree(pTree)
{
@@ -82,21 +76,21 @@ Notifier::~Notifier()
}
// ---------------------------------------------------------------------------------------------------
-Broadcaster Notifier::makeBroadcaster(NodeChange const& aChange, bool bLocal) const
+Broadcaster Notifier::makeBroadcaster(configuration::NodeChange const& aChange, bool bLocal) const
{
return Broadcaster(*this,aChange,bLocal);
}
// ---------------------------------------------------------------------------------------------------
-Broadcaster Notifier::makeBroadcaster(NodeChanges const& aChanges, bool bLocal) const
+Broadcaster Notifier::makeBroadcaster(configuration::NodeChanges const& aChanges, bool bLocal) const
{
OSL_ENSURE(!aChanges.isEmpty(),"Creating broadcaster for no changes");
return Broadcaster(*this,aChanges,bLocal);
}
// ---------------------------------------------------------------------------------------------------
-NotifierImpl::NotifierImpl(configuration::TreeRef const& aTree)
-: m_aListeners(aTree.getContainedInnerNodeCount(), SubNodeToIndex(aTree))
+NotifierImpl::NotifierImpl(rtl::Reference< configuration::Tree > const& aTree)
+: m_aListeners(aTree->nodeCount(), SubNodeToIndex(aTree))
{
}
// ---------------------------------------------------------------------------------------------------
@@ -107,120 +101,120 @@ NotifierImpl::~NotifierImpl()
// ---------------------------------------------------------------------------------------------------
-void Notifier::add(NodeRef const& aNode, uno::Reference< css::lang::XEventListener > const& xListener) const
+void Notifier::add(configuration::NodeRef const& aNode, uno::Reference< css::lang::XEventListener > const& xListener) const
{
if (xListener.is())
- m_aImpl->add( NodeID(m_pTree->getTree(),aNode), xListener );
+ m_aImpl->add( configuration::NodeID(m_pTree->getTree(),aNode), xListener );
}
// ---------------------------------------------------------------------------------------------------
-void Notifier::add(NodeRef const& aNode, uno::Reference< css::container::XContainerListener > const& xListener) const
+void Notifier::add(configuration::NodeRef const& aNode, uno::Reference< css::container::XContainerListener > const& xListener) const
{
if (xListener.is())
- m_aImpl->add( NodeID(m_pTree->getTree(),aNode), xListener );
+ m_aImpl->add( configuration::NodeID(m_pTree->getTree(),aNode), xListener );
}
// ---------------------------------------------------------------------------------------------------
-void Notifier::add(NodeRef const& aNode, uno::Reference< css::util::XChangesListener > const& xListener) const
+void Notifier::add(configuration::NodeRef const& aNode, uno::Reference< css::util::XChangesListener > const& xListener) const
{
if (xListener.is())
- m_aImpl->add( NodeID(m_pTree->getTree(),aNode), xListener );
+ m_aImpl->add( configuration::NodeID(m_pTree->getTree(),aNode), xListener );
}
// ---------------------------------------------------------------------------------------------------
-void Notifier::addForAll(NodeRef const& aNode, uno::Reference< css::beans::XPropertyChangeListener > const& xListener) const
+void Notifier::addForAll(configuration::NodeRef const& aNode, uno::Reference< css::beans::XPropertyChangeListener > const& xListener) const
{
if (xListener.is())
- m_aImpl->addForAll( NodeID(m_pTree->getTree(),aNode), xListener );
+ m_aImpl->addForAll( configuration::NodeID(m_pTree->getTree(),aNode), xListener );
}
// ---------------------------------------------------------------------------------------------------
-void Notifier::addForOne(NodeRef const& aNode, uno::Reference< css::beans::XPropertyChangeListener > const& xListener, Name const& aName) const
+void Notifier::addForOne(configuration::NodeRef const& aNode, uno::Reference< css::beans::XPropertyChangeListener > const& xListener, rtl::OUString const& aName) const
{
if (xListener.is())
- m_aImpl->addNamed( SubNodeID(m_pTree->getTree(),aNode, aName), xListener );
+ m_aImpl->addNamed( configuration::SubNodeID(m_pTree->getTree(),aNode, aName), xListener );
}
// ---------------------------------------------------------------------------------------------------
-void Notifier::addForAll(NodeRef const& aNode, uno::Reference< css::beans::XVetoableChangeListener > const& xListener) const
+void Notifier::addForAll(configuration::NodeRef const& aNode, uno::Reference< css::beans::XVetoableChangeListener > const& xListener) const
{
if (xListener.is())
- m_aImpl->addForAll( NodeID(m_pTree->getTree(),aNode), xListener );
+ m_aImpl->addForAll( configuration::NodeID(m_pTree->getTree(),aNode), xListener );
}
// ---------------------------------------------------------------------------------------------------
-void Notifier::addForOne(NodeRef const& aNode, uno::Reference< css::beans::XVetoableChangeListener > const& xListener, Name const& aName) const
+void Notifier::addForOne(configuration::NodeRef const& aNode, uno::Reference< css::beans::XVetoableChangeListener > const& xListener, rtl::OUString const& aName) const
{
if (xListener.is())
- m_aImpl->addNamed( SubNodeID(m_pTree->getTree(),aNode, aName), xListener );
+ m_aImpl->addNamed( configuration::SubNodeID(m_pTree->getTree(),aNode, aName), xListener );
}
// ---------------------------------------------------------------------------------------------------
-void Notifier::add(NodeRef const& aNode, uno::Reference< css::beans::XPropertiesChangeListener > const& xListener, uno::Sequence<OUString> const& aNames) const
+void Notifier::add(configuration::NodeRef const& aNode, uno::Reference< css::beans::XPropertiesChangeListener > const& xListener, uno::Sequence<rtl::OUString> const& aNames) const
{
if (xListener.is())
{
if (aNames.getLength() > 0)
- m_aImpl->add( NodeID(m_pTree->getTree(),aNode), xListener, aNames);
+ m_aImpl->add( configuration::NodeID(m_pTree->getTree(),aNode), xListener, aNames);
else
- m_aImpl->add( NodeID(m_pTree->getTree(),aNode), xListener );
+ m_aImpl->add( configuration::NodeID(m_pTree->getTree(),aNode), xListener );
}
}
// ---------------------------------------------------------------------------------------------------
-void Notifier::remove(NodeRef const& aNode, uno::Reference< css::lang::XEventListener > const& xListener) const
+void Notifier::remove(configuration::NodeRef const& aNode, uno::Reference< css::lang::XEventListener > const& xListener) const
{
if (xListener.is())
- m_aImpl->remove( NodeID(m_pTree->getTree(),aNode), xListener );
+ m_aImpl->remove( configuration::NodeID(m_pTree->getTree(),aNode), xListener );
}
// ---------------------------------------------------------------------------------------------------
-void Notifier::remove(NodeRef const& aNode, uno::Reference< css::container::XContainerListener > const& xListener) const
+void Notifier::remove(configuration::NodeRef const& aNode, uno::Reference< css::container::XContainerListener > const& xListener) const
{
if (xListener.is())
- m_aImpl->remove( NodeID(m_pTree->getTree(),aNode), xListener );
+ m_aImpl->remove( configuration::NodeID(m_pTree->getTree(),aNode), xListener );
}
// ---------------------------------------------------------------------------------------------------
-void Notifier::remove(NodeRef const& aNode, uno::Reference< css::util::XChangesListener > const& xListener) const
+void Notifier::remove(configuration::NodeRef const& aNode, uno::Reference< css::util::XChangesListener > const& xListener) const
{
if (xListener.is())
- m_aImpl->remove( NodeID(m_pTree->getTree(),aNode), xListener );
+ m_aImpl->remove( configuration::NodeID(m_pTree->getTree(),aNode), xListener );
}
// ---------------------------------------------------------------------------------------------------
-void Notifier::removeForAll(NodeRef const& aNode, uno::Reference< css::beans::XPropertyChangeListener > const& xListener) const
+void Notifier::removeForAll(configuration::NodeRef const& aNode, uno::Reference< css::beans::XPropertyChangeListener > const& xListener) const
{
if (xListener.is())
- m_aImpl->removeForAll( NodeID(m_pTree->getTree(),aNode), xListener );
+ m_aImpl->removeForAll( configuration::NodeID(m_pTree->getTree(),aNode), xListener );
}
// ---------------------------------------------------------------------------------------------------
-void Notifier::removeForOne(NodeRef const& aNode, uno::Reference< css::beans::XPropertyChangeListener > const& xListener, Name const& aName) const
+void Notifier::removeForOne(configuration::NodeRef const& aNode, uno::Reference< css::beans::XPropertyChangeListener > const& xListener, rtl::OUString const& aName) const
{
if (xListener.is())
- m_aImpl->removeNamed( SubNodeID(m_pTree->getTree(),aNode, aName), xListener );
+ m_aImpl->removeNamed( configuration::SubNodeID(m_pTree->getTree(),aNode, aName), xListener );
}
// ---------------------------------------------------------------------------------------------------
-void Notifier::removeForAll(NodeRef const& aNode, uno::Reference< css::beans::XVetoableChangeListener > const& xListener) const
+void Notifier::removeForAll(configuration::NodeRef const& aNode, uno::Reference< css::beans::XVetoableChangeListener > const& xListener) const
{
if (xListener.is())
- m_aImpl->removeForAll( NodeID(m_pTree->getTree(),aNode), xListener );
+ m_aImpl->removeForAll( configuration::NodeID(m_pTree->getTree(),aNode), xListener );
}
// ---------------------------------------------------------------------------------------------------
-void Notifier::removeForOne(NodeRef const& aNode, uno::Reference< css::beans::XVetoableChangeListener > const& xListener, Name const& aName) const
+void Notifier::removeForOne(configuration::NodeRef const& aNode, uno::Reference< css::beans::XVetoableChangeListener > const& xListener, rtl::OUString const& aName) const
{
if (xListener.is())
- m_aImpl->removeNamed( SubNodeID(m_pTree->getTree(),aNode, aName), xListener );
+ m_aImpl->removeNamed( configuration::SubNodeID(m_pTree->getTree(),aNode, aName), xListener );
}
// ---------------------------------------------------------------------------------------------------
-void Notifier::remove(NodeRef const& aNode, uno::Reference< css::beans::XPropertiesChangeListener > const& xListener) const
+void Notifier::remove(configuration::NodeRef const& aNode, uno::Reference< css::beans::XPropertiesChangeListener > const& xListener) const
{
if (xListener.is())
- m_aImpl->remove( NodeID(m_pTree->getTree(),aNode), xListener );
+ m_aImpl->remove( configuration::NodeID(m_pTree->getTree(),aNode), xListener );
}
// ---------------------------------------------------------------------------------------------------
diff --git a/configmgr/source/api2/confignotifier.hxx b/configmgr/source/api2/confignotifier.hxx
index 01b1191568..bd1c121db2 100644
--- a/configmgr/source/api2/confignotifier.hxx
+++ b/configmgr/source/api2/confignotifier.hxx
@@ -33,7 +33,9 @@
#include "configexcept.hxx"
#include "configpath.hxx"
+#include "datalock.hxx"
#include "utility.hxx"
+#include <boost/utility.hpp>
#include <vos/ref.hxx>
#include <com/sun/star/lang/DisposedException.hpp>
#include <com/sun/star/uno/Sequence.hxx>
@@ -66,26 +68,14 @@ namespace configmgr
class ValueRef;
class NodeChange;
class NodeChanges;
-
- class Name;
-
- typedef uno::RuntimeException UnoError;
}
// ---------------------------------------------------------------------------------------------------
namespace configapi
{
- using configuration::NodeRef;
- using configuration::ValueRef;
- using configuration::NodeChange;
- using configuration::NodeChanges;
-
- using configuration::Name;
-
// ---------------------------------------------------------------------------------------------------
class Broadcaster;
class NotifierImpl;
class ApiTreeImpl;
- typedef vos::ORef<NotifierImpl> NotifierHolder;
namespace css = ::com::sun::star;
// ---------------------------------------------------------------------------------------------------
@@ -94,72 +84,72 @@ namespace configmgr
{
friend class Broadcaster;
friend class BroadcasterHelper;
- NotifierHolder m_aImpl;
+ vos::ORef<NotifierImpl> m_aImpl;
ApiTreeImpl const*const m_pTree;
public:
/// construct this around the given Implementation, for the given tree
- explicit Notifier(NotifierHolder const & aImpl, ApiTreeImpl const* pTree);
+ explicit Notifier(vos::ORef<NotifierImpl> const & aImpl, ApiTreeImpl const* pTree);
Notifier(Notifier const& aOther);
~Notifier();
// ---------------------------------------------------------------------------------------------------
/// create a broadcaster for a single change (either local or (possibly) nested)
- Broadcaster makeBroadcaster(NodeChange const& aChange, bool bLocal) const;
+ Broadcaster makeBroadcaster(configuration::NodeChange const& aChange, bool bLocal) const;
/// create a broadcaster for a collection of changes (either local or (possibly) nested)
- Broadcaster makeBroadcaster(NodeChanges const& aChange, bool bLocal) const;
+ Broadcaster makeBroadcaster(configuration::NodeChanges const& aChange, bool bLocal) const;
// ---------------------------------------------------------------------------------------------------
bool checkAlive(uno::XInterface* pObject) const throw(css::lang::DisposedException);
// ---------------------------------------------------------------------------------------------------
/// Add a <type scope='com::sun::star::lang'>XEventListener</type> observing <var>aNode</var>.
- void add(NodeRef const& aNode, uno::Reference< css::lang::XEventListener > const& xListener) const;
+ void add(configuration::NodeRef const& aNode, uno::Reference< css::lang::XEventListener > const& xListener) const;
/// Add a <type scope='com::sun::star::container'>XContainerListener</type> observing <var>aNode</var>.
- void add(NodeRef const& aNode, uno::Reference< css::container::XContainerListener > const& xListener) const;
+ void add(configuration::NodeRef const& aNode, uno::Reference< css::container::XContainerListener > const& xListener) const;
/// Add a <type scope='com::sun::star::util'>XChangesListener</type> observing <var>aNode</var> and its descendants.
- void add(NodeRef const& aNode, uno::Reference< css::util::XChangesListener > const& xListener) const;
+ void add(configuration::NodeRef const& aNode, uno::Reference< css::util::XChangesListener > const& xListener) const;
/// Add a <type scope='com::sun::star::beans'>XPropertyChangeListener</type> observing all children of <var>aNode</var>.
- void addForAll(NodeRef const& aNode, uno::Reference< css::beans::XPropertyChangeListener > const& xListener) const;
+ void addForAll(configuration::NodeRef const& aNode, uno::Reference< css::beans::XPropertyChangeListener > const& xListener) const;
/// Add a <type scope='com::sun::star::beans'>XPropertyChangeListener</type> observing only the child named <var>aName</var> of <var>aNode</var>.
- void addForOne(NodeRef const& aNode, uno::Reference< css::beans::XPropertyChangeListener > const& xListener, Name const& aName) const;
+ void addForOne(configuration::NodeRef const& aNode, uno::Reference< css::beans::XPropertyChangeListener > const& xListener, rtl::OUString const& aName) const;
/// Add a <type scope='com::sun::star::beans'>XVetoableChangeListener</type> constraining all children of <var>aNode</var>.
- void addForAll(NodeRef const& aNode, uno::Reference< css::beans::XVetoableChangeListener > const& xListener) const;
+ void addForAll(configuration::NodeRef const& aNode, uno::Reference< css::beans::XVetoableChangeListener > const& xListener) const;
/// Add a <type scope='com::sun::star::beans'>XVetoableChangeListener</type> constraining only the child named <var>aName</var> of <var>aNode</var>.
- void addForOne(NodeRef const& aNode, uno::Reference< css::beans::XVetoableChangeListener > const& xListener, Name const& aName) const;
+ void addForOne(configuration::NodeRef const& aNode, uno::Reference< css::beans::XVetoableChangeListener > const& xListener, rtl::OUString const& aName) const;
/** Add a <type scope='com::sun::star::beans'>XPropertiesChangeListener</type>
observing the properties of <var>aNode</var> (optimally only those given by <var>aNames</var>.
*/
- void add(NodeRef const& aNode, uno::Reference< css::beans::XPropertiesChangeListener > const& xListener, uno::Sequence<OUString> const& aNames) const;
+ void add(configuration::NodeRef const& aNode, uno::Reference< css::beans::XPropertiesChangeListener > const& xListener, uno::Sequence<rtl::OUString> const& aNames) const;
// ---------------------------------------------------------------------------------------------------
/// Remove a <type scope='com::sun::star::lang'>XEventListener</type> observing <var>aNode</var>.
- void remove(NodeRef const& aNode, uno::Reference< css::lang::XEventListener > const& xListener) const;
+ void remove(configuration::NodeRef const& aNode, uno::Reference< css::lang::XEventListener > const& xListener) const;
/// Remove a <type scope='com::sun::star::container'>XContainerListener</type> observing <var>aNode</var>.
- void remove(NodeRef const& aNode, uno::Reference< css::container::XContainerListener > const& xListener) const;
+ void remove(configuration::NodeRef const& aNode, uno::Reference< css::container::XContainerListener > const& xListener) const;
/// Remove a <type scope='com::sun::star::util'>XChangesListener</type> observing <var>aNode</var> and its descendants.
- void remove(NodeRef const& aNode, uno::Reference< css::util::XChangesListener > const& xListener) const;
+ void remove(configuration::NodeRef const& aNode, uno::Reference< css::util::XChangesListener > const& xListener) const;
/// Remove a <type scope='com::sun::star::beans'>XPropertyChangeListener</type> observing <var>aNode</var>.
- void removeForAll(NodeRef const& aNode, uno::Reference< css::beans::XPropertyChangeListener > const& xListener) const;
+ void removeForAll(configuration::NodeRef const& aNode, uno::Reference< css::beans::XPropertyChangeListener > const& xListener) const;
/// Remove a <type scope='com::sun::star::beans'>XPropertyChangeListener</type> observing the child named <var>aName</var> of <var>aNode</var>.
- void removeForOne(NodeRef const& aNode, uno::Reference< css::beans::XPropertyChangeListener > const& xListener, Name const& aName) const;
+ void removeForOne(configuration::NodeRef const& aNode, uno::Reference< css::beans::XPropertyChangeListener > const& xListener, rtl::OUString const& aName) const;
/// Remove a <type scope='com::sun::star::beans'>XVetoableChangeListener</type> constraining <var>aNode</var>.
- void removeForAll(NodeRef const& aNode, uno::Reference< css::beans::XVetoableChangeListener > const& xListener) const;
+ void removeForAll(configuration::NodeRef const& aNode, uno::Reference< css::beans::XVetoableChangeListener > const& xListener) const;
/// Remove a <type scope='com::sun::star::beans'>XVetoableChangeListener</type> constraining the child named <var>aName</var> of <var>aNode</var>.
- void removeForOne(NodeRef const& aNode, uno::Reference< css::beans::XVetoableChangeListener > const& xListener, Name const& aName) const;
+ void removeForOne(configuration::NodeRef const& aNode, uno::Reference< css::beans::XVetoableChangeListener > const& xListener, rtl::OUString const& aName) const;
/// Remove a <type scope='com::sun::star::beans'>XVetoableChangeListener</type> constraining <var>aNode</var>.
- void remove(NodeRef const& aNode, uno::Reference< css::beans::XVetoableChangeListener > const& xListener) const;
+ void remove(configuration::NodeRef const& aNode, uno::Reference< css::beans::XVetoableChangeListener > const& xListener) const;
/** Remove a <type scope='com::sun::star::beans'>XPropertiesChangeListener</type>
observing any properties of <var>aNode</var>.
*/
- void remove(NodeRef const& aNode, uno::Reference< css::beans::XPropertiesChangeListener > const& xListener) const;
+ void remove(configuration::NodeRef const& aNode, uno::Reference< css::beans::XPropertiesChangeListener > const& xListener) const;
// ---------------------------------------------------------------------------------------------------
private:
void operator=(Notifier const& aOther);
@@ -172,7 +162,7 @@ namespace configmgr
class TreeElement;
/// guards a NodeAccess; provides a simple lock for non-data access, does not check for disposed state
- class DisposeGuardImpl : Noncopyable
+ class DisposeGuardImpl: private boost::noncopyable
{
public:
DisposeGuardImpl(Notifier const& rNotifier) throw();
diff --git a/configmgr/source/api2/confprovider2.cxx b/configmgr/source/api2/confprovider2.cxx
deleted file mode 100644
index 02df33ee31..0000000000
--- a/configmgr/source/api2/confprovider2.cxx
+++ /dev/null
@@ -1,607 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: confprovider2.cxx,v $
- * $Revision: 1.33 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General 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_configmgr.hxx"
-#include <stdio.h>
-
-#include "confprovider2.hxx"
-#include "apiaccessobj.hxx"
-#include "confproviderimpl2.hxx"
-#ifndef CONFIGMGR_API_FACTORY_HXX_
-#include "confapifactory.hxx"
-#endif
-#include "bootstrap.hxx"
-#include "bootstrapcontext.hxx"
-#include "wrapexception.hxx"
-#include "tracer.hxx"
-#include <osl/mutex.hxx>
-#include <rtl/ustrbuf.hxx>
-#ifndef INCLUDED_ALGORITHM
-#include <algorithm>
-#define INCLUDED_ALGORITHM
-#endif
-#include <comphelper/sequence.hxx>
-#include <cppuhelper/typeprovider.hxx>
-#include <com/sun/star/beans/PropertyValue.hpp>
-#include <com/sun/star/lang/ServiceNotRegisteredException.hpp>
-
-#define THISREF() static_cast< ::cppu::OWeakObject* >(this)
-
-namespace configmgr
-{
- namespace css = ::com::sun::star;
- namespace uno = css::uno;
- namespace lang = css::lang;
- namespace beans = css::beans;
- using ::rtl::OUString;
- using ::vos::ORef;
- using namespace osl;
-
- namespace
- {
- //------------------------------------------------------------------------
- AsciiServiceName const aConfigProviderServices[] =
- {
- "com.sun.star.configuration.ConfigurationProvider",
- 0
- };
- AsciiServiceName const aAdminProviderServices[] =
- {
- "com.sun.star.configuration.AdministrationProvider",
- 0
- };
- //------------------------------------------------------------------------
-
- ServiceImplementationInfo const aConfigProviderInfo =
- {
- "com.sun.star.comp.configuration.ConfigurationProvider",
- aConfigProviderServices,
- 0
- };
- ServiceImplementationInfo const aAdminProviderInfo =
- {
- "com.sun.star.comp.configuration.AdministrationProvider",
- aAdminProviderServices,
- aConfigProviderServices
- };
- //------------------------------------------------------------------------
-
- AsciiServiceName const
- aDefaultProviderServiceAndImplName = A_DefaultProviderServiceAndImplName;
-
- //------------------------------------------------------------------------
-
- AsciiServiceName const aDefaultProviderServices[] =
- {
- aDefaultProviderServiceAndImplName,
- 0
- };
- //------------------------------------------------------------------------
-
- ServiceRegistrationInfo const aDefaultProviderInfo =
- {
- aDefaultProviderServiceAndImplName,
- aDefaultProviderServices
- };
- SingletonRegistrationInfo const aDefaultProviderSingletonInfo =
- {
- A_DefaultProviderSingletonName,
- aDefaultProviderServiceAndImplName,
- aDefaultProviderServiceAndImplName,
- 0
- };
- //------------------------------------------------------------------------
- typedef uno::Reference< uno::XInterface > (OConfigurationProviderImpl::*CreatorFunc)(const uno::Sequence< uno::Any >& aArguments);
- struct ServiceCreationInfo
- {
- ServiceRegistrationInfo const* info;
- CreatorFunc create;
- };
-
- static sal_Int32 getCreateServiceDataCount()
- {
- return 2;
- }
-
- static const ServiceCreationInfo* getCreateServiceData()
- {
- static ServiceCreationInfo const createServiceData[] =
- {
- { &configapi::aCreateReadAccessSI, &OConfigurationProviderImpl::createReadAccess },
- { &configapi::aCreateUpdateAccessSI, &OConfigurationProviderImpl::createUpdateAccess },
- };
- OSL_ENSURE(sizeof(createServiceData)/sizeof(createServiceData[0]) == getCreateServiceDataCount(),
- "getCreateServiceData : inconsistent data !");
- return createServiceData;
- }
- //------------------------------------------------------------------------
- }
-
- static ServiceCreationInfo const* findCreationInfo( const OUString& aServiceSpecifier )
- {
- for (int i= 0; i<getCreateServiceDataCount(); ++i)
- {
- ServiceCreationInfo const& rCreationInfo = getCreateServiceData()[i];
-
- ServiceRegistrationInfo const* pInfo = rCreationInfo.info;
- if (!pInfo)
- continue;
-
- if (AsciiServiceName pImplName = pInfo->implementationName)
- {
- if (0 == aServiceSpecifier.compareToAscii(pImplName))
- return &rCreationInfo;
- }
-
- if (AsciiServiceName const* pNames = pInfo->registeredServiceNames)
- {
- while(*pNames)
- {
- if (0 == aServiceSpecifier.compareToAscii(*pNames))
- return &rCreationInfo;
-
- ++pNames;
- }
- }
- }
- // not found
- return 0;
- }
-
- //#define ID_PREFETCH 1
- static const int ID_PREFETCH=1;
- static const int ID_ENABLEASYNC=2;
-
- static inline
- OUString getPrefetchPropName() { return OUString( RTL_CONSTASCII_USTRINGPARAM("PrefetchNodes") ); }
- static inline
- OUString getEnableAsyncPropName() { return OUString( RTL_CONSTASCII_USTRINGPARAM("EnableAsync") ); }
- //=============================================================================
- //= OConfigurationProvider
- //=============================================================================
- // service info export
- const ServiceRegistrationInfo* getConfigurationProviderServiceInfo()
- {
- return getRegistrationInfo(&aConfigProviderInfo);
- }
-
- const ServiceRegistrationInfo* getAdminProviderServiceInfo()
- {
- return getRegistrationInfo(&aAdminProviderInfo);
- }
-
- const ServiceRegistrationInfo* getDefaultProviderServiceInfo()
- {
- return &aDefaultProviderInfo;
- }
-
- const SingletonRegistrationInfo* getDefaultProviderSingletonInfo()
- {
- return &aDefaultProviderSingletonInfo;
- }
-
- //-----------------------------------------------------------------------------
- uno::Reference<uno::XInterface> SAL_CALL
- getDefaultConfigProviderSingleton( CreationContext const& xContext )
- {
- OSL_ENSURE( xContext.is(), "ERROR: NULL context has no singletons" );
-
- UnoContextTunnel aTunnel;
- aTunnel.passthru( xContext );
-
- uno::Reference<uno::XInterface> xResult;
-
- if (xContext.is())
- try
- {
- OUString aSingletonName = SINGLETON(A_DefaultProviderSingletonName);
- uno::Any aResult = xContext->getValueByName(aSingletonName);
- aResult >>= xResult;
- }
- catch (uno::Exception & )
- {
- // to do: really use the tunneled failure when that is set properly
- if ( aTunnel.recoverFailure(true).hasValue() )
- {
- // have a failure, but can't recover it
- // -> try to regenerate
- instantiateDefaultProvider(xContext);
-
- OSL_ENSURE(false, "Cannot recreate configuration backend instantiation failure - using generic error");
- }
- // cannot recover any failure
- throw;
- }
-
- return xResult;
- }
- // ------------------------------------------------------------------------
- // ----------------------------------------------------------------------------
- #define TUNNEL_ALL_EXCEPTIONS() \
- WRAP_CONFIGBACKEND_CREATION_EXCEPTIONS1( UnoContextTunnel::tunnelFailure, true)
-
- // ----------------------------------------------------------------------------
- // ------------------------------------------------------------------------
-
- uno::Reference< uno::XInterface > SAL_CALL instantiateDefaultProvider( OProvider::CreationContext const & xTargetContext )
- {
- CreationContext xContext = UnoContextTunnel::recoverContext(xTargetContext);
-
- ServiceImplementationInfo const * pProviderInfo =
- ContextReader::testAdminService(xContext,true) ? &aAdminProviderInfo : &aConfigProviderInfo;
-
- OConfigurationProvider* pNewProvider = new OConfigurationProvider(xContext,pProviderInfo);
- uno::Reference< lang::XMultiServiceFactory > aRet( pNewProvider );
-
- try
- {
- pNewProvider->connect();
- }
- TUNNEL_ALL_EXCEPTIONS()
-
- return uno::Reference< uno::XInterface >( aRet, uno::UNO_QUERY );
- }
-
- //-----------------------------------------------------------------------------
- //-----------------------------------------------------------------------------
- //-----------------------------------------------------------------------------
- OConfigurationProvider::OConfigurationProvider(
- CreationContext const & xContext,
- const ServiceImplementationInfo* pServices
- )
- :OProvider(xContext,pServices)
- ,m_pImpl(NULL)
- ,m_bEnableAsync(false)
- {
- registerProperty(getPrefetchPropName(), ID_PREFETCH, 0,&m_aPrefetchNodes, ::getCppuType(&m_aPrefetchNodes));
- registerProperty(getEnableAsyncPropName(), ID_ENABLEASYNC, 0, &m_bEnableAsync, ::getBooleanCppuType());
- }
-
- //-----------------------------------------------------------------------------
- OConfigurationProvider::~OConfigurationProvider()
- {
- delete m_pImpl;
- }
-
- //-----------------------------------------------------------------------------
- void OConfigurationProvider::connect() throw (uno::Exception)
- {
- OSL_ENSURE( m_pImpl == NULL, "Error: Configuration Provider already is connected");
-
- std::auto_ptr<OConfigurationProviderImpl> pNewImpl( new OConfigurationProviderImpl(this, m_xContext) );
-
- implConnect(*pNewImpl,ContextReader(m_xContext));
-
- m_pImpl = pNewImpl.release();
- if (m_pImpl)
- {
- sal_Bool isEnabled = m_pImpl->getDefaultOptions().isAsyncEnabled();
- this->setPropertyValue( getEnableAsyncPropName(), uno::makeAny(isEnabled) );
- }
- }
-
- //-----------------------------------------------------------------------------
- void SAL_CALL OConfigurationProvider::disposing()
- {
- UnoApiLock aLock;
-
- if (m_pImpl)
- m_pImpl->dispose();
-
- OProvider::disposing();
- }
-
- //-----------------------------------------------------------------------------
- uno::Reference< uno::XInterface > SAL_CALL OConfigurationProvider::createInstance( const OUString& aServiceSpecifier )
- throw(uno::Exception, uno::RuntimeException)
- {
- UnoApiLock aLock;
- // same as creating with empty sequence of arguments
- return this->createInstanceWithArguments( aServiceSpecifier, uno::Sequence< uno::Any >() );
- }
-
- //-----------------------------------------------------------------------------
- uno::Reference< uno::XInterface > SAL_CALL
- OConfigurationProvider::createInstanceWithArguments( const OUString& aServiceSpecifier, const uno::Sequence< uno::Any >& aArguments )
- throw(uno::Exception, uno::RuntimeException)
- {
- UnoApiLock aLock;
-
- OSL_ENSURE(m_pImpl, "OConfigurationProvider: no implementation available");
-
- if (ServiceCreationInfo const* pInfo = findCreationInfo(aServiceSpecifier))
- {
- // it's a known service name - try to create without args
- if (CreatorFunc create = pInfo->create)
- {
- return (m_pImpl->*create)(aArguments);
- }
- }
-
- rtl::OUStringBuffer sMsg;
- sMsg.appendAscii("ConfigurationProvider: Cannot create view - ");
- sMsg.append( aServiceSpecifier ) .appendAscii(" is not a valid configuration access service. ");
-
- throw lang::ServiceNotRegisteredException(sMsg.makeStringAndClear(),*this);
- }
-
- //-----------------------------------------------------------------------------
- uno::Sequence< OUString > SAL_CALL OConfigurationProvider::getAvailableServiceNames( )
- throw(uno::RuntimeException)
- {
- UnoApiLock aLock;
-
- sal_Int32 nCount = 0;
- {
- for (int i= 0; i< getCreateServiceDataCount(); ++i)
- nCount += countServices(getCreateServiceData()[i].info);
- }
-
- uno::Sequence< OUString > aNames(nCount);
- if (nCount > 0)
- {
- sal_Int32 n = 0;
- for (int i= 0; i<getCreateServiceDataCount(); ++i)
- {
- ServiceRegistrationInfo const* pInfo = getCreateServiceData()[i].info;
- AsciiServiceName const* pNames = pInfo ? pInfo->registeredServiceNames : 0;
-
- if (pNames)
- {
- while(*pNames)
- {
- aNames[n] = OUString::createFromAscii(*pNames);
- ++n;
- ++pNames;
- }
- }
- }
- }
-
- return aNames;
- }
-
- // XLocalizable
- //-----------------------------------------------------------------------------
- void SAL_CALL OConfigurationProvider::setLocale( const lang::Locale& eLocale )
- throw (uno::RuntimeException)
- {
- UnoApiLock aLock;
-
- OSL_ENSURE(m_pImpl, "OConfigurationProvider: no implementation available");
-
- m_pImpl->setDefaultLocale( eLocale );
- }
-
- //-----------------------------------------------------------------------------
- lang::Locale SAL_CALL OConfigurationProvider::getLocale()
- throw (uno::RuntimeException)
- {
- UnoApiLock aLock;
-
- OSL_ENSURE(m_pImpl, "OConfigurationProvider: no implementation available");
-
- return m_pImpl->getDefaultOptions().getUnoLocale();
- }
-
- //XRefreshable
- //-----------------------------------------------------------------------------
- void SAL_CALL OConfigurationProvider::refresh()
- throw (uno::RuntimeException)
- {
- UnoApiLock aLock;
-
- OSL_ENSURE(m_pImpl, "OConfigurationProvider: no implementation available");
-
- try
- {
- m_pImpl->refreshAll();
- }
- catch (uno::RuntimeException& ) { throw; }
- catch (uno::Exception& e)
- {
- // FIXME: use getCaughtException()
- throw lang::WrappedTargetRuntimeException(e.Message, *this, uno::makeAny(e));
- }
- //Broadcast the changes
- uno::Reference< css::util::XRefreshListener > const * const pRefresh = 0;
- cppu::OInterfaceContainerHelper * aInterfaceContainer=
- getBroadcastHelper().getContainer (::getCppuType(pRefresh));
-
- if(aInterfaceContainer)
- {
- lang::EventObject aEventObject(*this);
-
- cppu::OInterfaceIteratorHelper aIterator(*aInterfaceContainer);
- while(aIterator.hasMoreElements())
- {
- uno::Reference< uno::XInterface > xIface = aIterator.next();
- uno::Reference< util::XRefreshListener > xRefresh (xIface, uno::UNO_QUERY);
- if (xRefresh.is())
- {
- xRefresh->refreshed(aEventObject);
- }
- }
- }
- }
- //-----------------------------------------------------------------------------
- void SAL_CALL OConfigurationProvider::addRefreshListener(
- const uno::Reference< util::XRefreshListener >& aListener )
- throw (uno::RuntimeException)
- {
- UnoApiLock aLock;
- getBroadcastHelper().addListener(::getCppuType(&aListener), aListener);
- }
- //-----------------------------------------------------------------------------
- void SAL_CALL OConfigurationProvider::removeRefreshListener(
- const uno::Reference< util::XRefreshListener >& aListener )
- throw (uno::RuntimeException)
- {
- UnoApiLock aLock;
- getBroadcastHelper().removeListener(::getCppuType(&aListener), aListener);
- }
- //XFlushable
- //-----------------------------------------------------------------------------
- void SAL_CALL OConfigurationProvider::flush( )
- throw (uno::RuntimeException)
- {
- UnoApiLock aLock;
- OSL_ENSURE(m_pImpl, "OConfigurationProvider: no implementation available");
- m_pImpl->flushAll();
-
- //Broadcast the changes
- uno::Reference< css::util::XFlushListener > const * const pFlush = 0;
- cppu::OInterfaceContainerHelper * aInterfaceContainer=
- getBroadcastHelper().getContainer(::getCppuType(pFlush));
-
- if(aInterfaceContainer)
- {
- lang::EventObject aEventObject(*this);
-
- cppu::OInterfaceIteratorHelper aIterator(*aInterfaceContainer);
- while(aIterator.hasMoreElements())
- {
- uno::Reference< uno::XInterface > xIface = aIterator.next();
- uno::Reference< util::XFlushListener > xFlush (xIface, uno::UNO_QUERY);
- if (xFlush.is())
- {
- xFlush->flushed(aEventObject);
- }
- }
- }
- }
- //-----------------------------------------------------------------------------
- void SAL_CALL OConfigurationProvider::addFlushListener(
- const uno::Reference< util::XFlushListener >& aListener )
- throw (uno::RuntimeException)
- {
- UnoApiLock aLock;
- getBroadcastHelper().addListener(::getCppuType(&aListener), aListener);
- }
- //-----------------------------------------------------------------------------
- void SAL_CALL OConfigurationProvider::removeFlushListener(
- const uno::Reference< util::XFlushListener >& aListener )
- throw (uno::RuntimeException)
- {
- UnoApiLock aLock;
- getBroadcastHelper().removeListener(::getCppuType(&aListener), aListener);
- }
- // XInterface
- //-----------------------------------------------------------------------------
- ::com::sun::star::uno::Any SAL_CALL OConfigurationProvider::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
- {
- UnoApiLock aLock;
- uno::Any aRet( OProvider::queryInterface(rType) );
- if ( !aRet.hasValue() )
- aRet = queryPropertyInterface(rType);
- return aRet;
- }
-
- //XTypeProvider
- //-----------------------------------------------------------------------------
- ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL OConfigurationProvider::getTypes( ) throw(::com::sun::star::uno::RuntimeException)
- {
- cppu::OTypeCollection aCollection(::getCppuType( (const uno::Reference< beans::XPropertySet > *)0 ),
- ::getCppuType( (const uno::Reference< beans::XFastPropertySet > *)0 ),
- ::getCppuType( (const uno::Reference< beans::XMultiPropertySet > *)0 ),
- OProvider::getTypes());
- return aCollection.getTypes();
- }
-
- // OPropertyArrayUsageHelper
- // -------------------------------------------------------------------------
- ::cppu::IPropertyArrayHelper* OConfigurationProvider::createArrayHelper( ) const
- {
- UnoApiLock aLock;
- uno::Sequence< beans::Property > aProps;
- describeProperties(aProps);
- return new ::cppu::OPropertyArrayHelper(aProps);
- }
- // -------------------------------------------------------------------------
- ::cppu::IPropertyArrayHelper & OConfigurationProvider::getInfoHelper()
- {
- UnoApiLock aLock;
- return *const_cast<OConfigurationProvider*>(this)->getArrayHelper();
- }
-
- //-----------------------------------------------------------------------------
-
-
- void SAL_CALL OConfigurationProvider::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue)
- throw (::com::sun::star::uno::Exception)
- {
- UnoApiLock aLock;
-
- OProvider::setFastPropertyValue_NoBroadcast( nHandle, rValue );
-
- switch(nHandle)
- {
- case ID_PREFETCH:
- {
- uno::Sequence< OUString > aNodeList;
- rValue >>= aNodeList;
-
- RequestOptions const aOptions = m_pImpl->getDefaultOptions();
-
- for (sal_Int32 i = 0; i < aNodeList.getLength(); i++)
- {
- using namespace configuration;
- AbsolutePath aModulePath = AbsolutePath::makeModulePath(aNodeList[i], AbsolutePath::NoValidate());
- m_pImpl->fetchSubtree(aModulePath , aOptions);
- }
- }break;
-
- case ID_ENABLEASYNC:
- {
- //Forward to TreeManager
- sal_Bool bAsync;
- if (rValue >>= bAsync)
- {
- m_pImpl->enableAsync(bAsync);
- if (!bAsync)
- this->flush();
- }
- else
- OSL_ENSURE(false, "Unexpected type of new property value");
- }
- break;
- default:
- {
- OSL_ENSURE(false, "OConfigurationProvider::setFastPropertyValue_NoBroadcast -unknown property");
- }
-
- }
- }
-
-
-} // namespace configmgr
-
-
diff --git a/configmgr/source/api2/confprovider2.hxx b/configmgr/source/api2/confprovider2.hxx
deleted file mode 100644
index 640de42e21..0000000000
--- a/configmgr/source/api2/confprovider2.hxx
+++ /dev/null
@@ -1,141 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: confprovider2.hxx,v $
- * $Revision: 1.9 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef CONFIGMGR_API_CONFPROVIDER2_HXX_
-#define CONFIGMGR_API_CONFPROVIDER2_HXX_
-
-#include "provider.hxx"
-#include <comphelper/proparrhlp.hxx>
-
-
-namespace configmgr
-{
- namespace css = ::com::sun::star;
- namespace uno = css::uno;
- namespace lang = css::lang;
- using ::rtl::OUString;
- using ::vos::ORef;
-
- class OConfigurationProviderImpl;
-
- //==========================================================================
- //= OConfigurationProvider
- //==========================================================================
- /** Factory for receiving access for user configuration data. */
- class OConfigurationProvider : public OProvider
- , public ::comphelper::OPropertyArrayUsageHelper<OConfigurationProvider>
- {
- OConfigurationProviderImpl* m_pImpl;
- uno::Sequence< ::rtl::OUString > m_aPrefetchNodes;
- sal_Bool m_bEnableAsync;
-
- public:
- OConfigurationProvider(CreationContext const & xContext, ServiceImplementationInfo const* pServices);
- void connect() throw (uno::Exception);
-
- public:
- ~OConfigurationProvider();
-
- /// XMultiServiceFactory
- virtual uno::Reference< uno::XInterface > SAL_CALL
- createInstance( const OUString& aServiceSpecifier )
- throw(uno::Exception, uno::RuntimeException);
-
- virtual uno::Reference< uno::XInterface > SAL_CALL
- createInstanceWithArguments( const ::rtl::OUString& ServiceSpecifier, const uno::Sequence< uno::Any >& Arguments )
- throw(uno::Exception, uno::RuntimeException);
-
- virtual uno::Sequence< OUString > SAL_CALL
- getAvailableServiceNames( )
- throw(uno::RuntimeException);
-
- /// XLocalizable
- virtual void SAL_CALL
- setLocale( const lang::Locale& eLocale )
- throw (uno::RuntimeException);
-
- virtual lang::Locale SAL_CALL
- getLocale( )
- throw (uno::RuntimeException);
-
-
- //XRefreshable
- virtual void SAL_CALL
- refresh( )
- throw (uno::RuntimeException);
- virtual void SAL_CALL
- addRefreshListener(
- const uno::Reference< util::XRefreshListener >& aListener )
- throw (uno::RuntimeException);
- virtual void SAL_CALL
- removeRefreshListener(
- const uno::Reference< util::XRefreshListener >& aListener )
- throw (uno::RuntimeException);
- //XFlushable
- virtual void SAL_CALL
- flush( )
- throw (uno::RuntimeException);
- virtual void SAL_CALL
- addFlushListener(
- const uno::Reference< util::XFlushListener >& aListener )
- throw (uno::RuntimeException);
- virtual void SAL_CALL
- removeFlushListener(
- const uno::Reference< util::XFlushListener >& aListener )
- throw (uno::RuntimeException);
-
- // OPropertSetHelper
- virtual void SAL_CALL setFastPropertyValue_NoBroadcast(
- sal_Int32 nHandle,
- const ::com::sun::star::uno::Any& rValue
- )
- throw (::com::sun::star::uno::Exception);
-
- // XInterface
- virtual uno::Any SAL_CALL queryInterface( const uno::Type & rType ) throw(uno::RuntimeException);
- //XTypeProvider
- virtual uno::Sequence< uno::Type > SAL_CALL getTypes( ) throw(uno::RuntimeException);
-
- protected:
- using OProvider::disposing;
- virtual void SAL_CALL disposing();
-
- // OPropertyArrayUsageHelper
- virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const;
-
- // OPropertySetHelper
- virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper();
- };
-
-
-} // namespace configmgr
-
-#endif // CONFIGMGR_API_CONFPROVIDER2_HXX_
-
-
diff --git a/configmgr/source/api2/confproviderimpl2.cxx b/configmgr/source/api2/confproviderimpl2.cxx
deleted file mode 100644
index 0a518e9045..0000000000
--- a/configmgr/source/api2/confproviderimpl2.cxx
+++ /dev/null
@@ -1,132 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: confproviderimpl2.cxx,v $
- * $Revision: 1.33 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General 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_configmgr.hxx"
-
-#include <stdio.h>
-#include "confproviderimpl2.hxx"
-#include "roottree.hxx"
-#include "noderef.hxx"
-#include "apitreeaccess.hxx"
-#include "objectregistry.hxx"
-#include "configexcept.hxx"
-#ifndef CONFIGMGR_API_PROVIDER2_HXX_
-#include "confprovider2.hxx"
-#endif
-#include "treeprovider.hxx"
-#include "tracer.hxx"
-#include <com/sun/star/beans/PropertyValue.hpp>
-
-namespace configmgr
-{
- namespace css = ::com::sun::star;
- namespace uno = css::uno;
- namespace beans = css::beans;
-
- using ::rtl::OUString;
-
- using configapi::NodeElement;
- using configuration::RootTree;
-
- //=============================================================================
- //= OConfigurationProviderImpl
- //=============================================================================
- //-----------------------------------------------------------------------------------
- OConfigurationProviderImpl::OConfigurationProviderImpl(OConfigurationProvider* _pProvider, CreationContext const & xContext)
- :OProviderImpl(_pProvider, xContext)
- {
- }
- //--------------------------------------------------------------------------
- uno::Reference<uno::XInterface> OConfigurationProviderImpl::createReadAccess( uno::Sequence<uno::Any> const& aArgs)
- CFG_UNO_THROW_ALL( )
- {
- CFG_TRACE_INFO("config provider: going to create a read access instance");
-
- // extract the args
- OUString sPath;
- sal_Int32 nLevels;
-
- RequestOptions aOptions = getDefaultOptions();
-
- OProviderImpl::FactoryArguments::extractArgs(aArgs, sPath, nLevels, aOptions);
-
- CFG_TRACE_INFO_NI("config provider: node accessor extracted from the args is %s", OUSTRING2ASCII(sPath));
- CFG_TRACE_INFO_NI("config provider: level depth extracted from the args is %i", nLevels);
-
- // create the access object
- uno::Reference< uno::XInterface > xReturn;
-
- NodeElement* pElement = buildReadAccess(sPath, aOptions, nLevels);
- if (pElement != 0)
- {
- xReturn = pElement->getUnoInstance();
- if (xReturn.is())
- // acquired once by buildReadAccess
- xReturn->release();
- }
-
- return xReturn;
- }
-
- //-----------------------------------------------------------------------------------
- uno::Reference<uno::XInterface> OConfigurationProviderImpl::createUpdateAccess( uno::Sequence<uno::Any> const& aArgs)
- CFG_UNO_THROW_ALL( )
- {
- CFG_TRACE_INFO("config provider: going to create an update access instance");
-
- // extract the args
- OUString sPath;
- sal_Int32 nLevels;
-
- RequestOptions aOptions = getDefaultOptions();
-
- OProviderImpl::FactoryArguments::extractArgs(aArgs, sPath, nLevels, aOptions);
-
- CFG_TRACE_INFO_NI("config provider: node accessor extracted from the args is %s", OUSTRING2ASCII(sPath));
- CFG_TRACE_INFO_NI("config provider: level depth extracted from the args is %i", nLevels);
-
- // create the access object
- uno::Reference< uno::XInterface > xReturn;
-
- NodeElement* pElement = buildUpdateAccess(sPath, aOptions, nLevels);
- if (pElement != 0)
- {
- xReturn = pElement->getUnoInstance();
- if (xReturn.is())
- // acquired once by buildReadAccess
- xReturn->release();
- }
-
- return xReturn;
- }
-} // namespace configmgr
-
-
diff --git a/configmgr/source/api2/confproviderimpl2.hxx b/configmgr/source/api2/confproviderimpl2.hxx
deleted file mode 100644
index 05c6b3ed24..0000000000
--- a/configmgr/source/api2/confproviderimpl2.hxx
+++ /dev/null
@@ -1,67 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: confproviderimpl2.hxx,v $
- * $Revision: 1.6 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef CONFIGMGR_API_PROVIDERIMPL2_HXX_
-#define CONFIGMGR_API_PROVIDERIMPL2_HXX_
-
-#include "providerimpl.hxx"
-
-namespace com { namespace sun { namespace star { namespace uno {
- class Any;
- class XInterface;
- template <class> class Sequence;
- template <class> class Reference;
-} } } }
-
-namespace configmgr
-{
- namespace css = ::com::sun::star;
- namespace uno = css::uno;
- namespace script = css::script;
-
- class OConfigurationProvider;
-
- class OConfigurationProviderImpl : public OProviderImpl
- {
- friend class OConfigurationProvider;
-
- public:
- // factory methods
- uno::Reference<uno::XInterface> createReadAccess( uno::Sequence<uno::Any> const& aArgs) CFG_UNO_THROW_ALL( );
- uno::Reference<uno::XInterface> createUpdateAccess( uno::Sequence<uno::Any> const& aArgs) CFG_UNO_THROW_ALL( );
- private:
- OConfigurationProviderImpl(OConfigurationProvider* _pProvider,
- CreationContext const & xContext);
- };
-} // namespace configmgr
-
-#endif // CONFIGMGR_API_PROVIDERIMPL2_HXX_
-
-
diff --git a/configmgr/source/api2/elementaccess.cxx b/configmgr/source/api2/elementaccess.cxx
index 89ff6bd826..cb497a7a51 100644
--- a/configmgr/source/api2/elementaccess.cxx
+++ b/configmgr/source/api2/elementaccess.cxx
@@ -44,57 +44,75 @@ namespace configmgr
//-----------------------------------------------------------------------------------
namespace uno = com::sun::star::uno;
- using uno::Reference;
- using uno::Sequence;
- using uno::Any;
- using uno::RuntimeException;
//-----------------------------------------------------------------------------------
// XInterface (but not method queryInterface)
//-----------------------------------------------------------------------------------
// acuire doesn't really do anything but forward. OTOH it should always be overridden when release() is
-void SAL_CALL BasicInnerElement ::acquire() throw() { BaseImplHelper::acquire(); }
-void SAL_CALL BasicSetElement ::acquire() throw() { BaseImplHelper::acquire(); }
-void SAL_CALL BasicRootElement ::acquire() throw() { BaseImplHelper::acquire(); }
-void SAL_CALL BasicUpdateElement::acquire() throw() { BaseImplHelper::acquire(); }
-//-----------------------------------------------------------------------------------
-
-// FIXME: this looks highly flaky wrt. weak-refs etc.
-#define LOCKED_RELEASE \
- bool bLastRef = (1 == m_refCount); \
- if (bLastRef) \
- { \
- UnoApiLock::acquire(); \
- configapi::implDisposeObject( getNodeAccess(), getElementClass() ); \
- } \
- BaseImplHelper::release(); \
- if (bLastRef) \
- UnoApiLock::release()
-
-
+void SAL_CALL BasicInnerElement ::acquire() throw() { cppu::WeakImplHelper3< css::container::XChild, css::container::XNamed, css::lang::XServiceInfo >::acquire(); }
+void SAL_CALL BasicSetElement ::acquire() throw() { cppu::WeakImplHelper6< css::container::XChild, css::container::XNamed, css::lang::XComponent, css::lang::XServiceInfo, css::configuration::XTemplateInstance, css::lang::XUnoTunnel >::acquire(); }
+void SAL_CALL BasicRootElement ::acquire() throw() { cppu::WeakImplHelper5< css::container::XNamed, css::util::XChangesNotifier, css::lang::XComponent, css::lang::XServiceInfo, css::lang::XLocalizable >::acquire(); }
+void SAL_CALL BasicUpdateElement::acquire() throw() { cppu::WeakImplHelper6< css::container::XNamed, css::util::XChangesNotifier, css::lang::XComponent, css::lang::XServiceInfo, css::lang::XLocalizable, css::util::XChangesBatch >::acquire(); }
+//-----------------------------------------------------------------------------------
void SAL_CALL BasicInnerElement::release() throw()
{
- LOCKED_RELEASE;
+ // FIXME: this looks highly flaky wrt. weak-refs etc.
+ bool bLastRef = (1 == m_refCount);
+ if (bLastRef)
+ {
+ UnoApiLock::acquire();
+ configapi::implDisposeObject( getNodeAccess(), getElementClass() );
+ }
+ cppu::WeakImplHelper3< css::container::XChild, css::container::XNamed, css::lang::XServiceInfo >::release();
+ if (bLastRef)
+ UnoApiLock::release();
}
//-----------------------------------------------------------------------------------
void SAL_CALL BasicSetElement::release() throw()
{
- LOCKED_RELEASE;
+ // FIXME: this looks highly flaky wrt. weak-refs etc.
+ bool bLastRef = (1 == m_refCount);
+ if (bLastRef)
+ {
+ UnoApiLock::acquire();
+ configapi::implDisposeObject( getNodeAccess(), getElementClass() );
+ }
+ cppu::WeakImplHelper6< css::container::XChild, css::container::XNamed, css::lang::XComponent, css::lang::XServiceInfo, css::configuration::XTemplateInstance, css::lang::XUnoTunnel >::release();
+ if (bLastRef)
+ UnoApiLock::release();
}
//-----------------------------------------------------------------------------------
void SAL_CALL BasicRootElement::release() throw()
{
- LOCKED_RELEASE;
+ // FIXME: this looks highly flaky wrt. weak-refs etc.
+ bool bLastRef = (1 == m_refCount);
+ if (bLastRef)
+ {
+ UnoApiLock::acquire();
+ configapi::implDisposeObject( getNodeAccess(), getElementClass() );
+ }
+ cppu::WeakImplHelper5< css::container::XNamed, css::util::XChangesNotifier, css::lang::XComponent, css::lang::XServiceInfo, css::lang::XLocalizable >::release();
+ if (bLastRef)
+ UnoApiLock::release();
}
//-----------------------------------------------------------------------------------
void SAL_CALL BasicUpdateElement::release() throw()
{
- LOCKED_RELEASE;
+ // FIXME: this looks highly flaky wrt. weak-refs etc.
+ bool bLastRef = (1 == m_refCount);
+ if (bLastRef)
+ {
+ UnoApiLock::acquire();
+ configapi::implDisposeObject( getNodeAccess(), getElementClass() );
+ }
+ cppu::WeakImplHelper6< css::container::XNamed, css::util::XChangesNotifier, css::lang::XComponent, css::lang::XServiceInfo, css::lang::XLocalizable, css::util::XChangesBatch >::release();
+ if (bLastRef)
+ UnoApiLock::release();
}
//-----------------------------------------------------------------------------------
@@ -130,28 +148,28 @@ uno::Sequence<sal_Int8> SAL_CALL BasicUpdateElement::getImplementationId( ) thr
// XChild (not for root elements)
//-----------------------------------------------------------------------------------
-Reference< uno::XInterface > SAL_CALL BasicInnerElement::getParent( ) throw(RuntimeException)
+uno::Reference< uno::XInterface > SAL_CALL BasicInnerElement::getParent( ) throw(uno::RuntimeException)
{
return configapi::implGetParent( getNodeAccess(), getElementClass() );
}
//-----------------------------------------------------------------------------------
-Reference< uno::XInterface > SAL_CALL BasicSetElement::getParent( ) throw(RuntimeException)
+uno::Reference< uno::XInterface > SAL_CALL BasicSetElement::getParent( ) throw(uno::RuntimeException)
{
return configapi::implGetParent( getNodeAccess(), getElementClass() );
}
//-----------------------------------------------------------------------------------
//-----------------------------------------------------------------------------------
-void SAL_CALL BasicInnerElement::setParent( const Reference< uno::XInterface >& xParent )
- throw(css::lang::NoSupportException, RuntimeException)
+void SAL_CALL BasicInnerElement::setParent( const uno::Reference< uno::XInterface >& xParent )
+ throw(css::lang::NoSupportException, uno::RuntimeException)
{
configapi::implSetParent( getNodeAccess(), getElementClass(), xParent );
}
//-----------------------------------------------------------------------------------
-void SAL_CALL BasicSetElement::setParent( const Reference< uno::XInterface >& xParent )
- throw(css::lang::NoSupportException, RuntimeException)
+void SAL_CALL BasicSetElement::setParent( const uno::Reference< uno::XInterface >& xParent )
+ throw(css::lang::NoSupportException, uno::RuntimeException)
{
configapi::implSetParent( getNodeAccess(), getElementClass(), xParent );
}
@@ -161,50 +179,50 @@ void SAL_CALL BasicSetElement::setParent( const Reference< uno::XInterface >& xP
// XNamed
//-----------------------------------------------------------------------------------
-OUString SAL_CALL BasicInnerElement::getName( ) throw(RuntimeException)
+rtl::OUString SAL_CALL BasicInnerElement::getName( ) throw(uno::RuntimeException)
{
return configapi::implGetName( getNodeAccess(), getElementClass() );
}
//-----------------------------------------------------------------------------------
-OUString SAL_CALL BasicSetElement::getName( ) throw(RuntimeException)
+rtl::OUString SAL_CALL BasicSetElement::getName( ) throw(uno::RuntimeException)
{
return configapi::implGetName( getNodeAccess(), getElementClass() );
}
//-----------------------------------------------------------------------------------
-OUString SAL_CALL BasicRootElement::getName( ) throw(RuntimeException)
+rtl::OUString SAL_CALL BasicRootElement::getName( ) throw(uno::RuntimeException)
{
return configapi::implGetName( getNodeAccess(), getElementClass() );
}
//-----------------------------------------------------------------------------------
-OUString SAL_CALL BasicUpdateElement::getName( ) throw(RuntimeException)
+rtl::OUString SAL_CALL BasicUpdateElement::getName( ) throw(uno::RuntimeException)
{
return configapi::implGetName( getNodeAccess(), getElementClass() );
}
//-----------------------------------------------------------------------------------
//-----------------------------------------------------------------------------------
-void SAL_CALL BasicInnerElement::setName( const OUString& aName ) throw(RuntimeException)
+void SAL_CALL BasicInnerElement::setName( const rtl::OUString& aName ) throw(uno::RuntimeException)
{
configapi::implSetName( getNodeAccess(), getElementClass(), aName );
}
//-----------------------------------------------------------------------------------
-void SAL_CALL BasicSetElement::setName( const OUString& aName ) throw(RuntimeException)
+void SAL_CALL BasicSetElement::setName( const rtl::OUString& aName ) throw(uno::RuntimeException)
{
configapi::implSetName( getNodeAccess(), getElementClass(), aName );
}
//-----------------------------------------------------------------------------------
-void SAL_CALL BasicRootElement::setName( const OUString& aName ) throw(RuntimeException)
+void SAL_CALL BasicRootElement::setName( const rtl::OUString& aName ) throw(uno::RuntimeException)
{
configapi::implSetName( getNodeAccess(), getElementClass(), aName );
}
//-----------------------------------------------------------------------------------
-void SAL_CALL BasicUpdateElement::setName( const OUString& aName ) throw(RuntimeException)
+void SAL_CALL BasicUpdateElement::setName( const rtl::OUString& aName ) throw(uno::RuntimeException)
{
configapi::implSetName( getNodeAccess(), getElementClass(), aName );
}
@@ -214,30 +232,30 @@ void SAL_CALL BasicUpdateElement::setName( const OUString& aName ) throw(Runtime
// XChangesNotifier
//-----------------------------------------------------------------------------------
-void SAL_CALL BasicRootElement::addChangesListener( const Reference< css::util::XChangesListener >& xListener )
- throw(RuntimeException)
+void SAL_CALL BasicRootElement::addChangesListener( const uno::Reference< css::util::XChangesListener >& xListener )
+ throw(uno::RuntimeException)
{
configapi::implAddListener( getNodeAccess(), xListener );
}
//-----------------------------------------------------------------------------------
-void SAL_CALL BasicUpdateElement::addChangesListener( const Reference< css::util::XChangesListener >& xListener )
- throw(RuntimeException)
+void SAL_CALL BasicUpdateElement::addChangesListener( const uno::Reference< css::util::XChangesListener >& xListener )
+ throw(uno::RuntimeException)
{
configapi::implAddListener( getNodeAccess(), xListener );
}
//-----------------------------------------------------------------------------------
//-----------------------------------------------------------------------------------
-void SAL_CALL BasicRootElement::removeChangesListener( const Reference< css::util::XChangesListener >& xListener )
- throw(RuntimeException)
+void SAL_CALL BasicRootElement::removeChangesListener( const uno::Reference< css::util::XChangesListener >& xListener )
+ throw(uno::RuntimeException)
{
configapi::implRemoveListener( getNodeAccess(), xListener );
}
//-----------------------------------------------------------------------------------
-void SAL_CALL BasicUpdateElement::removeChangesListener( const Reference< css::util::XChangesListener >& xListener )
- throw(RuntimeException)
+void SAL_CALL BasicUpdateElement::removeChangesListener( const uno::Reference< css::util::XChangesListener >& xListener )
+ throw(uno::RuntimeException)
{
configapi::implRemoveListener( getNodeAccess(), xListener );
}
@@ -313,75 +331,75 @@ void SAL_CALL BasicUpdateElement::removeEventListener( const uno::Reference< css
// XServiceInfo
//-----------------------------------------------------------------------------------
-OUString SAL_CALL BasicInnerElement::getImplementationName( ) throw(uno::RuntimeException)
+rtl::OUString SAL_CALL BasicInnerElement::getImplementationName( ) throw(uno::RuntimeException)
{
return configapi::implGetImplementationName( getNodeAccess(), getElementClass() );
}
//-----------------------------------------------------------------------------------
-OUString SAL_CALL BasicSetElement::getImplementationName( ) throw(uno::RuntimeException)
+rtl::OUString SAL_CALL BasicSetElement::getImplementationName( ) throw(uno::RuntimeException)
{
return configapi::implGetImplementationName( getNodeAccess(), getElementClass() );
}
//-----------------------------------------------------------------------------------
-OUString SAL_CALL BasicRootElement::getImplementationName( ) throw(uno::RuntimeException)
+rtl::OUString SAL_CALL BasicRootElement::getImplementationName( ) throw(uno::RuntimeException)
{
return configapi::implGetImplementationName( getNodeAccess(), getElementClass() );
}
//-----------------------------------------------------------------------------------
-OUString SAL_CALL BasicUpdateElement::getImplementationName( ) throw(uno::RuntimeException)
+rtl::OUString SAL_CALL BasicUpdateElement::getImplementationName( ) throw(uno::RuntimeException)
{
return configapi::implGetImplementationName( getNodeAccess(), getElementClass() );
}
//-----------------------------------------------------------------------------------
//-----------------------------------------------------------------------------------
-sal_Bool SAL_CALL BasicInnerElement::supportsService( const OUString& ServiceName ) throw(uno::RuntimeException)
+sal_Bool SAL_CALL BasicInnerElement::supportsService( const rtl::OUString& ServiceName ) throw(uno::RuntimeException)
{
return configapi::implSupportsService( getNodeAccess(), getElementClass(), ServiceName );
}
//-----------------------------------------------------------------------------------
-sal_Bool SAL_CALL BasicSetElement::supportsService( const OUString& ServiceName ) throw(uno::RuntimeException)
+sal_Bool SAL_CALL BasicSetElement::supportsService( const rtl::OUString& ServiceName ) throw(uno::RuntimeException)
{
return configapi::implSupportsService( getNodeAccess(), getElementClass(), ServiceName );
}
//-----------------------------------------------------------------------------------
-sal_Bool SAL_CALL BasicRootElement::supportsService( const OUString& ServiceName ) throw(uno::RuntimeException)
+sal_Bool SAL_CALL BasicRootElement::supportsService( const rtl::OUString& ServiceName ) throw(uno::RuntimeException)
{
return configapi::implSupportsService( getNodeAccess(), getElementClass(), ServiceName );
}
//-----------------------------------------------------------------------------------
-sal_Bool SAL_CALL BasicUpdateElement::supportsService( const OUString& ServiceName ) throw(uno::RuntimeException)
+sal_Bool SAL_CALL BasicUpdateElement::supportsService( const rtl::OUString& ServiceName ) throw(uno::RuntimeException)
{
return configapi::implSupportsService( getNodeAccess(), getElementClass(), ServiceName );
}
//-----------------------------------------------------------------------------------
//-----------------------------------------------------------------------------------
-uno::Sequence< OUString > SAL_CALL BasicInnerElement::getSupportedServiceNames( ) throw(uno::RuntimeException)
+uno::Sequence< rtl::OUString > SAL_CALL BasicInnerElement::getSupportedServiceNames( ) throw(uno::RuntimeException)
{
return configapi::implGetSupportedServiceNames( getNodeAccess(), getElementClass() );
}
//-----------------------------------------------------------------------------------
-uno::Sequence< OUString > SAL_CALL BasicSetElement::getSupportedServiceNames( ) throw(uno::RuntimeException)
+uno::Sequence< rtl::OUString > SAL_CALL BasicSetElement::getSupportedServiceNames( ) throw(uno::RuntimeException)
{
return configapi::implGetSupportedServiceNames( getNodeAccess(), getElementClass() );
}
//-----------------------------------------------------------------------------------
-uno::Sequence< OUString > SAL_CALL BasicRootElement::getSupportedServiceNames( ) throw(uno::RuntimeException)
+uno::Sequence< rtl::OUString > SAL_CALL BasicRootElement::getSupportedServiceNames( ) throw(uno::RuntimeException)
{
return configapi::implGetSupportedServiceNames( getNodeAccess(), getElementClass() );
}
//-----------------------------------------------------------------------------------
-uno::Sequence< OUString > SAL_CALL BasicUpdateElement::getSupportedServiceNames( ) throw(uno::RuntimeException)
+uno::Sequence< rtl::OUString > SAL_CALL BasicUpdateElement::getSupportedServiceNames( ) throw(uno::RuntimeException)
{
return configapi::implGetSupportedServiceNames( getNodeAccess(), getElementClass() );
}
@@ -394,7 +412,7 @@ uno::Sequence< OUString > SAL_CALL BasicUpdateElement::getSupportedServiceNames
// XTemplateInstance
//-----------------------------------------------------------------------------------
-OUString SAL_CALL BasicSetElement::getTemplateName( ) throw(uno::RuntimeException)
+rtl::OUString SAL_CALL BasicSetElement::getTemplateName( ) throw(uno::RuntimeException)
{
return configapi::implGetTemplateName( getElementClass() );
}
diff --git a/configmgr/source/api2/elementaccess.hxx b/configmgr/source/api2/elementaccess.hxx
index c982cc5bf8..8bf73774a2 100644
--- a/configmgr/source/api2/elementaccess.hxx
+++ b/configmgr/source/api2/elementaccess.hxx
@@ -49,7 +49,6 @@ namespace configmgr
//-----------------------------------------------------------------------------
namespace css = ::com::sun::star;
namespace uno = ::com::sun::star::uno;
- using rtl::OUString;
//-----------------------------------------------------------------------------
namespace configapi
@@ -68,16 +67,8 @@ namespace configmgr
<type scope='configmgr::configapi'>NodeAccess</type> and
<type scope='configmgr::configapi'>InnerElement</type>.</p>
*/
- typedef ::cppu::WeakImplHelper3
- < css::container::XChild
- , css::container::XNamed
- , css::lang::XServiceInfo
- >
- InnerElementImplHelper;
-
- class BasicInnerElement : public InnerElementImplHelper
+ class BasicInnerElement : public cppu::WeakImplHelper3< css::container::XChild, css::container::XNamed, css::lang::XServiceInfo >
{
- typedef InnerElementImplHelper BaseImplHelper;
protected:
// Destructors
virtual ~BasicInnerElement() {}
@@ -103,24 +94,24 @@ namespace configmgr
throw(css::lang::NoSupportException, css::uno::RuntimeException);
// XNamed
- virtual OUString SAL_CALL
+ virtual rtl::OUString SAL_CALL
getName( )
throw(uno::RuntimeException);
virtual void SAL_CALL // not supported (! - missing exception)
- setName( const OUString& aName )
+ setName( const rtl::OUString& aName )
throw(uno::RuntimeException);
// XServiceInfo
- virtual OUString SAL_CALL
+ virtual rtl::OUString SAL_CALL
getImplementationName( )
throw(uno::RuntimeException);
virtual sal_Bool SAL_CALL
- supportsService( const OUString& ServiceName )
+ supportsService( const rtl::OUString& ServiceName )
throw(uno::RuntimeException);
- virtual uno::Sequence< OUString > SAL_CALL
+ virtual uno::Sequence< rtl::OUString > SAL_CALL
getSupportedServiceNames( )
throw(uno::RuntimeException);
@@ -136,19 +127,8 @@ namespace configmgr
<type scope='configmgr::configapi'>NodeAccess</type> and
<type scope='configmgr::configapi'>SetElement</type>.</p>
*/
- typedef ::cppu::WeakImplHelper6
- < css::container::XChild
- , css::container::XNamed
- , css::lang::XComponent
- , css::lang::XServiceInfo
- , css::configuration::XTemplateInstance
- , css::lang::XUnoTunnel
- >
- SetElementImplHelper;
-
- class BasicSetElement : public SetElementImplHelper
+ class BasicSetElement : public cppu::WeakImplHelper6< css::container::XChild, css::container::XNamed, css::lang::XComponent, css::lang::XServiceInfo, css::configuration::XTemplateInstance, css::lang::XUnoTunnel >
{
- typedef SetElementImplHelper BaseImplHelper;
protected:
// Destructors
virtual ~BasicSetElement() {}
@@ -174,12 +154,12 @@ namespace configmgr
throw(css::lang::NoSupportException, css::uno::RuntimeException);
// XNamed
- virtual OUString SAL_CALL
+ virtual rtl::OUString SAL_CALL
getName( )
throw(uno::RuntimeException);
virtual void SAL_CALL // generally not supported (! - missing exception)
- setName( const OUString& aName )
+ setName( const rtl::OUString& aName )
throw(uno::RuntimeException);
// XComponent
@@ -196,20 +176,20 @@ namespace configmgr
throw(uno::RuntimeException);
// XServiceInfo
- virtual OUString SAL_CALL
+ virtual rtl::OUString SAL_CALL
getImplementationName( )
throw(uno::RuntimeException);
virtual sal_Bool SAL_CALL
- supportsService( const OUString& ServiceName )
+ supportsService( const rtl::OUString& ServiceName )
throw(uno::RuntimeException);
- virtual uno::Sequence< OUString > SAL_CALL
+ virtual uno::Sequence< rtl::OUString > SAL_CALL
getSupportedServiceNames( )
throw(uno::RuntimeException);
// XTemplateInstance
- virtual OUString SAL_CALL
+ virtual rtl::OUString SAL_CALL
getTemplateName( )
throw(uno::RuntimeException);
@@ -230,18 +210,8 @@ namespace configmgr
<type scope='configmgr::configapi'>NodeAccess</type> and
<type scope='configmgr::configapi'>SetElement</type>.</p>
*/
- typedef ::cppu::WeakImplHelper5
- < css::container::XNamed
- , css::util::XChangesNotifier
- , css::lang::XComponent
- , css::lang::XServiceInfo
- , css::lang::XLocalizable
- >
- RootElementImplHelper;
-
- class BasicRootElement : public RootElementImplHelper
+ class BasicRootElement : public cppu::WeakImplHelper5< css::container::XNamed, css::util::XChangesNotifier, css::lang::XComponent, css::lang::XServiceInfo, css::lang::XLocalizable >
{
- typedef RootElementImplHelper BaseImplHelper;
protected:
// Destructors
virtual ~BasicRootElement() {}
@@ -258,12 +228,12 @@ namespace configmgr
throw(uno::RuntimeException);
// XNamed
- virtual OUString SAL_CALL
+ virtual rtl::OUString SAL_CALL
getName( )
throw(uno::RuntimeException);
virtual void SAL_CALL // generally not supported (! - missing exception)
- setName( const OUString& aName )
+ setName( const rtl::OUString& aName )
throw(uno::RuntimeException);
// XChangesNotifier
@@ -289,15 +259,15 @@ namespace configmgr
throw(uno::RuntimeException);
// XServiceInfo
- virtual OUString SAL_CALL
+ virtual rtl::OUString SAL_CALL
getImplementationName( )
throw(uno::RuntimeException);
virtual sal_Bool SAL_CALL
- supportsService( const OUString& ServiceName )
+ supportsService( const rtl::OUString& ServiceName )
throw(uno::RuntimeException);
- virtual uno::Sequence< OUString > SAL_CALL
+ virtual uno::Sequence< rtl::OUString > SAL_CALL
getSupportedServiceNames( )
throw(uno::RuntimeException);
@@ -322,19 +292,8 @@ namespace configmgr
<type scope='configmgr::configapi'>NodeAccess</type> and
<type scope='configmgr::configapi'>SetElement</type>.</p>
*/
- typedef ::cppu::WeakImplHelper6
- < css::container::XNamed
- , css::util::XChangesNotifier
- , css::lang::XComponent
- , css::lang::XServiceInfo
- , css::lang::XLocalizable
- , css::util::XChangesBatch
- >
- UpdateElementImplHelper;
-
- class BasicUpdateElement : public UpdateElementImplHelper
+ class BasicUpdateElement : public cppu::WeakImplHelper6< css::container::XNamed, css::util::XChangesNotifier, css::lang::XComponent, css::lang::XServiceInfo, css::lang::XLocalizable, css::util::XChangesBatch >
{
- typedef UpdateElementImplHelper BaseImplHelper;
protected:
// Destructors
virtual ~BasicUpdateElement() {}
@@ -351,12 +310,12 @@ namespace configmgr
throw(uno::RuntimeException);
// XNamed
- virtual OUString SAL_CALL
+ virtual rtl::OUString SAL_CALL
getName( )
throw(uno::RuntimeException);
virtual void SAL_CALL // generally not supported (! - missing exception)
- setName( const OUString& aName )
+ setName( const rtl::OUString& aName )
throw(uno::RuntimeException);
// XChangesNotifier
@@ -382,15 +341,15 @@ namespace configmgr
throw(uno::RuntimeException);
// XServiceInfo
- virtual OUString SAL_CALL
+ virtual rtl::OUString SAL_CALL
getImplementationName( )
throw(uno::RuntimeException);
virtual sal_Bool SAL_CALL
- supportsService( const OUString& ServiceName )
+ supportsService( const rtl::OUString& ServiceName )
throw(uno::RuntimeException);
- virtual uno::Sequence< OUString > SAL_CALL
+ virtual uno::Sequence< rtl::OUString > SAL_CALL
getSupportedServiceNames( )
throw(uno::RuntimeException);
diff --git a/configmgr/source/api2/elementimpl.cxx b/configmgr/source/api2/elementimpl.cxx
index 640bc36896..1b6dffcbf2 100644
--- a/configmgr/source/api2/elementimpl.cxx
+++ b/configmgr/source/api2/elementimpl.cxx
@@ -57,20 +57,6 @@ namespace configmgr
namespace lang = css::lang;
namespace util = css::util;
- using uno::RuntimeException;
- using uno::Reference;
- using uno::Any;
- using uno::Sequence;
- using lang::NoSupportException;
- using lang::WrappedTargetException;
-
- using configuration::NodeRef;
- using configuration::Tree;
- using configuration::ElementTree;
- using configuration::Name;
- using configuration::AbsolutePath;
- using configuration::RelativePath;
-
//-----------------------------------------------------------------------------------
// Interface methods
@@ -79,18 +65,18 @@ namespace configmgr
// XChild
//-----------------------------------------------------------------------------------
-Reference< uno::XInterface > implGetParent(NodeAccess& rNode, InnerElement&) throw(RuntimeException)
+uno::Reference< uno::XInterface > implGetParent(NodeAccess& rNode, InnerElement&) throw(uno::RuntimeException)
{
- Reference<uno::XInterface> xRet;
+ uno::Reference<uno::XInterface> xRet;
try
{
- GuardedNodeDataAccess impl( rNode ); // no provider lock needed - tree must be prebuilt already
+ GuardedNodeData<NodeAccess> impl( rNode ); // no provider lock needed - tree must be prebuilt already
- Tree aTree(impl.getTree());
- NodeRef aParentNode = aTree.getParent(impl.getNode());
+ rtl::Reference< configuration::Tree > aTree(impl.getTree());
+ configuration::NodeRef aParentNode = aTree->getParent(impl.getNode());
- Any aAny = configapi::makeInnerElement( rNode.getFactory(), aTree, aParentNode );
+ uno::Any aAny = configapi::makeInnerElement( rNode.getFactory(), aTree, aParentNode );
if (!(aAny >>= xRet)) // no parent available
{
@@ -110,25 +96,25 @@ Reference< uno::XInterface > implGetParent(NodeAccess& rNode, InnerElement&) thr
//-----------------------------------------------------------------------------------
-Reference< uno::XInterface > implGetParent(NodeAccess& rNode, SetElement& /*rElement*/) throw(RuntimeException)
+uno::Reference< uno::XInterface > implGetParent(NodeAccess& rNode, SetElement& /*rElement*/) throw(uno::RuntimeException)
{
- Reference<uno::XInterface> xRet;
+ uno::Reference<uno::XInterface> xRet;
try
{
// assume shared lock for connected trees
- GuardedNodeDataAccess impl( rNode ); // no provider lock needed - tree must be prebuilt already
+ GuardedNodeData<NodeAccess> impl( rNode ); // no provider lock needed - tree must be prebuilt already
- Tree aTree(impl.getTree());
+ rtl::Reference< configuration::Tree > aTree(impl.getTree());
- Tree aParentTree( aTree.getContextTree() );
+ rtl::Reference< configuration::Tree > aParentTree( aTree->getContextTree() );
- if (!aParentTree.isEmpty())
+ if (!configuration::isEmpty(aParentTree.get()))
{
- NodeRef aParentNode( aTree.getContextNode() );
+ configuration::NodeRef aParentNode( aTree->getContextNodeRef() );
// assume shared factory for connected trees
- Any aAny = configapi::makeInnerElement( rNode.getFactory(), aParentTree, aParentNode );
+ uno::Any aAny = configapi::makeInnerElement( rNode.getFactory(), aParentTree, aParentNode );
if (!(aAny >>= xRet)) // no parent available
{
@@ -154,84 +140,82 @@ Reference< uno::XInterface > implGetParent(NodeAccess& rNode, SetElement& /*rEle
//-----------------------------------------------------------------------------------
// UNSUPPORTED method
-void implSetParent(NodeAccess& rNode, InnerElement& /*rElement*/, const Reference< uno::XInterface >& /*xParent*/ )
- throw(NoSupportException, RuntimeException)
+void implSetParent(NodeAccess& rNode, InnerElement& /*rElement*/, const uno::Reference< uno::XInterface >& /*xParent*/ )
+ throw(lang::NoSupportException, uno::RuntimeException)
{
UnoApiLock aLock;
rNode.checkAlive(); // Does locking internally, checks for disposed nodes
// TODO(?): allow for xParent == getParent()
- throw NoSupportException(
- OUString(RTL_CONSTASCII_USTRINGPARAM("configmgr: BasicElement::setParent: cannot move Entry")),
+ throw lang::NoSupportException(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("configmgr: BasicElement::setParent: cannot move Entry")),
rNode.getUnoInstance() );
}
//-----------------------------------------------------------------------------------
// preliminary implementation
-void implSetParent(NodeAccess& rNode, SetElement& rElement, const Reference< uno::XInterface >& xParent )
- throw(NoSupportException, RuntimeException)
+void implSetParent(NodeAccess& rNode, SetElement& rElement, const uno::Reference< uno::XInterface >& xParent )
+ throw(lang::NoSupportException, uno::RuntimeException)
{
UnoApiLock aLock;
//implSetParent(rNode,xParent);
// TODO: lock the whole transaction ???? - would need Uno Tunneling ?
- using css::container::XNameContainer;
-
- Reference< uno::XInterface > xGotParent( implGetParent(rNode,rElement) );
- Reference< XNameContainer > xOldParent( xGotParent, uno::UNO_QUERY );
- Reference< XNameContainer > xNewParent( xParent, uno::UNO_QUERY );
+ uno::Reference< uno::XInterface > xGotParent( implGetParent(rNode,rElement) );
+ uno::Reference< css::container::XNameContainer > xOldParent( xGotParent, uno::UNO_QUERY );
+ uno::Reference< css::container::XNameContainer > xNewParent( xParent, uno::UNO_QUERY );
if (xGotParent.is() && !xOldParent.is())
{
- throw NoSupportException(
- OUString(RTL_CONSTASCII_USTRINGPARAM("Config API: implSetParent: this is not element of a container")),
+ throw lang::NoSupportException(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Config API: implSetParent: this is not element of a container")),
rNode.getUnoInstance() );
}
if (xParent.is() && !xNewParent.is())
{
- throw NoSupportException(
- OUString(RTL_CONSTASCII_USTRINGPARAM("Config API: implSetParent: new parent is no container")),
+ throw lang::NoSupportException(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Config API: implSetParent: new parent is no container")),
rNode.getUnoInstance() );
}
- Reference< uno::XInterface > xThis(rNode.getUnoInstance());
+ uno::Reference< uno::XInterface > xThis(rNode.getUnoInstance());
OSL_ASSERT(xThis.is());
if (xOldParent != xNewParent)
{
- OUString const sName( implGetName(rNode,rElement) );
+ rtl::OUString const sName( implGetName(rNode,rElement) );
if (xParent.is())
{
- OUString const sTemplate( implGetTemplateName(rElement) );
+ rtl::OUString const sTemplate( implGetTemplateName(rElement) );
if (sTemplate.getLength() == 0)
{
- throw NoSupportException(
- OUString(RTL_CONSTASCII_USTRINGPARAM("Config API: implSetParent: object has no recognizable type")),
+ throw lang::NoSupportException(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Config API: implSetParent: object has no recognizable type")),
xThis );
}
- Reference< css::configuration::XTemplateContainer > xNewTemplate( xParent, uno::UNO_QUERY );
+ uno::Reference< css::configuration::XTemplateContainer > xNewTemplate( xParent, uno::UNO_QUERY );
if (!xNewTemplate.is())
{
- throw NoSupportException(
- OUString(RTL_CONSTASCII_USTRINGPARAM("Config API: implSetParent: new parent has no element template")),
+ throw lang::NoSupportException(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Config API: implSetParent: new parent has no element template")),
xThis );
}
if ( sTemplate != xNewTemplate->getElementTemplateName())
{
- throw NoSupportException(
- OUString(RTL_CONSTASCII_USTRINGPARAM("Config API: implSetParent: object has wrong type")),
+ throw lang::NoSupportException(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Config API: implSetParent: object has wrong type")),
xThis );
}
if ( xNewParent->hasByName( sName ) )
{
- throw NoSupportException(
- OUString(RTL_CONSTASCII_USTRINGPARAM("Config API: implSetParent: an object of this name already exists in new parent")),
+ throw lang::NoSupportException(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Config API: implSetParent: an object of this name already exists in new parent")),
xThis );
}
@@ -247,7 +231,7 @@ void implSetParent(NodeAccess& rNode, SetElement& rElement, const Reference< uno
}
catch (uno::Exception& e)
{
- e.Message = OUString(RTL_CONSTASCII_USTRINGPARAM("Config API: implSetParent: changing parent failed: "))
+ e.Message = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Config API: implSetParent: changing parent failed: "))
+= e.Message;
if (xOldParent.is())
@@ -257,10 +241,10 @@ void implSetParent(NodeAccess& rNode, SetElement& rElement, const Reference< uno
}
catch(uno::Exception& bad)
{
- e.Message += OUString(RTL_CONSTASCII_USTRINGPARAM("\n\t ! Could not restore old parent: ")) += bad.Message;
+ e.Message += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\n\t ! Could not restore old parent: ")) += bad.Message;
}
- throw RuntimeException(e.Message,xThis);
+ throw uno::RuntimeException(e.Message,xThis);
}
}
@@ -270,17 +254,17 @@ void implSetParent(NodeAccess& rNode, SetElement& rElement, const Reference< uno
// XNamed
//-----------------------------------------------------------------------------
-OUString implGetName(NodeAccess& rNode, NodeElement& ) throw(RuntimeException)
+rtl::OUString implGetName(NodeAccess& rNode, NodeElement& ) throw(uno::RuntimeException)
{
- OUString sRet;
+ rtl::OUString sRet;
try
{
- GuardedNodeDataAccess impl( rNode ); // maybe passive only ?
+ GuardedNodeData<NodeAccess> impl( rNode ); // maybe passive only ?
- Tree aTree(impl.getTree());
- NodeRef aNode(impl.getNode());
+ rtl::Reference< configuration::Tree > aTree(impl.getTree());
+ configuration::NodeRef aNode(impl.getNode());
- sRet = aTree.getName(aNode).toString();
+ sRet = aTree->getSimpleNodeName(aNode.getOffset());
}
catch (configuration::Exception& ex)
{
@@ -294,23 +278,21 @@ OUString implGetName(NodeAccess& rNode, NodeElement& ) throw(RuntimeException)
//-----------------------------------------------------------------------------
// UNSUPPORTED method
-void implSetName(NodeAccess & rNode, NodeElement& /*rElement*/, const OUString& /*aName*/ ) throw(RuntimeException)
+void implSetName(NodeAccess & rNode, NodeElement& /*rElement*/, const rtl::OUString& /*aName*/ ) throw(uno::RuntimeException)
{
UnoApiLock aLock;
- typedef RuntimeException CantRenameException;
-
rNode.checkAlive(); // Does locking internally, checks for disposed nodes
// TODO(?): allow for aName == getName()
- throw CantRenameException(
- OUString(RTL_CONSTASCII_USTRINGPARAM("configmgr: BasicElement::setName: cannot rename Entry")),
+ throw uno::RuntimeException(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("configmgr: BasicElement::setName: cannot rename Entry")),
rNode.getUnoInstance() );
}
//-----------------------------------------------------------------------------
// TODO: Implementations for elements to be added to a container node
-void implSetName(NodeAccess& rNode, SetElement& rElement, const OUString& aName ) throw(RuntimeException)
+void implSetName(NodeAccess& rNode, SetElement& rElement, const rtl::OUString& aName ) throw(uno::RuntimeException)
{
UnoApiLock aLock;
@@ -332,7 +314,7 @@ void implDispose( SetElement& rElement) throw(uno::RuntimeException)
if (!rElement.disposeTree(false))
{
throw uno::RuntimeException(
- OUString(RTL_CONSTASCII_USTRINGPARAM("CONFIGURATION: Can't dispose an object that has an owner")),
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CONFIGURATION: Can't dispose an object that has an owner")),
rElement.getUnoInstance() );
}
}
@@ -345,7 +327,7 @@ void implDispose( RootElement& rElement) throw(uno::RuntimeException)
if (!rElement.disposeTree())
{
throw lang::DisposedException(
- OUString(RTL_CONSTASCII_USTRINGPARAM("CONFIGURATION: Can't dispose an object that already was disposed")),
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CONFIGURATION: Can't dispose an object that already was disposed")),
rElement.getUnoInstance() );
}
}
@@ -390,7 +372,7 @@ uno::Sequence<sal_Int8> implGetImplementationId(NodeAccess& rNode, NodeElement&
OSL_ENSURE(pInfo, "Configuration: Object has no implementation (service) info - cannot get implementation id");
if (!pInfo)
- throw uno::RuntimeException( OUString(RTL_CONSTASCII_USTRINGPARAM("CONFIGURATION: Object has no implementation information - cannot get implementation id")),rElement.getUnoInstance() );
+ throw uno::RuntimeException( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CONFIGURATION: Object has no implementation information - cannot get implementation id")),rElement.getUnoInstance() );
return ServiceComponentImpl::getStaticImplementationId(pInfo);
}
@@ -399,7 +381,7 @@ uno::Sequence<sal_Int8> implGetImplementationId(NodeAccess& rNode, NodeElement&
// XServiceInfo
//-----------------------------------------------------------------------------
-OUString implGetImplementationName( NodeAccess& rNode, NodeElement& rElement ) throw(uno::RuntimeException)
+rtl::OUString implGetImplementationName( NodeAccess& rNode, NodeElement& rElement ) throw(uno::RuntimeException)
{
DisposeGuard aLock(rNode);
ServiceImplementationInfo const* pInfo = rElement.getServiceInfo();
@@ -409,7 +391,7 @@ OUString implGetImplementationName( NodeAccess& rNode, NodeElement& rElement ) t
}
//-----------------------------------------------------------------------------
-sal_Bool implSupportsService( NodeAccess& rNode, NodeElement& rElement, const OUString& ServiceName ) throw(uno::RuntimeException)
+sal_Bool implSupportsService( NodeAccess& rNode, NodeElement& rElement, const rtl::OUString& ServiceName ) throw(uno::RuntimeException)
{
DisposeGuard aLock(rNode);
ServiceImplementationInfo const* pInfo = rElement.getServiceInfo();
@@ -419,7 +401,7 @@ sal_Bool implSupportsService( NodeAccess& rNode, NodeElement& rElement, const OU
}
//-----------------------------------------------------------------------------
-uno::Sequence< OUString > implGetSupportedServiceNames( NodeAccess& rNode, NodeElement& rElement ) throw(uno::RuntimeException)
+uno::Sequence< rtl::OUString > implGetSupportedServiceNames( NodeAccess& rNode, NodeElement& rElement ) throw(uno::RuntimeException)
{
DisposeGuard aLock(rNode);
ServiceImplementationInfo const* pInfo = rElement.getServiceInfo();
@@ -452,7 +434,7 @@ void implSetLocale( RootElement& rElement, const css::lang::Locale& /*eLocale*/
OSL_ENSURE(false,"CONFIGURATION: Changing the set Locale is not supported.");
throw uno::RuntimeException(
- OUString(RTL_CONSTASCII_USTRINGPARAM("CONFIGURATION: Changing the locale is currently not supported")),
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CONFIGURATION: Changing the locale is currently not supported")),
rElement.getUnoInstance()
);
}
@@ -481,13 +463,13 @@ void implCommitChanges( UpdateRootElement& rElement ) throw(css::lang::WrappedTa
}
// filter/wrap uno::Exceptions
- catch (WrappedTargetException& ) { throw; }
- catch (RuntimeException& ) { throw; }
+ catch (lang::WrappedTargetException& ) { throw; }
+ catch (uno::RuntimeException& ) { throw; }
catch (uno::Exception& ex)
{
- Reference<uno::XInterface> xContext( rElement.getUnoInstance() );
- OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Configuration: can't commit Changes: ") );
- throw WrappedTargetException( sMessage += ex.Message, xContext, uno::makeAny(ex));
+ uno::Reference<uno::XInterface> xContext( rElement.getUnoInstance() );
+ rtl::OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Configuration: can't commit Changes: ") );
+ throw lang::WrappedTargetException( sMessage += ex.Message, xContext, uno::makeAny(ex));
}
}
//-----------------------------------------------------------------------------
@@ -497,7 +479,7 @@ sal_Bool implHasPendingChanges( RootElement& rElement ) throw(uno::RuntimeExcept
try
{
GuardedRootElement aLocked(rElement);
- return aLocked.getTree().hasChanges();
+ return aLocked.get().getTree()->hasChanges();
}
catch (configuration::Exception& ex)
{
@@ -514,21 +496,18 @@ sal_Bool implHasPendingChanges( RootElement& rElement ) throw(uno::RuntimeExcept
uno::Sequence< css::util::ElementChange > implGetPendingChanges( RootElement& rElement )
throw(uno::RuntimeException)
{
- using css::util::ElementChange;
- using configuration::NodeChangesInformation;
-
- std::vector<ElementChange> aResult;
+ std::vector<css::util::ElementChange> aResult;
try
{
GuardedRootElement aLocked(rElement);
- Tree aTree( aLocked.getTree() );
+ rtl::Reference< configuration::Tree > aTree( aLocked.get().getTree() );
- NodeChangesInformation aInfos;
+ configuration::NodeChangesInformation aInfos;
{
- NodeChanges aChanges;
- if (aTree.collectChanges(aChanges))
+ configuration::NodeChanges aChanges;
+ if (aTree->collectChanges(aChanges))
{
aChanges.getChangesInfos(aInfos);
}
@@ -536,11 +515,11 @@ uno::Sequence< css::util::ElementChange > implGetPendingChanges( RootElement& rE
Factory& rFactory = rElement.getFactory();
- for(NodeChangesInformation::Iterator it = aInfos.begin(), stop = aInfos.end();
+ for(std::vector< configuration::NodeChangeInformation >::const_iterator it = aInfos.begin(), stop = aInfos.end();
it != stop;
++it)
{
- ElementChange aChange;
+ css::util::ElementChange aChange;
fillChange(aChange,*it,aTree,rFactory);
aResult.push_back(aChange);
}
@@ -561,13 +540,13 @@ uno::Sequence< css::util::ElementChange > implGetPendingChanges( RootElement& rE
// XTemplateInstance
//-----------------------------------------------------------------------------------
-OUString implGetTemplateName(SetElement& rElement)
+rtl::OUString implGetTemplateName(SetElement& rElement)
throw(uno::RuntimeException)
{
try
{
GuardedTreeElement aLocked(rElement);
- return rElement.getTemplateInfo().getTemplatePathString();
+ return rElement.getTemplateInfo()->getPathString();
}
catch (configuration::Exception& ex)
{
@@ -577,7 +556,7 @@ OUString implGetTemplateName(SetElement& rElement)
}
OSL_ENSURE(false,"Unreachable Code");
- return OUString();
+ return rtl::OUString();
}
//-----------------------------------------------------------------------------------
diff --git a/configmgr/source/api2/elementimpl.hxx b/configmgr/source/api2/elementimpl.hxx
index 0e887f7cbb..1fe4e99cfc 100644
--- a/configmgr/source/api2/elementimpl.hxx
+++ b/configmgr/source/api2/elementimpl.hxx
@@ -41,7 +41,6 @@ namespace configmgr
{
namespace css = ::com::sun::star;
namespace uno = ::com::sun::star::uno;
- using rtl::OUString;
/* implementations of the interfaces supported by a (parent) node
within the configuration tree.
@@ -96,24 +95,24 @@ namespace configmgr
// XNamed
//---------------------------------------------------------------------
- OUString implGetName(NodeAccess& rNode, NodeElement& rElement)
+ rtl::OUString implGetName(NodeAccess& rNode, NodeElement& rElement)
throw(uno::RuntimeException);
- void implSetName(NodeAccess& rNode, NodeElement& rElement, const OUString& aName ) // generally not supported (! - missing exception)
+ void implSetName(NodeAccess& rNode, NodeElement& rElement, const rtl::OUString& aName ) // generally not supported (! - missing exception)
throw(uno::RuntimeException);
- void implSetName(NodeAccess& rNode, SetElement& rElement, const OUString& aName ) // maybe supported
+ void implSetName(NodeAccess& rNode, SetElement& rElement, const rtl::OUString& aName ) // maybe supported
throw(uno::RuntimeException);
// XServiceInfo
//---------------------------------------------------------------------
- OUString implGetImplementationName( NodeAccess& rNode, NodeElement& rElement )
+ rtl::OUString implGetImplementationName( NodeAccess& rNode, NodeElement& rElement )
throw(uno::RuntimeException);
- sal_Bool implSupportsService( NodeAccess& rNode, NodeElement& rElement, const OUString& ServiceName )
+ sal_Bool implSupportsService( NodeAccess& rNode, NodeElement& rElement, const rtl::OUString& ServiceName )
throw(uno::RuntimeException);
- uno::Sequence< OUString > implGetSupportedServiceNames( NodeAccess& rNode, NodeElement& rElement )
+ uno::Sequence< rtl::OUString > implGetSupportedServiceNames( NodeAccess& rNode, NodeElement& rElement )
throw(uno::RuntimeException);
// Root only only
@@ -144,7 +143,7 @@ namespace configmgr
//-------------------------------------------------------------------------
// XTemplateInstance
//---------------------------------------------------------------------
- OUString implGetTemplateName(SetElement& rElement)
+ rtl::OUString implGetTemplateName(SetElement& rElement)
throw(uno::RuntimeException);
// XUnoTunnel
diff --git a/configmgr/source/api2/groupaccess.cxx b/configmgr/source/api2/groupaccess.cxx
index 66c0d5ff88..b5e32cca3a 100644
--- a/configmgr/source/api2/groupaccess.cxx
+++ b/configmgr/source/api2/groupaccess.cxx
@@ -39,21 +39,16 @@
namespace configmgr
{
- using uno::Reference;
- using uno::Sequence;
- using uno::Any;
- using uno::RuntimeException;
-
// XHierarchicalName
//------------------------------------------------------------------------------------------------------------------
-OUString SAL_CALL BasicGroupAccess::getHierarchicalName( ) throw(RuntimeException)
+rtl::OUString SAL_CALL BasicGroupAccess::getHierarchicalName( ) throw(uno::RuntimeException)
{
return configapi::implGetHierarchicalName( getNode() );
}
//------------------------------------------------------------------------------------------------------------------
-OUString SAL_CALL BasicGroupAccess::composeHierarchicalName( const OUString& sRelativeName )
- throw(css::lang::IllegalArgumentException, css::lang::NoSupportException, RuntimeException)
+rtl::OUString SAL_CALL BasicGroupAccess::composeHierarchicalName( const rtl::OUString& sRelativeName )
+ throw(css::lang::IllegalArgumentException, css::lang::NoSupportException, uno::RuntimeException)
{
return configapi::implComposeHierarchicalName( getNode(), sRelativeName );
}
@@ -64,13 +59,13 @@ OUString SAL_CALL BasicGroupAccess::composeHierarchicalName( const OUString& sRe
//-----------------------------------------------------------------------------------
//-----------------------------------------------------------------------------------
-uno::Type SAL_CALL BasicGroupAccess::getElementType( ) throw(RuntimeException)
+uno::Type SAL_CALL BasicGroupAccess::getElementType( ) throw(uno::RuntimeException)
{
return configapi::implGetElementType( getNode() );
}
//-----------------------------------------------------------------------------------
-sal_Bool SAL_CALL BasicGroupAccess::hasElements( ) throw(RuntimeException)
+sal_Bool SAL_CALL BasicGroupAccess::hasElements( ) throw(uno::RuntimeException)
{
return configapi::implHasElements( getNode() );
}
@@ -78,7 +73,7 @@ sal_Bool SAL_CALL BasicGroupAccess::hasElements( ) throw(RuntimeException)
// XExactName
//-----------------------------------------------------------------------------------
-OUString SAL_CALL BasicGroupAccess::getExactName( const OUString& rApproximateName ) throw(RuntimeException)
+rtl::OUString SAL_CALL BasicGroupAccess::getExactName( const rtl::OUString& rApproximateName ) throw(uno::RuntimeException)
{
return configapi::implGetExactName( getNode(), rApproximateName);
}
@@ -94,34 +89,34 @@ css::beans::Property SAL_CALL BasicGroupAccess::getAsProperty( ) throw(uno::Run
// XNameAccess
//-----------------------------------------------------------------------------------
-sal_Bool SAL_CALL BasicGroupAccess::hasByName( const OUString& sName ) throw(RuntimeException)
+sal_Bool SAL_CALL BasicGroupAccess::hasByName( const rtl::OUString& sName ) throw(uno::RuntimeException)
{
return configapi::implHasByName( getNode(), sName);
}
//-----------------------------------------------------------------------------------
-Any SAL_CALL BasicGroupAccess::getByName( const OUString& sName )
- throw(css::container::NoSuchElementException, css::lang::WrappedTargetException, RuntimeException)
+uno::Any SAL_CALL BasicGroupAccess::getByName( const rtl::OUString& sName )
+ throw(css::container::NoSuchElementException, css::lang::WrappedTargetException, uno::RuntimeException)
{
return configapi::implGetByName( getNode(), sName );
}
//-----------------------------------------------------------------------------------
-Sequence< OUString > SAL_CALL BasicGroupAccess::getElementNames( ) throw( RuntimeException)
+uno::Sequence< rtl::OUString > SAL_CALL BasicGroupAccess::getElementNames( ) throw( uno::RuntimeException)
{
return configapi::implGetElementNames( getNode() );
}
// XHierarchicalNameAccess
//-----------------------------------------------------------------------------------
-sal_Bool SAL_CALL BasicGroupAccess::hasByHierarchicalName( const OUString& sName ) throw(RuntimeException)
+sal_Bool SAL_CALL BasicGroupAccess::hasByHierarchicalName( const rtl::OUString& sName ) throw(uno::RuntimeException)
{
return configapi::implHasByHierarchicalName( getNode(), sName);
}
//-----------------------------------------------------------------------------------
-Any SAL_CALL BasicGroupAccess::getByHierarchicalName( const OUString& sName )
- throw(css::container::NoSuchElementException, RuntimeException)
+uno::Any SAL_CALL BasicGroupAccess::getByHierarchicalName( const rtl::OUString& sName )
+ throw(css::container::NoSuchElementException, uno::RuntimeException)
{
return configapi::implGetByHierarchicalName( getNode(), sName );
}
@@ -130,15 +125,15 @@ Any SAL_CALL BasicGroupAccess::getByHierarchicalName( const OUString& sName )
// XContainer
//-----------------------------------------------------------------------------------
-void SAL_CALL BasicGroupAccess::addContainerListener( const Reference< css::container::XContainerListener >& xListener )
- throw(RuntimeException)
+void SAL_CALL BasicGroupAccess::addContainerListener( const uno::Reference< css::container::XContainerListener >& xListener )
+ throw(uno::RuntimeException)
{
configapi::implAddListener( getNode(), xListener );
}
//-----------------------------------------------------------------------------------
-void SAL_CALL BasicGroupAccess::removeContainerListener( const Reference< css::container::XContainerListener >& xListener )
- throw(RuntimeException)
+void SAL_CALL BasicGroupAccess::removeContainerListener( const uno::Reference< css::container::XContainerListener >& xListener )
+ throw(uno::RuntimeException)
{
configapi::implRemoveListener( getNode(), xListener );
}
diff --git a/configmgr/source/api2/groupaccess.hxx b/configmgr/source/api2/groupaccess.hxx
index f1fd59abf8..7a6903c0c7 100644
--- a/configmgr/source/api2/groupaccess.hxx
+++ b/configmgr/source/api2/groupaccess.hxx
@@ -43,7 +43,6 @@ namespace configmgr
{
namespace css = ::com::sun::star;
namespace uno = ::com::sun::star::uno;
- using rtl::OUString;
namespace configapi { class NodeGroupInfoAccess; }
@@ -69,12 +68,12 @@ namespace configmgr
// Interface methods
// XHierarchicalName
- virtual OUString SAL_CALL
+ virtual rtl::OUString SAL_CALL
getHierarchicalName( )
throw(uno::RuntimeException);
- virtual OUString SAL_CALL
- composeHierarchicalName( const OUString& aRelativeName )
+ virtual rtl::OUString SAL_CALL
+ composeHierarchicalName( const rtl::OUString& aRelativeName )
throw(css::lang::IllegalArgumentException, css::lang::NoSupportException,
uno::RuntimeException);
@@ -89,25 +88,25 @@ namespace configmgr
// XNameAccess
virtual uno::Any SAL_CALL
- getByName( const OUString& aName )
+ getByName( const rtl::OUString& aName )
throw(css::container::NoSuchElementException, css::lang::WrappedTargetException,
uno::RuntimeException);
- virtual uno::Sequence< OUString > SAL_CALL
+ virtual uno::Sequence< rtl::OUString > SAL_CALL
getElementNames( )
throw( uno::RuntimeException);
virtual sal_Bool SAL_CALL
- hasByName( const OUString& aName )
+ hasByName( const rtl::OUString& aName )
throw(uno::RuntimeException);
// XHierarchicalNameAccess
virtual uno::Any SAL_CALL
- getByHierarchicalName( const OUString& aName )
+ getByHierarchicalName( const rtl::OUString& aName )
throw(css::container::NoSuchElementException, uno::RuntimeException);
virtual sal_Bool SAL_CALL
- hasByHierarchicalName( const OUString& aName )
+ hasByHierarchicalName( const rtl::OUString& aName )
throw(uno::RuntimeException);
// XContainer
@@ -121,7 +120,7 @@ namespace configmgr
// XExactName
virtual ::rtl::OUString SAL_CALL
- getExactName( const OUString& aApproximateName )
+ getExactName( const rtl::OUString& aApproximateName )
throw(uno::RuntimeException);
// XProperty
diff --git a/configmgr/source/api2/groupobjects.cxx b/configmgr/source/api2/groupobjects.cxx
index d57a11c76d..be1b7bd380 100644
--- a/configmgr/source/api2/groupobjects.cxx
+++ b/configmgr/source/api2/groupobjects.cxx
@@ -79,22 +79,22 @@ uno::Sequence< sal_Int8 > SAL_CALL OInnerGroupInfo::getImplementationId( ) throw
}
-NodeAccess& OInnerGroupInfo::getNodeAccess()
+configapi::NodeAccess& OInnerGroupInfo::getNodeAccess()
{
return m_aAccessElement;
}
-NodeGroupInfoAccess& OInnerGroupInfo::getNode()
+configapi::NodeGroupInfoAccess& OInnerGroupInfo::getNode()
{
return m_aAccessElement;
}
-NodeGroupAccess* OInnerGroupInfo::maybeGetUpdateAccess()
+configapi::NodeGroupAccess* OInnerGroupInfo::maybeGetUpdateAccess()
{
return 0;
}
-InnerElement& OInnerGroupInfo::getElementClass()
+configapi::InnerElement& OInnerGroupInfo::getElementClass()
{
return m_aAccessElement;
}
@@ -140,22 +140,22 @@ uno::Sequence< sal_Int8 > SAL_CALL OInnerGroupUpdate::getImplementationId( ) thr
}
-NodeAccess& OInnerGroupUpdate::getNodeAccess()
+configapi::NodeAccess& OInnerGroupUpdate::getNodeAccess()
{
return m_aAccessElement;
}
-NodeGroupInfoAccess& OInnerGroupUpdate::getNode()
+configapi::NodeGroupInfoAccess& OInnerGroupUpdate::getNode()
{
return m_aAccessElement;
}
-NodeGroupAccess* OInnerGroupUpdate::maybeGetUpdateAccess()
+configapi::NodeGroupAccess* OInnerGroupUpdate::maybeGetUpdateAccess()
{
return &m_aAccessElement;
}
-InnerElement& OInnerGroupUpdate::getElementClass()
+configapi::InnerElement& OInnerGroupUpdate::getElementClass()
{
return m_aAccessElement;
}
@@ -201,22 +201,22 @@ uno::Sequence< sal_Int8 > SAL_CALL OSetElementGroupInfo::getImplementationId( )
}
-NodeAccess& OSetElementGroupInfo::getNodeAccess()
+configapi::NodeAccess& OSetElementGroupInfo::getNodeAccess()
{
return m_aAccessElement;
}
-NodeGroupInfoAccess& OSetElementGroupInfo::getNode()
+configapi::NodeGroupInfoAccess& OSetElementGroupInfo::getNode()
{
return m_aAccessElement;
}
-NodeGroupAccess* OSetElementGroupInfo::maybeGetUpdateAccess()
+configapi::NodeGroupAccess* OSetElementGroupInfo::maybeGetUpdateAccess()
{
return 0;
}
-SetElement& OSetElementGroupInfo::getElementClass()
+configapi::SetElement& OSetElementGroupInfo::getElementClass()
{
return m_aAccessElement;
}
@@ -262,22 +262,22 @@ uno::Sequence< sal_Int8 > SAL_CALL OSetElementGroupUpdate::getImplementationId(
}
-NodeAccess& OSetElementGroupUpdate::getNodeAccess()
+configapi::NodeAccess& OSetElementGroupUpdate::getNodeAccess()
{
return m_aAccessElement;
}
-NodeGroupInfoAccess& OSetElementGroupUpdate::getNode()
+configapi::NodeGroupInfoAccess& OSetElementGroupUpdate::getNode()
{
return m_aAccessElement;
}
-NodeGroupAccess* OSetElementGroupUpdate::maybeGetUpdateAccess()
+configapi::NodeGroupAccess* OSetElementGroupUpdate::maybeGetUpdateAccess()
{
return &m_aAccessElement;
}
-SetElement& OSetElementGroupUpdate::getElementClass()
+configapi::SetElement& OSetElementGroupUpdate::getElementClass()
{
return m_aAccessElement;
}
@@ -323,22 +323,22 @@ uno::Sequence< sal_Int8 > SAL_CALL ORootElementGroupInfo::getImplementationId( )
}
-NodeAccess& ORootElementGroupInfo::getNodeAccess()
+configapi::NodeAccess& ORootElementGroupInfo::getNodeAccess()
{
return m_aAccessElement;
}
-NodeGroupInfoAccess& ORootElementGroupInfo::getNode()
+configapi::NodeGroupInfoAccess& ORootElementGroupInfo::getNode()
{
return m_aAccessElement;
}
-NodeGroupAccess* ORootElementGroupInfo::maybeGetUpdateAccess()
+configapi::NodeGroupAccess* ORootElementGroupInfo::maybeGetUpdateAccess()
{
return 0;
}
-RootElement& ORootElementGroupInfo::getElementClass()
+configapi::RootElement& ORootElementGroupInfo::getElementClass()
{
return m_aAccessElement;
}
@@ -384,22 +384,22 @@ uno::Sequence< sal_Int8 > SAL_CALL ORootElementGroupUpdate::getImplementationId(
}
-NodeAccess& ORootElementGroupUpdate::getNodeAccess()
+configapi::NodeAccess& ORootElementGroupUpdate::getNodeAccess()
{
return m_aAccessElement;
}
-NodeGroupInfoAccess& ORootElementGroupUpdate::getNode()
+configapi::NodeGroupInfoAccess& ORootElementGroupUpdate::getNode()
{
return m_aAccessElement;
}
-NodeGroupAccess* ORootElementGroupUpdate::maybeGetUpdateAccess()
+configapi::NodeGroupAccess* ORootElementGroupUpdate::maybeGetUpdateAccess()
{
return &m_aAccessElement;
}
-UpdateRootElement& ORootElementGroupUpdate::getElementClass()
+configapi::UpdateRootElement& ORootElementGroupUpdate::getElementClass()
{
return m_aAccessElement;
}
diff --git a/configmgr/source/api2/groupobjects.hxx b/configmgr/source/api2/groupobjects.hxx
index 1551e61f54..7393c929f3 100644
--- a/configmgr/source/api2/groupobjects.hxx
+++ b/configmgr/source/api2/groupobjects.hxx
@@ -42,17 +42,6 @@
namespace configmgr
{
//........................................................................
- using configapi::ApiTreeImpl;
- using configapi::ApiProvider;
-
- using configapi::NodeAccess;
- using configapi::NodeGroupInfoAccess;
- using configapi::NodeGroupAccess;
-
- using configapi::InnerElement;
- using configapi::SetElement;
- using configapi::RootElement;
- using configapi::UpdateRootElement;
//==========================================================================
//= Inner Group Instances
@@ -67,7 +56,7 @@ namespace configmgr
{
public:
// Construction/Destruction
- OInnerGroupInfo(ApiTreeImpl& rTree, configuration::NodeRef const& aNode)
+ OInnerGroupInfo(configapi::ApiTreeImpl& rTree, configuration::NodeRef const& aNode)
: m_aAccessElement(static_cast<css::container::XChild*>(this),rTree,aNode)
{
}
@@ -84,12 +73,12 @@ namespace configmgr
uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) throw (uno::RuntimeException );
// Base class implementation
- virtual NodeAccess& getNodeAccess();
- virtual NodeGroupInfoAccess& getNode();
- virtual NodeGroupAccess* maybeGetUpdateAccess();
- virtual InnerElement& getElementClass();
+ virtual configapi::NodeAccess& getNodeAccess();
+ virtual configapi::NodeGroupInfoAccess& getNode();
+ virtual configapi::NodeGroupAccess* maybeGetUpdateAccess();
+ virtual configapi::InnerElement& getElementClass();
private:
- configapi::OInnerGroupInfoAccess m_aAccessElement;
+ configapi::OInnerElement<configapi::NodeGroupInfoAccess> m_aAccessElement;
};
/** updating access class for configuration nodes which are inner nodes and groups of other nodes
@@ -101,7 +90,7 @@ namespace configmgr
{
public:
// Construction/Destruction
- OInnerGroupUpdate(ApiTreeImpl& rTree, configuration::NodeRef const& aNode)
+ OInnerGroupUpdate(configapi::ApiTreeImpl& rTree, configuration::NodeRef const& aNode)
: m_aAccessElement(static_cast<css::container::XChild*>(this),rTree,aNode)
{
}
@@ -118,12 +107,12 @@ namespace configmgr
uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) throw (uno::RuntimeException );
// Base class implementation
- virtual NodeAccess& getNodeAccess();
- virtual NodeGroupInfoAccess& getNode();
- virtual NodeGroupAccess* maybeGetUpdateAccess();
- virtual InnerElement& getElementClass();
+ virtual configapi::NodeAccess& getNodeAccess();
+ virtual configapi::NodeGroupInfoAccess& getNode();
+ virtual configapi::NodeGroupAccess* maybeGetUpdateAccess();
+ virtual configapi::InnerElement& getElementClass();
private:
- configapi::OInnerGroupUpdateAccess m_aAccessElement;
+ configapi::OInnerElement<configapi::NodeGroupAccess> m_aAccessElement;
};
@@ -140,11 +129,11 @@ namespace configmgr
{
public:
// Construction/Destruction
- OSetElementGroupInfo(configuration::TreeRef const& aTree, ApiTreeImpl& rParentTree)
+ OSetElementGroupInfo(rtl::Reference< configuration::Tree > const& aTree, configapi::ApiTreeImpl& rParentTree)
: m_aAccessElement(static_cast<css::container::XChild*>(this),aTree,rParentTree)
{
}
- OSetElementGroupInfo(configuration::TreeRef const& aTree, ApiProvider& rProvider, ApiTreeImpl* pParentTree = 0)
+ OSetElementGroupInfo(rtl::Reference< configuration::Tree > const& aTree, configapi::ApiProvider& rProvider, configapi::ApiTreeImpl* pParentTree = 0)
: m_aAccessElement(static_cast<css::container::XChild*>(this),aTree,rProvider,pParentTree)
{
}
@@ -161,12 +150,12 @@ namespace configmgr
uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) throw (uno::RuntimeException );
// Base class implementation
- virtual NodeAccess& getNodeAccess();
- virtual NodeGroupInfoAccess& getNode();
- virtual NodeGroupAccess* maybeGetUpdateAccess();
- virtual SetElement& getElementClass();
+ virtual configapi::NodeAccess& getNodeAccess();
+ virtual configapi::NodeGroupInfoAccess& getNode();
+ virtual configapi::NodeGroupAccess* maybeGetUpdateAccess();
+ virtual configapi::SetElement& getElementClass();
private:
- configapi::OSetElementGroupInfoAccess m_aAccessElement;
+ configapi::OSetElement<configapi::NodeGroupInfoAccess> m_aAccessElement;
};
/** updating access class for configuration nodes which are set elements and groups of other nodes
@@ -178,11 +167,11 @@ namespace configmgr
{
public:
// Construction/Destruction
- OSetElementGroupUpdate(configuration::TreeRef const& aTree, ApiTreeImpl& rParentTree)
+ OSetElementGroupUpdate(rtl::Reference< configuration::Tree > const& aTree, configapi::ApiTreeImpl& rParentTree)
: m_aAccessElement(static_cast<css::container::XChild*>(this),aTree,rParentTree)
{
}
- OSetElementGroupUpdate(configuration::TreeRef const& aTree, ApiProvider& rProvider, ApiTreeImpl* pParentTree = 0)
+ OSetElementGroupUpdate(rtl::Reference< configuration::Tree > const& aTree, configapi::ApiProvider& rProvider, configapi::ApiTreeImpl* pParentTree = 0)
: m_aAccessElement(static_cast<css::container::XChild*>(this),aTree,rProvider,pParentTree)
{
}
@@ -199,12 +188,12 @@ namespace configmgr
uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) throw (uno::RuntimeException );
// Base class implementation
- virtual NodeAccess& getNodeAccess();
- virtual NodeGroupInfoAccess& getNode();
- virtual NodeGroupAccess* maybeGetUpdateAccess();
- virtual SetElement& getElementClass();
+ virtual configapi::NodeAccess& getNodeAccess();
+ virtual configapi::NodeGroupInfoAccess& getNode();
+ virtual configapi::NodeGroupAccess* maybeGetUpdateAccess();
+ virtual configapi::SetElement& getElementClass();
private:
- configapi::OSetElementGroupUpdateAccess m_aAccessElement;
+ configapi::OSetElement<configapi::NodeGroupAccess> m_aAccessElement;
};
@@ -221,7 +210,7 @@ namespace configmgr
{
public:
// Construction/Destruction
- ORootElementGroupInfo(ApiProvider& rProvider, configuration::Tree const& aTree, vos::ORef< OOptions >const& _xOptions)
+ ORootElementGroupInfo(configapi::ApiProvider& rProvider, rtl::Reference< configuration::Tree > const& aTree, vos::ORef< OOptions >const& _xOptions)
: m_aAccessElement(static_cast<css::lang::XComponent*>(this),rProvider,aTree, _xOptions)
{
}
@@ -238,12 +227,12 @@ namespace configmgr
uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) throw (uno::RuntimeException );
// Base class implementation
- virtual NodeAccess& getNodeAccess();
- virtual NodeGroupInfoAccess& getNode();
- virtual NodeGroupAccess* maybeGetUpdateAccess();
- virtual RootElement& getElementClass();
+ virtual configapi::NodeAccess& getNodeAccess();
+ virtual configapi::NodeGroupInfoAccess& getNode();
+ virtual configapi::NodeGroupAccess* maybeGetUpdateAccess();
+ virtual configapi::RootElement& getElementClass();
private:
- configapi::ORootElementGroupInfoAccess m_aAccessElement;
+ configapi::OReadRootElement<configapi::NodeGroupInfoAccess> m_aAccessElement;
};
/** updating access class for configuration nodes which are root nodes and groups of other nodes
@@ -255,7 +244,7 @@ namespace configmgr
{
public:
// Construction/Destruction
- ORootElementGroupUpdate(ApiProvider& rProvider, configuration::Tree const& aTree, vos::ORef< OOptions >const& _xOptions)
+ ORootElementGroupUpdate(configapi::ApiProvider& rProvider, rtl::Reference< configuration::Tree > const& aTree, vos::ORef< OOptions >const& _xOptions)
: m_aAccessElement(static_cast<css::lang::XComponent*>(this),rProvider,aTree, _xOptions)
{
}
@@ -272,12 +261,12 @@ namespace configmgr
uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) throw (uno::RuntimeException );
// Base class implementation
- virtual NodeAccess& getNodeAccess();
- virtual NodeGroupInfoAccess& getNode();
- virtual NodeGroupAccess* maybeGetUpdateAccess();
- virtual UpdateRootElement& getElementClass();
+ virtual configapi::NodeAccess& getNodeAccess();
+ virtual configapi::NodeGroupInfoAccess& getNode();
+ virtual configapi::NodeGroupAccess* maybeGetUpdateAccess();
+ virtual configapi::UpdateRootElement& getElementClass();
private:
- configapi::ORootElementGroupUpdateAccess m_aAccessElement;
+ configapi::OUpdateRootElement<configapi::NodeGroupAccess> m_aAccessElement;
};
diff --git a/configmgr/source/api2/groupupdate.cxx b/configmgr/source/api2/groupupdate.cxx
index a9ffbc7dc4..15ce940d4d 100644
--- a/configmgr/source/api2/groupupdate.cxx
+++ b/configmgr/source/api2/groupupdate.cxx
@@ -42,13 +42,6 @@
namespace configmgr
{
//////////////////////////////////////////////////////////////////////////////////
-
- using uno::Reference;
- using uno::Sequence;
- using uno::Any;
- using uno::RuntimeException;
-
-//////////////////////////////////////////////////////////////////////////////////
// class BasicGroup
//////////////////////////////////////////////////////////////////////////////////
@@ -56,7 +49,7 @@ namespace configmgr
//////////////////////////////////////////////////////////////////////////////////
uno::Any SAL_CALL BasicGroup::queryInterface( uno::Type const& rType ) throw (uno::RuntimeException )
{
- Any aRet = BasicGroupAccess::queryInterface( rType );
+ uno::Any aRet = BasicGroupAccess::queryInterface( rType );
if (!aRet.hasValue())
{
aRet = cppu::queryInterface(rType
@@ -92,7 +85,7 @@ configapi::NodeGroupAccess& BasicGroup::getGroupNode()
if (!pAccess)
{
throw uno::RuntimeException(
- OUString(RTL_CONSTASCII_USTRINGPARAM("Configuration: Invalid Object - internal update interface missing.")),
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Configuration: Invalid Object - internal update interface missing.")),
static_cast< css::container::XNameReplace * >(this)
);
}
@@ -102,7 +95,7 @@ configapi::NodeGroupAccess& BasicGroup::getGroupNode()
// New Interface methods
// XNameReplace
//////////////////////////////////////////////////////////////////////////////////
-void SAL_CALL BasicGroup::replaceByName( const OUString& rName, const uno::Any& rElement )
+void SAL_CALL BasicGroup::replaceByName( const rtl::OUString& rName, const uno::Any& rElement )
throw(css::lang::IllegalArgumentException, css::container::NoSuchElementException, css::lang::WrappedTargetException, uno::RuntimeException)
{
configapi::implReplaceByName( getGroupNode(), rName, rElement );
diff --git a/configmgr/source/api2/groupupdate.hxx b/configmgr/source/api2/groupupdate.hxx
index cf40a0685b..ad85036b7c 100644
--- a/configmgr/source/api2/groupupdate.hxx
+++ b/configmgr/source/api2/groupupdate.hxx
@@ -71,20 +71,20 @@ namespace configmgr
{ return BasicGroupAccess::hasElements(); }
// XNameAccess forwarding
- virtual uno::Any SAL_CALL getByName( const OUString& aName )
+ virtual uno::Any SAL_CALL getByName( const rtl::OUString& aName )
throw(css::container::NoSuchElementException, css::lang::WrappedTargetException, uno::RuntimeException)
{ return BasicGroupAccess::getByName(aName); }
- virtual uno::Sequence< OUString > SAL_CALL getElementNames( ) throw( uno::RuntimeException)
+ virtual uno::Sequence< rtl::OUString > SAL_CALL getElementNames( ) throw( uno::RuntimeException)
{ return BasicGroupAccess::getElementNames(); }
- virtual sal_Bool SAL_CALL hasByName( const OUString& aName ) throw(uno::RuntimeException)
+ virtual sal_Bool SAL_CALL hasByName( const rtl::OUString& aName ) throw(uno::RuntimeException)
{ return BasicGroupAccess::hasByName(aName); }
// New Interface methods
// XNameReplace
virtual void SAL_CALL
- replaceByName( const OUString& rName, const uno::Any& rElement )
+ replaceByName( const rtl::OUString& rName, const uno::Any& rElement )
throw(css::lang::IllegalArgumentException, css::container::NoSuchElementException, css::lang::WrappedTargetException, uno::RuntimeException);
protected:
diff --git a/configmgr/source/api2/listenercontainer.cxx b/configmgr/source/api2/listenercontainer.cxx
index bad5ad4997..5f54d6f77f 100644
--- a/configmgr/source/api2/listenercontainer.cxx
+++ b/configmgr/source/api2/listenercontainer.cxx
@@ -46,7 +46,7 @@ namespace configmgr
// class DisposeNotifier
//-----------------------------------------------------------------------------
-void DisposeNotifier::appendAndClearContainer(ListenerContainer* pContainer)
+void DisposeNotifier::appendAndClearContainer(cppu::OInterfaceContainerHelper* pContainer)
{
if (pContainer)
{
@@ -54,7 +54,7 @@ void DisposeNotifier::appendAndClearContainer(ListenerContainer* pContainer)
cppu::OInterfaceIteratorHelper aIterator(*pContainer);
while (aIterator.hasMoreElements())
{
- aListeners.push_back(Listener::query(aIterator.next()));
+ aListeners.push_back(uno::Reference< lang::XEventListener >::query(aIterator.next()));
}
}
pContainer->clear();
@@ -63,7 +63,7 @@ void DisposeNotifier::appendAndClearContainer(ListenerContainer* pContainer)
//-----------------------------------------------------------------------------
void DisposeNotifier::notify()
{
- for(Listeners::iterator it = aListeners.begin(); it != aListeners.end(); ++it)
+ for(std::vector< uno::Reference< lang::XEventListener > >::iterator it = aListeners.begin(); it != aListeners.end(); ++it)
{
if (it->is())
{
diff --git a/configmgr/source/api2/listenercontainer.hxx b/configmgr/source/api2/listenercontainer.hxx
index 67445c69da..cff7a1ff92 100644
--- a/configmgr/source/api2/listenercontainer.hxx
+++ b/configmgr/source/api2/listenercontainer.hxx
@@ -34,6 +34,7 @@
#include <com/sun/star/lang/XEventListener.hpp>
#include <com/sun/star/lang/DisposedException.hpp>
#include <cppuhelper/interfacecontainer.hxx>
+#include "datalock.hxx"
#include "utility.hxx"
#include <osl/diagnose.h>
@@ -47,13 +48,7 @@ namespace configmgr
namespace css = ::com::sun::star;
namespace uno = css::uno;
namespace lang = css::lang;
-
- typedef uno::Type UnoType;
- typedef uno::XInterface UnoInterface;
- typedef uno::Reference<uno::XInterface> UnoInterfaceRef;
//-----------------------------------------------------------------------------
- typedef cppu::OInterfaceContainerHelper ListenerContainer;
-
template <class Listener>
class ListenerContainerIterator
{
@@ -67,7 +62,7 @@ namespace configmgr
*
* @param rCont the container of the elements.
*/
- ListenerContainerIterator( ListenerContainer& rCont )
+ ListenerContainerIterator( cppu::OInterfaceContainerHelper& rCont )
: m_aIter(rCont)
, m_xNext()
{ advance(); }
@@ -94,42 +89,31 @@ namespace configmgr
//-----------------------------------------------------------------------------
class DisposeNotifier
{
- typedef uno::Reference< lang::XEventListener > Listener;
- typedef std::vector< Listener > Listeners;
lang::EventObject aEvent;
- Listeners aListeners;
+ std::vector< uno::Reference< lang::XEventListener > > aListeners;
public:
explicit
- DisposeNotifier(UnoInterfaceRef const& aInterface) : aEvent(aInterface) {}
+ DisposeNotifier(uno::Reference<uno::XInterface> const& aInterface) : aEvent(aInterface) {}
- void appendAndClearContainer(ListenerContainer* pContainer);
+ void appendAndClearContainer(cppu::OInterfaceContainerHelper* pContainer);
void notify();
};
//-----------------------------------------------------------------------------
+ struct BasicContainerInfo
+ {
+ uno::XInterface* pInterface;
+ cppu::OMultiTypeInterfaceContainerHelper* pContainer;
+ BasicContainerInfo() : pInterface(0), pContainer(0) {}
+ };
+
template <class Key_, class KeyHash_, class KeyEq_, class KeyToIndex_>
class SpecialListenerContainer
{
public:
- typedef cppu::OMultiTypeInterfaceContainerHelper BasicContainerHelper;
- struct BasicContainerInfo
- {
- UnoInterface* pInterface;
- BasicContainerHelper* pContainer;
- BasicContainerInfo() : pInterface(0), pContainer(0) {}
- };
- typedef std::vector<BasicContainerInfo> BasicContainerHelperArray;
- typedef typename BasicContainerHelperArray::size_type Index;
-
- typedef Key_ Key;
- typedef cppu::OMultiTypeInterfaceContainerHelperVar< Key_,KeyHash_,KeyEq_ > SpecialContainerHelper;
- typedef cppu::OBroadcastHelperVar< SpecialContainerHelper, Key > SpecialBroadcastHelper;
- typedef std::vector<Key> KeyList;
-
- public:
/**
* Create a container of interface containers.
*/
- SpecialListenerContainer(Index nCount, KeyToIndex_ aMapper)
+ SpecialListenerContainer(std::vector<BasicContainerInfo>::size_type nCount, KeyToIndex_ aMapper)
: m_aSpecialHelper(UnoApiLock::getLock())
, m_aContainers(nCount)
, m_aMapper(aMapper)
@@ -160,18 +144,18 @@ namespace configmgr
bool isDisposed()volatile const throw();
/// return whether the object is present in this container
- bool isAvailable(Index nIndex) const throw()
+ bool isAvailable(std::vector<BasicContainerInfo>::size_type nIndex) const throw()
{
return nIndex < m_aContainers.size() && m_aContainers[nIndex].pInterface;
}
- Index getSize() const
+ std::vector<BasicContainerInfo>::size_type getSize() const
{
return m_aContainers.size();
}
/// return the interface associated with an index
- void setObjectAt(Index nIndex, UnoInterface* pInterface)
+ void setObjectAt(std::vector<BasicContainerInfo>::size_type nIndex, uno::XInterface* pInterface)
{
OSL_ENSURE( !isDisposed(), "object is disposed" );
@@ -191,17 +175,17 @@ namespace configmgr
/// return the interface associated with an index
- UnoInterfaceRef getObjectAt(Index nIndex) const
+ uno::Reference<uno::XInterface> getObjectAt(std::vector<BasicContainerInfo>::size_type nIndex) const
{
- UnoInterfaceRef xRet( nIndex < m_aContainers.size() ? m_aContainers[nIndex].pInterface : 0 );
+ uno::Reference<uno::XInterface> xRet( nIndex < m_aContainers.size() ? m_aContainers[nIndex].pInterface : 0 );
return xRet;
}
/// return the interface associated with an index
- UnoInterfaceRef getObjectForKey(Key const& aKey ) const
+ uno::Reference<uno::XInterface> getObjectForKey(Key_ const& aKey ) const
{
- Index nIndex = m_aMapper.findIndexForKey(aKey);
- UnoInterfaceRef xRet( nIndex < m_aContainers.size() ? m_aContainers[nIndex].pInterface : 0 );
+ std::vector<BasicContainerInfo>::size_type nIndex = m_aMapper.findIndexForKey(aKey);
+ uno::Reference<uno::XInterface> xRet( nIndex < m_aContainers.size() ? m_aContainers[nIndex].pInterface : 0 );
return xRet;
}
@@ -210,7 +194,7 @@ namespace configmgr
* and in the containers for the associated indices
* support XEventListener. Then clear the container.
*/
- bool disposeOne( Index anIndex ) throw();
+ bool disposeOne( std::vector<BasicContainerInfo>::size_type anIndex ) throw();
/**
* Start disposing this object
@@ -241,7 +225,7 @@ namespace configmgr
* @return the container created under this key. If the container
* was not created, null was returned.
*/
- ListenerContainer * getSpecialContainer( const Key_ & aKey) const
+ cppu::OInterfaceContainerHelper * getSpecialContainer( const Key_ & aKey) const
{ return m_aSpecialHelper.aLC.getContainer(aKey); }
/**
@@ -249,7 +233,7 @@ namespace configmgr
* @return the container helper created under this key. If the container helper
* was not created, null was returned.
*/
- BasicContainerHelper * getContainerHelper( Index nIndex) const
+ cppu::OMultiTypeInterfaceContainerHelper * getContainerHelper( std::vector<BasicContainerInfo>::size_type nIndex) const
{
return ((nIndex < m_aContainers.size()) ? m_aContainers[nIndex].pContainer : 0 );
}
@@ -258,9 +242,9 @@ namespace configmgr
* @return the container created under this key. If the container
* was not created, null was returned.
*/
- ListenerContainer * getContainer( Index nIndex, const UnoType & aType) const
+ cppu::OInterfaceContainerHelper * getContainer( std::vector<BasicContainerInfo>::size_type nIndex, const uno::Type & aType) const
{
- BasicContainerHelper* pContainer = (nIndex < m_aContainers.size()) ? m_aContainers[nIndex].pContainer : 0 ;
+ cppu::OMultiTypeInterfaceContainerHelper* pContainer = (nIndex < m_aContainers.size()) ? m_aContainers[nIndex].pContainer : 0 ;
return pContainer ? pContainer->getContainer(aType) : 0;
}
@@ -273,7 +257,7 @@ namespace configmgr
* the same pointer more than once.
* @return the new count of elements in the container (or 0 if the object is ready being disposed).
*/
- sal_Int32 addListener( Index nIndex, const UnoType& aType, uno::Reference< lang::XEventListener > const& xListener) throw();
+ sal_Int32 addListener( std::vector<BasicContainerInfo>::size_type nIndex, const uno::Type& aType, uno::Reference< lang::XEventListener > const& xListener) throw();
/**
* Remove an element from the container specified with the index and type.
@@ -282,7 +266,7 @@ namespace configmgr
* @param xListener the removed interface.
* @return the new count of elements in the container (or 0 if the object is ready being disposed).
*/
- sal_Int32 removeListener( Index nIndex, const UnoType& aType, uno::Reference< lang::XEventListener > const& xListener) throw();
+ sal_Int32 removeListener( std::vector<BasicContainerInfo>::size_type nIndex, const uno::Type& aType, uno::Reference< lang::XEventListener > const& xListener) throw();
/**
@@ -305,10 +289,10 @@ namespace configmgr
sal_Int32 removeSpecialListener( const Key_& aKey, uno::Reference< lang::XEventListener > const& xListener) throw();
private:
- void implFillDisposer(DisposeNotifier& aNotifier, Index nIndex);
+ void implFillDisposer(DisposeNotifier& aNotifier, std::vector<BasicContainerInfo>::size_type nIndex);
- SpecialBroadcastHelper m_aSpecialHelper;
- BasicContainerHelperArray m_aContainers;
+ cppu::OBroadcastHelperVar< cppu::OMultiTypeInterfaceContainerHelperVar< Key_,KeyHash_,KeyEq_ >, Key_ > m_aSpecialHelper;
+ std::vector<BasicContainerInfo> m_aContainers;
KeyToIndex_ m_aMapper;
bool m_bDisposeLock;
};
@@ -348,14 +332,14 @@ namespace configmgr
}
//-----------------------------------------------------------------------------
template <class Key_, class KeyHash_, class KeyEq_, class KeyToIndex_>
- bool SpecialListenerContainer<Key_,KeyHash_,KeyEq_, KeyToIndex_>::disposeOne(Index nIndex) throw()
+ bool SpecialListenerContainer<Key_,KeyHash_,KeyEq_, KeyToIndex_>::disposeOne(std::vector<BasicContainerInfo>::size_type nIndex) throw()
{
// OSL_ENSURE(!isDisposed(),"Object is already disposed in toto");
if (isAlive())
{
if (nIndex < m_aContainers.size())
{
- if (UnoInterface* pObject = m_aContainers[nIndex].pInterface)
+ if (uno::XInterface* pObject = m_aContainers[nIndex].pInterface)
{
DisposeNotifier aNotifier(pObject);
@@ -398,12 +382,12 @@ namespace configmgr
lang::EventObject aBaseEvt;
std::vector<DisposeNotifier> aNotifiers;
- if (Index size = m_aContainers.size())
+ if (std::vector<BasicContainerInfo>::size_type size = m_aContainers.size())
{
aNotifiers.reserve(m_aContainers.size());
aBaseEvt.Source = m_aContainers[0].pInterface;
- for(Index ix = 0; ix < size; ++ix)
+ for(std::vector<BasicContainerInfo>::size_type ix = 0; ix < size; ++ix)
{
if (m_aContainers[ix].pInterface)
{
@@ -417,7 +401,7 @@ namespace configmgr
m_bDisposeLock = false;
- for(Index jx = 0, count = aNotifiers.size(); jx < count; ++jx)
+ for(std::vector<BasicContainerInfo>::size_type jx = 0, count = aNotifiers.size(); jx < count; ++jx)
{
aNotifiers[jx].notify();
}
@@ -446,14 +430,14 @@ namespace configmgr
}
//-----------------------------------------------------------------------------
template <class Key_, class KeyHash_, class KeyEq_, class KeyToIndex_>
- sal_Int32 SpecialListenerContainer<Key_,KeyHash_,KeyEq_, KeyToIndex_>::addListener( Index nIndex, const UnoType& aType, const uno::Reference< lang::XEventListener > & xListener ) throw()
+ sal_Int32 SpecialListenerContainer<Key_,KeyHash_,KeyEq_, KeyToIndex_>::addListener( std::vector<BasicContainerInfo>::size_type nIndex, const uno::Type& aType, const uno::Reference< lang::XEventListener > & xListener ) throw()
{
if ( nIndex < m_aContainers.size() && m_aContainers[nIndex].pInterface )
{
if ( isAlive() )
{
if (m_aContainers[nIndex].pContainer == 0)
- m_aContainers[nIndex].pContainer = new BasicContainerHelper(UnoApiLock::getLock());
+ m_aContainers[nIndex].pContainer = new cppu::OMultiTypeInterfaceContainerHelper(UnoApiLock::getLock());
return m_aContainers[nIndex].pContainer->addInterface(aType,xListener);
}
@@ -474,7 +458,7 @@ namespace configmgr
template <class Key_, class KeyHash_, class KeyEq_, class KeyToIndex_>
sal_Int32 SpecialListenerContainer<Key_,KeyHash_,KeyEq_, KeyToIndex_>::addSpecialListener( const Key_& aKey, const uno::Reference< lang::XEventListener > & xListener ) throw()
{
- Index nIndex = m_aMapper.findIndexForKey(aKey);
+ std::vector<BasicContainerInfo>::size_type nIndex = m_aMapper.findIndexForKey(aKey);
if ( nIndex < m_aContainers.size() && m_aContainers[nIndex].pInterface )
{
if ( isAlive() )
@@ -496,7 +480,7 @@ namespace configmgr
//-----------------------------------------------------------------------------
template <class Key_, class KeyHash_, class KeyEq_, class KeyToIndex_>
- sal_Int32 SpecialListenerContainer<Key_,KeyHash_,KeyEq_, KeyToIndex_>::removeListener( Index nIndex, const UnoType& aType, const uno::Reference< lang::XEventListener > & xListener ) throw()
+ sal_Int32 SpecialListenerContainer<Key_,KeyHash_,KeyEq_, KeyToIndex_>::removeListener( std::vector<BasicContainerInfo>::size_type nIndex, const uno::Type& aType, const uno::Reference< lang::XEventListener > & xListener ) throw()
{
OSL_ENSURE( !isDisposed(), "object is disposed" );
@@ -533,7 +517,7 @@ namespace configmgr
//-----------------------------------------------------------------------------
// relation function. Uses KeyToIndex
template <class Key_, class KeyHash_, class KeyEq_, class KeyToIndex_>
- bool SpecialListenerContainer<Key_,KeyHash_,KeyEq_, KeyToIndex_>::findKeysForIndex(Index nIndex, KeyList & aKeys)
+ bool SpecialListenerContainer<Key_,KeyHash_,KeyEq_, KeyToIndex_>::findKeysForIndex(std::vector<BasicContainerInfo>::size_type nIndex, std::vector<Key_> & aKeys)
{
aKeys.clear();
m_aMapper.findKeysForIndex(nIndex,aKeys);
@@ -542,25 +526,25 @@ namespace configmgr
*///-----------------------------------------------------------------------------
// relation function. Uses KeyToIndex
template <class Key_, class KeyHash_, class KeyEq_, class KeyToIndex_>
- void SpecialListenerContainer<Key_,KeyHash_,KeyEq_, KeyToIndex_>::implFillDisposer(DisposeNotifier& aNotifier, Index nIndex)
+ void SpecialListenerContainer<Key_,KeyHash_,KeyEq_, KeyToIndex_>::implFillDisposer(DisposeNotifier& aNotifier, std::vector<BasicContainerInfo>::size_type nIndex)
{
- if (BasicContainerHelper* pMultiContainer = m_aContainers[nIndex].pContainer)
+ if (cppu::OMultiTypeInterfaceContainerHelper* pMultiContainer = m_aContainers[nIndex].pContainer)
{
- uno::Sequence< UnoType > aTypes(pMultiContainer->getContainedTypes());
+ uno::Sequence< uno::Type > aTypes(pMultiContainer->getContainedTypes());
for (sal_Int32 ix = 0; ix < aTypes.getLength(); ++ix)
{
- ListenerContainer* pContainer = pMultiContainer->getContainer(aTypes[ix]);
+ cppu::OInterfaceContainerHelper* pContainer = pMultiContainer->getContainer(aTypes[ix]);
OSL_ENSURE(pContainer,"No container, but the type ?");
if (pContainer)
aNotifier.appendAndClearContainer(pContainer);
}
}
- KeyList aKeys;
+ std::vector<Key_> aKeys;
if (m_aMapper.findKeysForIndex(nIndex,aKeys))
{
- for(typename KeyList::iterator it = aKeys.begin(); it != aKeys.end(); ++it)
+ for(typename std::vector<Key_>::iterator it = aKeys.begin(); it != aKeys.end(); ++it)
{
- if (ListenerContainer* pContainer = m_aSpecialHelper.aLC.getContainer(*it))
+ if (cppu::OInterfaceContainerHelper* pContainer = m_aSpecialHelper.aLC.getContainer(*it))
{
aNotifier.appendAndClearContainer(pContainer);
}
diff --git a/configmgr/source/api2/makefile.mk b/configmgr/source/api2/makefile.mk
index 140e7b0643..f5c9ca4792 100644
--- a/configmgr/source/api2/makefile.mk
+++ b/configmgr/source/api2/makefile.mk
@@ -47,8 +47,6 @@ SLOFILES= \
$(SLO)$/listenercontainer.obj \
$(SLO)$/provider.obj \
$(SLO)$/providerimpl.obj \
- $(SLO)$/confprovider2.obj \
- $(SLO)$/confproviderimpl2.obj \
$(SLO)$/accessimpl.obj \
$(SLO)$/apiaccessobj.obj \
$(SLO)$/apiserviceinfo.obj \
diff --git a/configmgr/source/api2/notifierimpl.hxx b/configmgr/source/api2/notifierimpl.hxx
index b0fffe2215..445ef00d31 100644
--- a/configmgr/source/api2/notifierimpl.hxx
+++ b/configmgr/source/api2/notifierimpl.hxx
@@ -53,55 +53,46 @@ namespace configmgr
{
// ---------------------------------------------------------------------------------------------------
+ struct SubNodeHash
+ {
+ size_t operator() (const configuration::SubNodeID& rKey) const {return rKey.hashCode();}
+ };
+ struct SubNodeEq
+ {
+ bool operator() (const configuration::SubNodeID& lhs,const configuration::SubNodeID& rhs) const {return lhs == rhs;}
+ };
+ struct SubNodeToIndex
+ {
+ rtl::Reference< configuration::Tree > aTree;
+
+ SubNodeToIndex( rtl::Reference< configuration::Tree > const& rTree ) : aTree(rTree) {}
+
+ bool findKeysForIndex(unsigned int nNode, std::vector<configuration::SubNodeID>& aList)
+ {
+ aList.clear();
+ configuration::getAllChildrenHelper(configuration::findNodeFromIndex(aTree,nNode), aList);
+ return !aList.empty();
+ }
+ unsigned int findIndexForKey(configuration::SubNodeID const& aNode)
+ {
+ return aNode.getParentID().toIndex();
+ }
+ };
+
/// manages collections of event listeners observing a whole config tree, thread-safe
class NotifierImpl : public vos::OReference
{
public:
- typedef configuration::SubNodeID SubNodeID;
- typedef configuration::SubNodeIDList SubNodeList;
- typedef configuration::NodeID NodeID;
- typedef configuration::NodeOffset NodeOffset;
-
- struct SubNodeHash
- {
- size_t operator() (const SubNodeID& rKey) const {return rKey.hashCode();}
- };
- struct SubNodeEq
- {
- bool operator() (const SubNodeID& lhs,const SubNodeID& rhs) const {return lhs == rhs;}
- };
- struct SubNodeToIndex
- {
- configuration::TreeRef aTree;
-
- SubNodeToIndex( configuration::TreeRef const& rTree ) : aTree(rTree) {}
-
- bool findKeysForIndex(NodeOffset nNode, SubNodeList& aList)
- {
- using configuration::getAllChildrenHelper;
- using configuration::findNodeFromIndex;
- aList.clear();
- getAllChildrenHelper(findNodeFromIndex(aTree,nNode), aList);
- return !aList.empty();
- }
- NodeOffset findIndexForKey(SubNodeID const& aNode)
- {
- return aNode.getParentID().toIndex();
- }
- };
- typedef SpecialListenerContainer <SubNodeID,SubNodeHash,SubNodeEq,SubNodeToIndex> SpecialContainer;
-
- public:
- SpecialContainer m_aListeners;
+ SpecialListenerContainer <configuration::SubNodeID,SubNodeHash,SubNodeEq,SubNodeToIndex> m_aListeners;
public:
/// construct this around the given Implementation, for the given tree
explicit
- NotifierImpl(configuration::TreeRef const& aTree);
+ NotifierImpl(rtl::Reference< configuration::Tree > const& aTree);
~NotifierImpl();
/// Add a <type scope='com::sun::star::lang'>XEventListener</type> observing <var>aNode</var>.
- void add(NodeID const& aNode, uno::Reference< css::lang::XEventListener > const& xListener)
+ void add(configuration::NodeID const& aNode, uno::Reference< css::lang::XEventListener > const& xListener)
{
OSL_PRECOND(xListener.is(), "ERROR: Unexpected NULL listener");
@@ -110,7 +101,7 @@ namespace configmgr
}
/// Add a <type scope='com::sun::star::container'>XContainerListener</type> observing <var>aNode</var>.
- void add(NodeID const& aNode, uno::Reference< css::container::XContainerListener > const& xListener)
+ void add(configuration::NodeID const& aNode, uno::Reference< css::container::XContainerListener > const& xListener)
{
OSL_PRECOND(xListener.is(), "ERROR: Unexpected NULL listener");
@@ -119,7 +110,7 @@ namespace configmgr
}
/// Add a <type scope='com::sun::star::util'>XChangesListener</type> observing <var>aNode</var> and its descendants.
- void add(NodeID const& aNode, uno::Reference< css::util::XChangesListener > const& xListener)
+ void add(configuration::NodeID const& aNode, uno::Reference< css::util::XChangesListener > const& xListener)
{
OSL_PRECOND(xListener.is(), "ERROR: Unexpected NULL listener");
@@ -128,7 +119,7 @@ namespace configmgr
}
/// Add a <type scope='com::sun::star::beans'>XPropertyChangeListener</type> observing <var>aNode</var>.
- void addNamed(SubNodeID const& aNode, uno::Reference< css::beans::XPropertyChangeListener > const& xListener)
+ void addNamed(configuration::SubNodeID const& aNode, uno::Reference< css::beans::XPropertyChangeListener > const& xListener)
{
OSL_PRECOND(xListener.is(), "ERROR: Unexpected NULL listener");
@@ -136,7 +127,7 @@ namespace configmgr
m_aListeners.addSpecialListener(aNode,xListener.get());
}
/// Add a <type scope='com::sun::star::beans'>XPropertyChangeListener</type> observing <var>aNode</var>.
- void addForAll(NodeID const& aNode, uno::Reference< css::beans::XPropertyChangeListener > const& xListener)
+ void addForAll(configuration::NodeID const& aNode, uno::Reference< css::beans::XPropertyChangeListener > const& xListener)
{
OSL_PRECOND(xListener.is(), "ERROR: Unexpected NULL listener");
@@ -144,7 +135,7 @@ namespace configmgr
m_aListeners.addListener(aNode.toIndex(),getCppuType(&xListener),xListener.get());
}
/// Add a <type scope='com::sun::star::beans'>XVetoableChangeListener</type> constraining <var>aNode</var>.
- void addNamed(SubNodeID const& aNode, uno::Reference< css::beans::XVetoableChangeListener > const& xListener)
+ void addNamed(configuration::SubNodeID const& aNode, uno::Reference< css::beans::XVetoableChangeListener > const& xListener)
{
OSL_PRECOND(xListener.is(), "ERROR: Unexpected NULL listener");
@@ -152,7 +143,7 @@ namespace configmgr
m_aListeners.addSpecialListener(aNode,xListener.get());
}
/// Add a <type scope='com::sun::star::beans'>XVetoableChangeListener</type> constraining <var>aNode</var>.
- void addForAll(NodeID const& aNode, uno::Reference< css::beans::XVetoableChangeListener > const& xListener)
+ void addForAll(configuration::NodeID const& aNode, uno::Reference< css::beans::XVetoableChangeListener > const& xListener)
{
OSL_PRECOND(xListener.is(), "ERROR: Unexpected NULL listener");
@@ -163,7 +154,7 @@ namespace configmgr
/** Add a <type scope='com::sun::star::beans'>XPropertiesChangeListener</type>
observing all properties of <var>aNode</var>.
*/
- void add(NodeID const& aNode, uno::Reference< css::beans::XPropertiesChangeListener > const& xListener)
+ void add(configuration::NodeID const& aNode, uno::Reference< css::beans::XPropertiesChangeListener > const& xListener)
{
OSL_PRECOND(xListener.is(), "ERROR: Unexpected NULL listener");
@@ -174,7 +165,7 @@ namespace configmgr
/** Add a <type scope='com::sun::star::beans'>XPropertiesChangeListener</type>
observing the properties of <var>aNode</var> (optimally only those given by <var>aNames</var>.
*/
- void add(NodeID const& aNode, uno::Reference< css::beans::XPropertiesChangeListener > const& xListener, uno::Sequence< OUString> const& aNames)
+ void add(configuration::NodeID const& aNode, uno::Reference< css::beans::XPropertiesChangeListener > const& xListener, uno::Sequence< rtl::OUString> const& aNames)
{
OSL_PRECOND(xListener.is(), "ERROR: Unexpected NULL listener");
OSL_PRECOND(aNames.getLength() > 0, "ERROR: Unexpected empty sequence");
@@ -186,46 +177,46 @@ namespace configmgr
// ---------------------------------------------------------------------------------------------------
/// Remove a <type scope='com::sun::star::lang'>XEventListener</type> observing <var>aNode</var>.
- void remove(NodeID const& aNode, uno::Reference< css::lang::XEventListener > const& xListener)
+ void remove(configuration::NodeID const& aNode, uno::Reference< css::lang::XEventListener > const& xListener)
{
// ignore the names for now
m_aListeners.removeListener(aNode.toIndex(),getCppuType(&xListener),xListener.get());
}
/// Remove a <type scope='com::sun::star::container'>XContainerListener</type> observing <var>aNode</var>.
- void remove(NodeID const& aNode, uno::Reference< css::container::XContainerListener > const& xListener)
+ void remove(configuration::NodeID const& aNode, uno::Reference< css::container::XContainerListener > const& xListener)
{
// ignore the names for now
m_aListeners.removeListener(aNode.toIndex(),getCppuType(&xListener),xListener.get());
}
/// Remove a <type scope='com::sun::star::util'>XChangesListener</type> observing <var>aNode</var> and its descendants.
- void remove(NodeID const& aNode, uno::Reference< css::util::XChangesListener > const& xListener)
+ void remove(configuration::NodeID const& aNode, uno::Reference< css::util::XChangesListener > const& xListener)
{
// ignore the names for now
m_aListeners.removeListener(aNode.toIndex(),getCppuType(&xListener),xListener.get());
}
/// Remove a <type scope='com::sun::star::beans'>XPropertyChangeListener</type> observing <var>aNode</var>.
- void removeNamed(SubNodeID const& aNode, uno::Reference< css::beans::XPropertyChangeListener > const& xListener)
+ void removeNamed(configuration::SubNodeID const& aNode, uno::Reference< css::beans::XPropertyChangeListener > const& xListener)
{
// ignore the names for now
m_aListeners.removeSpecialListener(aNode,xListener.get());
}
/// Remove a <type scope='com::sun::star::beans'>XPropertyChangeListener</type> observing <var>aNode</var>.
- void removeForAll(NodeID const& aNode, uno::Reference< css::beans::XPropertyChangeListener > const& xListener)
+ void removeForAll(configuration::NodeID const& aNode, uno::Reference< css::beans::XPropertyChangeListener > const& xListener)
{
// ignore the names for now
m_aListeners.removeListener(aNode.toIndex(),getCppuType(&xListener),xListener.get());
}
/// Remove a <type scope='com::sun::star::beans'>XVetoableChangeListener</type> constraining <var>aNode</var>.
- void removeNamed(SubNodeID const& aNode, uno::Reference< css::beans::XVetoableChangeListener > const& xListener)
+ void removeNamed(configuration::SubNodeID const& aNode, uno::Reference< css::beans::XVetoableChangeListener > const& xListener)
{
// ignore the names for now
m_aListeners.removeSpecialListener(aNode,xListener.get());
}
/// Remove a <type scope='com::sun::star::beans'>XVetoableChangeListener</type> constraining <var>aNode</var>.
- void removeForAll(NodeID const& aNode, uno::Reference< css::beans::XVetoableChangeListener > const& xListener)
+ void removeForAll(configuration::NodeID const& aNode, uno::Reference< css::beans::XVetoableChangeListener > const& xListener)
{
// ignore the names for now
m_aListeners.removeListener(aNode.toIndex(),getCppuType(&xListener),xListener.get());
@@ -235,7 +226,7 @@ namespace configmgr
/** Remove a <type scope='com::sun::star::beans'>XPropertiesChangeListener</type>
observing any properties of <var>aNode</var>.
*/
- void remove(NodeID const& aNode, uno::Reference< css::beans::XPropertiesChangeListener > const& xListener)
+ void remove(configuration::NodeID const& aNode, uno::Reference< css::beans::XPropertiesChangeListener > const& xListener)
{
// ignore the names for now
m_aListeners.removeListener(aNode.toIndex(),getCppuType(&xListener),xListener.get());
diff --git a/configmgr/source/api2/objectregistry.hxx b/configmgr/source/api2/objectregistry.hxx
index e43505d652..5e28fdad5a 100644
--- a/configmgr/source/api2/objectregistry.hxx
+++ b/configmgr/source/api2/objectregistry.hxx
@@ -49,37 +49,34 @@ namespace configmgr
class ObjectRegistry : public vos::OReference
{
public:
- typedef configuration::NodeID Key;
- typedef NodeElement* Element;
- typedef NodeElement* ElementArg;
- static Element notFound() { return 0; }
+ static NodeElement* notFound() { return 0; }
struct KeyHash
{
- size_t operator() (const Key& rKey) const {return rKey.hashCode();}
+ size_t operator() (const configuration::NodeID& rKey) const {return rKey.hashCode();}
};
struct KeyEq
{
- bool operator() (const Key& lhs,const Key& rhs) const {return lhs == rhs;}
+ bool operator() (const configuration::NodeID& lhs,const configuration::NodeID& rhs) const {return lhs == rhs;}
};
- typedef std::hash_map<Key,Element,KeyHash, KeyEq> ObjectMap;
+ typedef std::hash_map<configuration::NodeID,NodeElement*,KeyHash, KeyEq> ObjectMap;
public:
ObjectRegistry() {}
~ObjectRegistry();
- Element findElement(Key const& aNode) const
+ NodeElement* findElement(configuration::NodeID const& aNode) const
{
ObjectMap::const_iterator aFound = m_aMap.find(aNode);
return (aFound != m_aMap.end()) ? aFound->second : notFound();
}
- void registerElement(Key const& aNode, ElementArg aElement)
+ void registerElement(configuration::NodeID const& aNode, NodeElement* aElement)
{
OSL_ENSURE(m_aMap.find(aNode) == m_aMap.end(), "ERROR: Node is already registered");
m_aMap[aNode] = aElement;
}
- void revokeElement(Key const& aNode, ElementArg aElement)
+ void revokeElement(configuration::NodeID const& aNode, NodeElement* aElement)
{
ObjectMap::iterator aFound = m_aMap.find(aNode);
diff --git a/configmgr/source/api2/propertiesfilterednotifier.cxx b/configmgr/source/api2/propertiesfilterednotifier.cxx
index fd93a60e0d..7e4a13f9b9 100644
--- a/configmgr/source/api2/propertiesfilterednotifier.cxx
+++ b/configmgr/source/api2/propertiesfilterednotifier.cxx
@@ -41,23 +41,13 @@ namespace configmgr
namespace lang = ::com::sun::star::lang;
namespace beans = ::com::sun::star::beans;
- using ::rtl::OUString;
-
- using uno::Any;
- using uno::Type;
- using uno::Reference;
- using uno::Sequence;
-
- using lang::EventObject;
-
- using beans::PropertyChangeEvent;
//-----------------------------------------------------------------------------
// class PropertiesFilteredNotifier
//-----------------------------------------------------------------------------
PropertiesFilteredNotifier::PropertiesFilteredNotifier(
- Reference< beans::XPropertiesChangeListener >const& xTarget,
- Sequence< OUString > const& aFilterNames
+ uno::Reference< beans::XPropertiesChangeListener >const& xTarget,
+ uno::Sequence< rtl::OUString > const& aFilterNames
)
: m_aRefCount()
, m_xTarget(xTarget)
@@ -86,7 +76,7 @@ void SAL_CALL PropertiesFilteredNotifier::release( ) throw()
}
//-----------------------------------------------------------------------------
-uno::Any SAL_CALL PropertiesFilteredNotifier::queryInterface( const Type& aType )
+uno::Any SAL_CALL PropertiesFilteredNotifier::queryInterface( const uno::Type& aType )
throw(uno::RuntimeException)
{
return cppu::queryInterface(aType
@@ -97,7 +87,7 @@ uno::Any SAL_CALL PropertiesFilteredNotifier::queryInterface( const Type& aType
}
//-----------------------------------------------------------------------------
-void SAL_CALL PropertiesFilteredNotifier::disposing( const EventObject& Source )
+void SAL_CALL PropertiesFilteredNotifier::disposing( const lang::EventObject& Source )
throw(uno::RuntimeException)
{
if (m_xTarget.is())
@@ -119,7 +109,7 @@ bool PropertiesFilteredNotifier::implAccept(const ::com::sun::star::beans::Prope
//-----------------------------------------------------------------------------
// private and only used once
-Sequence< PropertyChangeEvent > PropertiesFilteredNotifier::implFilter(const Sequence< PropertyChangeEvent >& evt) const
+uno::Sequence< beans::PropertyChangeEvent > PropertiesFilteredNotifier::implFilter(const uno::Sequence< beans::PropertyChangeEvent >& evt) const
{
sal_Int32 const nSize = evt.getLength();
sal_Int32 nAccepted = 0;
@@ -131,7 +121,7 @@ Sequence< PropertyChangeEvent > PropertiesFilteredNotifier::implFilter(const Seq
return evt;
// create a modified copy
- Sequence< PropertyChangeEvent > aResult(evt);
+ uno::Sequence< beans::PropertyChangeEvent > aResult(evt);
for (sal_Int32 nCur = nAccepted+1; nCur<nSize; ++nCur)
{
if (implAccept(evt[nCur]))
@@ -146,10 +136,10 @@ Sequence< PropertyChangeEvent > PropertiesFilteredNotifier::implFilter(const Seq
}
//-----------------------------------------------------------------------------
-void SAL_CALL PropertiesFilteredNotifier::propertiesChange( const Sequence< PropertyChangeEvent >& evt )
+void SAL_CALL PropertiesFilteredNotifier::propertiesChange( const uno::Sequence< beans::PropertyChangeEvent >& evt )
throw(uno::RuntimeException)
{
- Sequence< PropertyChangeEvent > aFilteredEvt( implFilter(evt) );
+ uno::Sequence< beans::PropertyChangeEvent > aFilteredEvt( implFilter(evt) );
if (aFilteredEvt.getLength() > 0)
{
diff --git a/configmgr/source/api2/propertyinfohelper.cxx b/configmgr/source/api2/propertyinfohelper.cxx
index cb2c33fce1..2b9acdfd94 100644
--- a/configmgr/source/api2/propertyinfohelper.cxx
+++ b/configmgr/source/api2/propertyinfohelper.cxx
@@ -48,7 +48,7 @@ namespace configmgr
namespace configapi
{
//-----------------------------------------------------------------------------
-beans::Property helperMakeProperty(configuration::Name const& aName,
+beans::Property helperMakeProperty(rtl::OUString const& aName,
node::Attributes const aAttributes,
uno::Type const& aType,
bool bDefaultable )
@@ -65,7 +65,7 @@ beans::Property helperMakeProperty(configuration::Name const& aName,
if ( aAttributes.isRemovable()) nPropAttributes |= PropertyAttribute::REMOVABLE;
if ( bDefaultable) nPropAttributes |= PropertyAttribute::MAYBEDEFAULT;
- return beans::Property(aName.toString(), -1, aType, nPropAttributes);
+ return beans::Property(aName, -1, aType, nPropAttributes);
}
//-----------------------------------------------------------------------------
}
diff --git a/configmgr/source/api2/propertyinfohelper.hxx b/configmgr/source/api2/propertyinfohelper.hxx
index 3575beb813..657ee983cc 100644
--- a/configmgr/source/api2/propertyinfohelper.hxx
+++ b/configmgr/source/api2/propertyinfohelper.hxx
@@ -44,12 +44,11 @@ namespace configmgr
(read-only operation)
*/
namespace node { struct Attributes; }
- namespace configuration { class Name; }
namespace configapi
{
// translation helper
- beans::Property helperMakeProperty( configuration::Name const& aName, node::Attributes const aAttributes, uno::Type const& aType, bool bDefaultable )
+ beans::Property helperMakeProperty( rtl::OUString const& aName, node::Attributes const aAttributes, uno::Type const& aType, bool bDefaultable )
throw(uno::RuntimeException);
}
diff --git a/configmgr/source/api2/propertysetaccess.cxx b/configmgr/source/api2/propertysetaccess.cxx
index 48a9bd6c33..7a9be49a33 100644
--- a/configmgr/source/api2/propertysetaccess.cxx
+++ b/configmgr/source/api2/propertysetaccess.cxx
@@ -40,13 +40,6 @@
namespace configmgr
{
//////////////////////////////////////////////////////////////////////////////////
-
- using uno::Reference;
- using uno::Sequence;
- using uno::Any;
- using uno::RuntimeException;
-
-//////////////////////////////////////////////////////////////////////////////////
// class BasicPropertySet
//////////////////////////////////////////////////////////////////////////////////
@@ -83,7 +76,7 @@ configapi::NodeGroupAccess& BasicPropertySet::getGroupNode()
if (!pAccess)
{
throw beans::PropertyVetoException(
- OUString(RTL_CONSTASCII_USTRINGPARAM("Configuration: INTERNAL VETO - Write operation invoked on a read-only node access")),
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Configuration: INTERNAL VETO - Write operation invoked on a read-only node access")),
static_cast< beans::XPropertySet * >(this)
);
}
@@ -92,7 +85,7 @@ configapi::NodeGroupAccess& BasicPropertySet::getGroupNode()
// XPropertySet
//////////////////////////////////////////////////////////////////////////////////
-void SAL_CALL BasicPropertySet::setPropertyValue( const OUString& aPropertyName, const uno::Any& aValue )
+void SAL_CALL BasicPropertySet::setPropertyValue( const rtl::OUString& aPropertyName, const uno::Any& aValue )
throw(beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException,
lang::WrappedTargetException, uno::RuntimeException)
{
@@ -101,7 +94,7 @@ void SAL_CALL BasicPropertySet::setPropertyValue( const OUString& aPropertyName,
// XMultiPropertySet
//////////////////////////////////////////////////////////////////////////////////
-void SAL_CALL BasicPropertySet::setPropertyValues( const uno::Sequence< OUString >& PropertyNames, const uno::Sequence< uno::Any >& Values )
+void SAL_CALL BasicPropertySet::setPropertyValues( const uno::Sequence< rtl::OUString >& PropertyNames, const uno::Sequence< uno::Any >& Values )
throw(beans::PropertyVetoException, lang::IllegalArgumentException,
lang::WrappedTargetException, uno::RuntimeException)
{
@@ -110,7 +103,7 @@ void SAL_CALL BasicPropertySet::setPropertyValues( const uno::Sequence< OUString
// XHierarchicalPropertySet
//////////////////////////////////////////////////////////////////////////////////
-void SAL_CALL BasicPropertySet::setHierarchicalPropertyValue( const OUString& aPropertyName, const uno::Any& aValue )
+void SAL_CALL BasicPropertySet::setHierarchicalPropertyValue( const rtl::OUString& aPropertyName, const uno::Any& aValue )
throw(beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException,
lang::WrappedTargetException, uno::RuntimeException)
{
@@ -119,7 +112,7 @@ void SAL_CALL BasicPropertySet::setHierarchicalPropertyValue( const OUString& aP
// XMultiHierarchicalPropertySet
//////////////////////////////////////////////////////////////////////////////////
-void SAL_CALL BasicPropertySet::setHierarchicalPropertyValues( const uno::Sequence< OUString >& PropertyNames, const uno::Sequence< uno::Any >& Values )
+void SAL_CALL BasicPropertySet::setHierarchicalPropertyValues( const uno::Sequence< rtl::OUString >& PropertyNames, const uno::Sequence< uno::Any >& Values )
throw(beans::PropertyVetoException, lang::IllegalArgumentException,
lang::WrappedTargetException, uno::RuntimeException)
{
@@ -132,7 +125,7 @@ void SAL_CALL BasicPropertySet::setHierarchicalPropertyValues( const uno::Sequen
//////////////////////////////////////////////////////////////////////////////////
// XPropertySet
//////////////////////////////////////////////////////////////////////////////////
-uno::Any SAL_CALL BasicPropertySet::getPropertyValue( const OUString& aPropertyName )
+uno::Any SAL_CALL BasicPropertySet::getPropertyValue( const rtl::OUString& aPropertyName )
throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
{
return configapi::implGetPropertyValue( getNode(), aPropertyName );
@@ -140,7 +133,7 @@ uno::Any SAL_CALL BasicPropertySet::getPropertyValue( const OUString& aPropertyN
// XMultiPropertySet
//////////////////////////////////////////////////////////////////////////////////
-uno::Sequence< uno::Any > SAL_CALL BasicPropertySet::getPropertyValues( const uno::Sequence< OUString >& aPropertyNames )
+uno::Sequence< uno::Any > SAL_CALL BasicPropertySet::getPropertyValues( const uno::Sequence< rtl::OUString >& aPropertyNames )
throw(uno::RuntimeException)
{
return configapi::implGetPropertyValues( getNode(), aPropertyNames );
@@ -148,7 +141,7 @@ uno::Sequence< uno::Any > SAL_CALL BasicPropertySet::getPropertyValues( const un
// XHierarchicalPropertySet
//////////////////////////////////////////////////////////////////////////////////
-uno::Any SAL_CALL BasicPropertySet::getHierarchicalPropertyValue( const OUString& aPropertyName )
+uno::Any SAL_CALL BasicPropertySet::getHierarchicalPropertyValue( const rtl::OUString& aPropertyName )
throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
{
return configapi::implGetHierarchicalPropertyValue( getNode(), aPropertyName );
@@ -156,7 +149,7 @@ uno::Any SAL_CALL BasicPropertySet::getHierarchicalPropertyValue( const OUString
// XMultiHierarchicalPropertySet
//////////////////////////////////////////////////////////////////////////////////
-uno::Sequence< uno::Any > SAL_CALL BasicPropertySet::getHierarchicalPropertyValues( const uno::Sequence< OUString >& aPropertyNames )
+uno::Sequence< uno::Any > SAL_CALL BasicPropertySet::getHierarchicalPropertyValues( const uno::Sequence< rtl::OUString >& aPropertyNames )
throw(uno::RuntimeException)
{
return configapi::implGetHierarchicalPropertyValues( getNode(), aPropertyNames );
@@ -166,33 +159,33 @@ uno::Sequence< uno::Any > SAL_CALL BasicPropertySet::getHierarchicalPropertyValu
// adding/removing listeners
//////////////////////////////////////////////////////////////////////////////////
-void SAL_CALL BasicPropertySet::addVetoableChangeListener( const OUString& aPropertyName, const uno::Reference< beans::XVetoableChangeListener >& xListener )
+void SAL_CALL BasicPropertySet::addVetoableChangeListener( const rtl::OUString& aPropertyName, const uno::Reference< beans::XVetoableChangeListener >& xListener )
throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
{
configapi::implAddListener( getNode(), xListener, aPropertyName );
}
-void SAL_CALL BasicPropertySet::addPropertyChangeListener( const OUString& aPropertyName, const uno::Reference< beans::XPropertyChangeListener >& xListener )
+void SAL_CALL BasicPropertySet::addPropertyChangeListener( const rtl::OUString& aPropertyName, const uno::Reference< beans::XPropertyChangeListener >& xListener )
throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
{
configapi::implAddListener( getNode(), xListener, aPropertyName );
}
-void SAL_CALL BasicPropertySet::addPropertiesChangeListener( const uno::Sequence< OUString >& aPropertyNames, const uno::Reference< beans::XPropertiesChangeListener >& xListener )
+void SAL_CALL BasicPropertySet::addPropertiesChangeListener( const uno::Sequence< rtl::OUString >& aPropertyNames, const uno::Reference< beans::XPropertiesChangeListener >& xListener )
throw(uno::RuntimeException)
{
configapi::implAddListener( getNode(), xListener, aPropertyNames );
}
//////////////////////////////////////////////////////////////////////////////////
-void SAL_CALL BasicPropertySet::removeVetoableChangeListener( const OUString& aPropertyName, const uno::Reference< beans::XVetoableChangeListener >& xListener )
+void SAL_CALL BasicPropertySet::removeVetoableChangeListener( const rtl::OUString& aPropertyName, const uno::Reference< beans::XVetoableChangeListener >& xListener )
throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
{
configapi::implRemoveListener( getNode(), xListener, aPropertyName );
}
//---------------------------------------------------------------------------------
-void SAL_CALL BasicPropertySet::removePropertyChangeListener( const OUString& aPropertyName, const uno::Reference< beans::XPropertyChangeListener >& xListener )
+void SAL_CALL BasicPropertySet::removePropertyChangeListener( const rtl::OUString& aPropertyName, const uno::Reference< beans::XPropertyChangeListener >& xListener )
throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
{
configapi::implRemoveListener( getNode(), xListener, aPropertyName );
@@ -210,7 +203,7 @@ void SAL_CALL BasicPropertySet::removePropertiesChangeListener( const uno::Refer
//////////////////////////////////////////////////////////////////////////////////
// SPECIAL: XMultiPropertySet::firePropertiesChangeEvent
//////////////////////////////////////////////////////////////////////////////////
-void SAL_CALL BasicPropertySet::firePropertiesChangeEvent( const uno::Sequence< OUString >& aPropertyNames, const uno::Reference< beans::XPropertiesChangeListener >& xListener )
+void SAL_CALL BasicPropertySet::firePropertiesChangeEvent( const uno::Sequence< rtl::OUString >& aPropertyNames, const uno::Reference< beans::XPropertiesChangeListener >& xListener )
throw(uno::RuntimeException)
{
configapi::implFirePropertiesChangeEvent( getNode(),aPropertyNames , xListener );
@@ -223,14 +216,14 @@ void SAL_CALL BasicPropertySet::firePropertiesChangeEvent( const uno::Sequence<
// getting property states
//////////////////////////////////////////////////////////////////////////////////
-beans::PropertyState SAL_CALL BasicPropertySet::getPropertyState( const OUString& sPropertyName )
+beans::PropertyState SAL_CALL BasicPropertySet::getPropertyState( const rtl::OUString& sPropertyName )
throw(beans::UnknownPropertyException, uno::RuntimeException)
{
return configapi::implGetPropertyState( getNode(), sPropertyName);
}
//---------------------------------------------------------------------------------
-uno::Sequence< beans::PropertyState > SAL_CALL BasicPropertySet::getPropertyStates( const uno::Sequence< OUString >& aPropertyNames )
+uno::Sequence< beans::PropertyState > SAL_CALL BasicPropertySet::getPropertyStates( const uno::Sequence< rtl::OUString >& aPropertyNames )
throw(beans::UnknownPropertyException, uno::RuntimeException)
{
return configapi::implGetPropertyStates( getNode(), aPropertyNames );
@@ -240,14 +233,14 @@ uno::Sequence< beans::PropertyState > SAL_CALL BasicPropertySet::getPropertyStat
// setting to default state
//////////////////////////////////////////////////////////////////////////////////
-void SAL_CALL BasicPropertySet::setPropertyToDefault( const OUString& sPropertyName )
+void SAL_CALL BasicPropertySet::setPropertyToDefault( const rtl::OUString& sPropertyName )
throw(beans::UnknownPropertyException, uno::RuntimeException)
{
configapi::implSetPropertyToDefault( getGroupNode(), sPropertyName);
}
//---------------------------------------------------------------------------------
-void SAL_CALL BasicPropertySet::setPropertiesToDefault( const uno::Sequence< OUString >& aPropertyNames )
+void SAL_CALL BasicPropertySet::setPropertiesToDefault( const uno::Sequence< rtl::OUString >& aPropertyNames )
throw (beans::UnknownPropertyException, uno::RuntimeException)
{
configapi::implSetPropertiesToDefault( getGroupNode(), aPropertyNames);
@@ -264,7 +257,7 @@ void SAL_CALL BasicPropertySet::setAllPropertiesToDefault( )
// getting defaults
//////////////////////////////////////////////////////////////////////////////////
-uno::Any SAL_CALL BasicPropertySet::getPropertyDefault( const OUString& sPropertyName )
+uno::Any SAL_CALL BasicPropertySet::getPropertyDefault( const rtl::OUString& sPropertyName )
throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
{
@@ -272,7 +265,7 @@ uno::Any SAL_CALL BasicPropertySet::getPropertyDefault( const OUString& sPropert
}
//---------------------------------------------------------------------------------
-uno::Sequence< uno::Any > SAL_CALL BasicPropertySet::getPropertyDefaults( const uno::Sequence< OUString >& aPropertyNames )
+uno::Sequence< uno::Any > SAL_CALL BasicPropertySet::getPropertyDefaults( const uno::Sequence< rtl::OUString >& aPropertyNames )
throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
{
return configapi::implGetPropertyDefaults( getNode(), aPropertyNames);
diff --git a/configmgr/source/api2/propertysetaccess.hxx b/configmgr/source/api2/propertysetaccess.hxx
index c5712bccaa..0cf8d0580f 100644
--- a/configmgr/source/api2/propertysetaccess.hxx
+++ b/configmgr/source/api2/propertysetaccess.hxx
@@ -46,7 +46,6 @@ namespace configmgr
namespace uno = css::uno;
namespace lang = css::lang;
namespace beans = css::beans;
- using rtl::OUString;
namespace configapi
{
@@ -89,64 +88,64 @@ public:
// setting values - may all throw (PropertyVeto)Exceptions on read-only property sets
// XPropertySet
virtual void SAL_CALL
- setPropertyValue( const OUString& aPropertyName, const uno::Any& aValue )
+ setPropertyValue( const rtl::OUString& aPropertyName, const uno::Any& aValue )
throw(beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException,
lang::WrappedTargetException, uno::RuntimeException);
// XMultiPropertySet
virtual void SAL_CALL
- setPropertyValues( const uno::Sequence< OUString >& PropertyNames, const uno::Sequence< uno::Any >& Values )
+ setPropertyValues( const uno::Sequence< rtl::OUString >& PropertyNames, const uno::Sequence< uno::Any >& Values )
throw(beans::PropertyVetoException, lang::IllegalArgumentException,
lang::WrappedTargetException, uno::RuntimeException);
// XHierarchicalPropertySet
virtual void SAL_CALL
- setHierarchicalPropertyValue( const OUString& aPropertyName, const uno::Any& aValue )
+ setHierarchicalPropertyValue( const rtl::OUString& aPropertyName, const uno::Any& aValue )
throw(beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException,
lang::WrappedTargetException, uno::RuntimeException);
// XMultiHierarchicalPropertySet
virtual void SAL_CALL
- setHierarchicalPropertyValues( const uno::Sequence< OUString >& PropertyNames, const uno::Sequence< uno::Any >& Values )
+ setHierarchicalPropertyValues( const uno::Sequence< rtl::OUString >& PropertyNames, const uno::Sequence< uno::Any >& Values )
throw(beans::PropertyVetoException, lang::IllegalArgumentException,
lang::WrappedTargetException, uno::RuntimeException);
// getting values
// XPropertySet
virtual uno::Any SAL_CALL
- getPropertyValue( const OUString& PropertyName )
+ getPropertyValue( const rtl::OUString& PropertyName )
throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException);
// XMultiPropertySet
virtual uno::Sequence< uno::Any > SAL_CALL
- getPropertyValues( const uno::Sequence< OUString >& aPropertyNames )
+ getPropertyValues( const uno::Sequence< rtl::OUString >& aPropertyNames )
throw(uno::RuntimeException);
// XHierarchicalPropertySet
virtual uno::Any SAL_CALL
- getHierarchicalPropertyValue( const OUString& PropertyName )
+ getHierarchicalPropertyValue( const rtl::OUString& PropertyName )
throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException);
// XMultiHierarchicalPropertySet
virtual uno::Sequence< uno::Any > SAL_CALL
- getHierarchicalPropertyValues( const uno::Sequence< OUString >& aPropertyNames )
+ getHierarchicalPropertyValues( const uno::Sequence< rtl::OUString >& aPropertyNames )
throw(uno::RuntimeException);
// adding listeners
// XPropertySet
virtual void SAL_CALL
- addPropertyChangeListener( const OUString& aPropertyName, const uno::Reference< beans::XPropertyChangeListener >& xListener )
+ addPropertyChangeListener( const rtl::OUString& aPropertyName, const uno::Reference< beans::XPropertyChangeListener >& xListener )
throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException);
// XMultiPropertySet
virtual void SAL_CALL
- addPropertiesChangeListener( const uno::Sequence< OUString >& aPropertyNames, const uno::Reference< beans::XPropertiesChangeListener >& xListener )
+ addPropertiesChangeListener( const uno::Sequence< rtl::OUString >& aPropertyNames, const uno::Reference< beans::XPropertiesChangeListener >& xListener )
throw(uno::RuntimeException);
// removing listeners
// XPropertySet
virtual void SAL_CALL
- removePropertyChangeListener( const OUString& aPropertyName, const uno::Reference< beans::XPropertyChangeListener >& aListener )
+ removePropertyChangeListener( const rtl::OUString& aPropertyName, const uno::Reference< beans::XPropertyChangeListener >& aListener )
throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException);
// XMultiPropertySet
@@ -157,40 +156,40 @@ public:
// SPECIAL: support for VetoableChangeListeners
// XPropertySet
virtual void SAL_CALL
- addVetoableChangeListener( const OUString& PropertyName, const uno::Reference< beans::XVetoableChangeListener >& aListener )
+ addVetoableChangeListener( const rtl::OUString& PropertyName, const uno::Reference< beans::XVetoableChangeListener >& aListener )
throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException);
virtual void SAL_CALL
- removeVetoableChangeListener( const OUString& PropertyName, const uno::Reference< beans::XVetoableChangeListener >& aListener )
+ removeVetoableChangeListener( const rtl::OUString& PropertyName, const uno::Reference< beans::XVetoableChangeListener >& aListener )
throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException);
// SPECIAL: firePropertiesChangeEvent
// XMultiPropertySet
virtual void SAL_CALL
- firePropertiesChangeEvent( const uno::Sequence< OUString >& aPropertyNames, const uno::Reference< beans::XPropertiesChangeListener >& xListener )
+ firePropertiesChangeEvent( const uno::Sequence< rtl::OUString >& aPropertyNames, const uno::Reference< beans::XPropertiesChangeListener >& xListener )
throw(uno::RuntimeException);
// XPropertyState
virtual beans::PropertyState SAL_CALL
- getPropertyState( const OUString& PropertyName )
+ getPropertyState( const rtl::OUString& PropertyName )
throw(beans::UnknownPropertyException, uno::RuntimeException);
// see below:
// virtual uno::Sequence< beans::PropertyState > SAL_CALL
- // getPropertyStates( const uno::Sequence< OUString >& aPropertyName )
+ // getPropertyStates( const uno::Sequence< rtl::OUString >& aPropertyName )
// throw(beans::UnknownPropertyException, uno::RuntimeException);
virtual void SAL_CALL
- setPropertyToDefault( const OUString& PropertyName )
+ setPropertyToDefault( const rtl::OUString& PropertyName )
throw(beans::UnknownPropertyException, uno::RuntimeException);
virtual uno::Any SAL_CALL
- getPropertyDefault( const OUString& aPropertyName )
+ getPropertyDefault( const rtl::OUString& aPropertyName )
throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException);
// XMultiPropertyStates
virtual uno::Sequence< beans::PropertyState > SAL_CALL
- getPropertyStates( const uno::Sequence< OUString >& aPropertyName )
+ getPropertyStates( const uno::Sequence< rtl::OUString >& aPropertyName )
throw (beans::UnknownPropertyException, uno::RuntimeException);
virtual void SAL_CALL
@@ -198,11 +197,11 @@ public:
throw (uno::RuntimeException);
virtual void SAL_CALL
- setPropertiesToDefault( const uno::Sequence< OUString >& aPropertyNames )
+ setPropertiesToDefault( const uno::Sequence< rtl::OUString >& aPropertyNames )
throw (beans::UnknownPropertyException, uno::RuntimeException);
virtual uno::Sequence< uno::Any > SAL_CALL
- getPropertyDefaults( const uno::Sequence< OUString >& aPropertyNames )
+ getPropertyDefaults( const uno::Sequence< rtl::OUString >& aPropertyNames )
throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException);
protected:
diff --git a/configmgr/source/api2/propsetaccessimpl.cxx b/configmgr/source/api2/propsetaccessimpl.cxx
index 238d66400b..be1f571076 100644
--- a/configmgr/source/api2/propsetaccessimpl.cxx
+++ b/configmgr/source/api2/propsetaccessimpl.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: propsetaccessimpl.cxx,v $
- * $Revision: 1.24.4.1 $
+ * $Revision: 1.24.10.5 $
*
* This file is part of OpenOffice.org.
*
@@ -63,40 +63,13 @@ namespace configmgr
namespace lang = css::lang;
namespace beans = css::beans;
- using uno::RuntimeException;
- using uno::Reference;
- using uno::Any;
- using uno::Sequence;
-
- using lang::IllegalArgumentException;
- using lang::WrappedTargetException;
- using beans::UnknownPropertyException;
- using beans::PropertyVetoException;
-
- using configuration::AnyNodeRef;
- using configuration::NodeRef;
- using configuration::ValueRef;
-
- using configuration::Tree;
- using configuration::NodeChange;
- using configuration::NodeChanges;
-
- using configuration::Name;
- using configuration::AbsolutePath;
- using configuration::RelativePath;
- using configuration::validateChildName;
- using configuration::validateChildOrElementName;
-
- using namespace beans;
- using namespace uno;
-
//-----------------------------------------------------------------------------------
// a helper class
//-----------------------------------------------------------------------------------
class CollectProperties : configuration::NodeVisitor
{
- std::vector< Property > m_aProperties;
+ std::vector< beans::Property > m_aProperties;
sal_Bool m_bReadonly;
public:
CollectProperties(sal_Bool _bReadonly)
@@ -106,27 +79,25 @@ public:
: m_bReadonly(_bReadonly)
{ m_aProperties.reserve(_nCount); }
- Sequence<Property> forChildren(Tree const& _aPropertyTree, NodeRef const& _rNode)
+ uno::Sequence<beans::Property> forChildren(rtl::Reference< configuration::Tree > const& _aPropertyTree, configuration::NodeRef const& _rNode)
{
- OSL_ENSURE( _aPropertyTree.isValidNode(_rNode), "Node to retrieve properties from does not match tree");
+ OSL_ENSURE( _rNode.isValid() && _aPropertyTree->isValidNode(_rNode.getOffset()), "Node to retrieve properties from does not match tree");
reset();
- _aPropertyTree.dispatchToChildren(_rNode, *this);
+ _aPropertyTree->dispatchToChildren(_rNode, *this);
return makeSequence(m_aProperties);
}
private:
- typedef node::Attributes NodeAttributes;
-
void reset() { m_aProperties.clear(); }
- NodeAttributes adjustAttributes(NodeAttributes nNodeAttr);
+ node::Attributes adjustAttributes(node::Attributes nNodeAttr);
- Result handle(Tree const& _aTree, NodeRef const& _rValue);
- Result handle(Tree const& _aTree, ValueRef const& _rValue);
+ Result handle(rtl::Reference< configuration::Tree > const& _aTree, configuration::NodeRef const& _rValue);
+ Result handle(rtl::Reference< configuration::Tree > const& _aTree, configuration::ValueRef const& _rValue);
};
//-----------------------------------------------------------------------------------
-CollectProperties::NodeAttributes CollectProperties::adjustAttributes(NodeAttributes nNodeAttr)
+node::Attributes CollectProperties::adjustAttributes(node::Attributes nNodeAttr)
{
if (m_bReadonly) nNodeAttr.markReadonly();
@@ -134,14 +105,14 @@ CollectProperties::NodeAttributes CollectProperties::adjustAttributes(NodeAttrib
}
//-----------------------------------------------------------------------------------
-CollectProperties::Result CollectProperties::handle(Tree const& _aTree, ValueRef const& _rValue)
+CollectProperties::Result CollectProperties::handle(rtl::Reference< configuration::Tree > const& _aTree, configuration::ValueRef const& _rValue)
{
// can be default ?
m_aProperties.push_back(
- helperMakeProperty( _aTree.getName(_rValue),
- adjustAttributes(_aTree.getAttributes(_rValue)),
- _aTree.getUnoType(_rValue),
- _aTree.hasNodeDefault(_rValue)
+ helperMakeProperty( _rValue.m_sNodeName,
+ adjustAttributes(_aTree->getAttributes(_rValue)),
+ _aTree->getUnoType(_rValue),
+ _aTree->hasNodeDefault(_rValue)
)
);
@@ -149,17 +120,17 @@ CollectProperties::Result CollectProperties::handle(Tree const& _aTree, ValueRef
}
//-----------------------------------------------------------------------------------
-CollectProperties::Result CollectProperties::handle(Tree const& _aTree, NodeRef const& _rNode)
+CollectProperties::Result CollectProperties::handle(rtl::Reference< configuration::Tree > const& _aTree, configuration::NodeRef const& _rNode)
{
// can be default ?
OSL_ENSURE( configuration::isStructuralNode(_aTree,_rNode),
"Unexpected value element node. Cannot get proper type for this node as property" );
m_aProperties.push_back(
- helperMakeProperty( _aTree.getName(_rNode),
- adjustAttributes(_aTree.getAttributes(_rNode)),
+ helperMakeProperty( _aTree->getSimpleNodeName(_rNode.getOffset()),
+ adjustAttributes(_aTree->getAttributes(_rNode)),
getUnoInterfaceType(),
- _aTree.hasNodeDefault(_rNode)
+ _aTree->hasNodeDefault(_rNode)
)
);
@@ -173,100 +144,100 @@ CollectProperties::Result CollectProperties::handle(Tree const& _aTree, NodeRef
class NodePropertySetInfo
:public ::cppu::WeakImplHelper1< beans::XPropertySetInfo >
{
- Sequence< Property > const m_aProperties;
+ uno::Sequence< beans::Property > const m_aProperties;
public:
- NodePropertySetInfo(Sequence< Property > const& _aProperties) throw(RuntimeException)
+ NodePropertySetInfo(uno::Sequence< beans::Property > const& _aProperties) throw(uno::RuntimeException)
: m_aProperties(_aProperties)
{
}
- static NodePropertySetInfo* create(NodeGroupInfoAccess& _rNode, sal_Bool _bReadonly ) throw(RuntimeException);
- Property const* begin() const throw() { return m_aProperties.getConstArray(); }
- Property const* end() const throw() { return m_aProperties.getConstArray() + m_aProperties.getLength(); }
+ static NodePropertySetInfo* create(NodeGroupInfoAccess& _rNode, sal_Bool _bReadonly ) throw(uno::RuntimeException);
+ beans::Property const* begin() const throw() { return m_aProperties.getConstArray(); }
+ beans::Property const* end() const throw() { return m_aProperties.getConstArray() + m_aProperties.getLength(); }
- Property const* find(const OUString& _rPropertyName) const throw(RuntimeException);
+ beans::Property const* find(const rtl::OUString& _rPropertyName) const throw(uno::RuntimeException);
// XPropertySetInfo
- virtual Sequence< Property > SAL_CALL getProperties() throw(RuntimeException);
- virtual Property SAL_CALL getPropertyByName(const OUString& _rPropertyName) throw(UnknownPropertyException, RuntimeException);
- virtual sal_Bool SAL_CALL hasPropertyByName(const OUString& _rPropertyName) throw(RuntimeException);
+ virtual uno::Sequence< beans::Property > SAL_CALL getProperties() throw(uno::RuntimeException);
+ virtual beans::Property SAL_CALL getPropertyByName(const rtl::OUString& _rPropertyName) throw(beans::UnknownPropertyException, uno::RuntimeException);
+ virtual sal_Bool SAL_CALL hasPropertyByName(const rtl::OUString& _rPropertyName) throw(uno::RuntimeException);
};
//-----------------------------------------------------------------------------------
//-----------------------------------------------------------------------------------
-NodePropertySetInfo* NodePropertySetInfo::create(NodeGroupInfoAccess& _rNode, sal_Bool _bReadonly ) throw(RuntimeException)
+NodePropertySetInfo* NodePropertySetInfo::create(NodeGroupInfoAccess& _rNode, sal_Bool _bReadonly ) throw(uno::RuntimeException)
{
UnoApiLock aLock;
- configuration::Tree aTree( _rNode.getTree() );
- OSL_ENSURE( !aTree.isEmpty(), "WARNING: Getting Tree information requires a valid tree");
- if (aTree.isEmpty()) return NULL;
+ rtl::Reference< configuration::Tree > aTree( _rNode.getTree() );
+ OSL_ENSURE( !configuration::isEmpty(aTree.get()), "WARNING: Getting Tree information requires a valid tree");
+ if (configuration::isEmpty(aTree.get())) return NULL;
configuration::NodeRef aNode( _rNode.getNodeRef() );
- OSL_ENSURE( aTree.isValidNode(aNode), "ERROR: Tree does not match node");
+ OSL_ENSURE( aNode.isValid() && aTree->isValidNode(aNode.getOffset()), "ERROR: Tree does not match node");
- Sequence< Property > aProperties = CollectProperties(_bReadonly).forChildren(aTree,aNode);
+ uno::Sequence< beans::Property > aProperties = CollectProperties(_bReadonly).forChildren(aTree,aNode);
OSL_ENSURE( aProperties.getLength() > 0, "ERROR: PropertySet (Configuration group) has no Properties");
return new NodePropertySetInfo( aProperties );
}
//-----------------------------------------------------------------------------------
-struct MatchName // : std::unary_function< Property, bool >
+struct MatchName // : std::unary_function< beans::Property, bool >
{
- OUString sName;
- MatchName(OUString const& _sName) throw(RuntimeException)
+ rtl::OUString sName;
+ MatchName(rtl::OUString const& _sName) throw(uno::RuntimeException)
: sName(_sName)
{
}
- bool operator()(Property const& _aProperty) const
+ bool operator()(beans::Property const& _aProperty) const
{
return !!(_aProperty.Name == this->sName);
}
};
-Property const* NodePropertySetInfo::find(const OUString& _rPropertyName) const throw(RuntimeException)
+beans::Property const* NodePropertySetInfo::find(const rtl::OUString& _rPropertyName) const throw(uno::RuntimeException)
{
- Property const* const first = this->begin();
- Property const* const last = this->end();
+ beans::Property const* const first = this->begin();
+ beans::Property const* const last = this->end();
return std::find_if(first,last,MatchName(_rPropertyName));
}
//-----------------------------------------------------------------------------------
-uno::Sequence< beans::Property > SAL_CALL NodePropertySetInfo::getProperties() throw(RuntimeException)
+uno::Sequence< beans::Property > SAL_CALL NodePropertySetInfo::getProperties() throw(uno::RuntimeException)
{
return m_aProperties;
}
//-----------------------------------------------------------------------------------
-Property SAL_CALL NodePropertySetInfo::getPropertyByName(const OUString& _rPropertyName)
- throw(UnknownPropertyException, RuntimeException)
+beans::Property SAL_CALL NodePropertySetInfo::getPropertyByName(const rtl::OUString& _rPropertyName)
+ throw(beans::UnknownPropertyException, uno::RuntimeException)
{
UnoApiLock aLock;
- Property const* pFound = find(_rPropertyName);
+ beans::Property const* pFound = find(_rPropertyName);
if (pFound == this->end())
{
- OUString sMessage = OUString::createFromAscii("Configuration - ");
- sMessage += OUString::createFromAscii("No Property named '");
+ rtl::OUString sMessage = rtl::OUString::createFromAscii("Configuration - ");
+ sMessage += rtl::OUString::createFromAscii("No Property named '");
sMessage += _rPropertyName;
- sMessage += OUString::createFromAscii("' in this PropertySetInfo");
- throw UnknownPropertyException(sMessage, static_cast<XPropertySetInfo*>(this));
+ sMessage += rtl::OUString::createFromAscii("' in this PropertySetInfo");
+ throw beans::UnknownPropertyException(sMessage, static_cast<XPropertySetInfo*>(this));
}
return *pFound;
}
//-----------------------------------------------------------------------------------
-sal_Bool SAL_CALL NodePropertySetInfo::hasPropertyByName(const OUString& _rPropertyName)
- throw(RuntimeException)
+sal_Bool SAL_CALL NodePropertySetInfo::hasPropertyByName(const rtl::OUString& _rPropertyName)
+ throw(uno::RuntimeException)
{
UnoApiLock aLock;
- Property const* pFound = find(_rPropertyName);
+ beans::Property const* pFound = find(_rPropertyName);
return (pFound != this->end());
}
@@ -280,17 +251,17 @@ sal_Bool SAL_CALL NodePropertySetInfo::hasPropertyByName(const OUString& _rPrope
// XPropertySet & XMultiPropertySet
//-----------------------------------------------------------------------------------
-Reference< beans::XPropertySetInfo > implGetPropertySetInfo( NodeGroupInfoAccess& rNode, sal_Bool _bWriteable )
- throw(RuntimeException)
+uno::Reference< beans::XPropertySetInfo > implGetPropertySetInfo( NodeGroupInfoAccess& rNode, sal_Bool _bWriteable )
+ throw(uno::RuntimeException)
{
- GuardedNodeDataAccess lock( rNode );
+ GuardedNodeData<NodeAccess> lock( rNode );
return NodePropertySetInfo::create(rNode, !_bWriteable);
}
// XHierarchicalPropertySet & XHierarchicalMultiPropertySet
//-----------------------------------------------------------------------------------
-Reference< beans::XHierarchicalPropertySetInfo > implGetHierarchicalPropertySetInfo( NodeGroupInfoAccess& /*rNode*/ )
- throw(RuntimeException)
+uno::Reference< beans::XHierarchicalPropertySetInfo > implGetHierarchicalPropertySetInfo( NodeGroupInfoAccess& /*rNode*/ )
+ throw(uno::RuntimeException)
{
// TODO: Implement
return 0;
@@ -302,56 +273,56 @@ Reference< beans::XHierarchicalPropertySetInfo > implGetHierarchicalPropertySetI
// XPropertySet
//-----------------------------------------------------------------------------------
-void implSetPropertyValue( NodeGroupAccess& rNode, const OUString& sPropertyName, const Any& aValue )
+void implSetPropertyValue( NodeGroupAccess& rNode, const rtl::OUString& sPropertyName, const uno::Any& aValue )
throw(beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException,
- lang::WrappedTargetException, RuntimeException)
+ lang::WrappedTargetException, uno::RuntimeException)
{
try
{
- GuardedGroupUpdateAccess lock( rNode );
+ GuardedNodeUpdate<NodeGroupAccess> lock( rNode );
- Tree const aTree( lock.getTree() );
- NodeRef const aNode( lock.getNode() );
+ rtl::Reference< configuration::Tree > const aTree( lock.getTree() );
+ configuration::NodeRef const aNode( lock.getNode() );
- Name aChildName = validateChildName(sPropertyName,aTree,aNode);
+ rtl::OUString aChildName = configuration::validateChildName(sPropertyName,aTree,aNode);
- ValueRef aChild( aTree.getChildValue(aNode, aChildName) );
+ configuration::ValueRef aChild( aTree->getChildValue(aNode, aChildName) );
if (!aChild.isValid())
{
if ( configuration::hasChildOrElement(aTree, aNode, aChildName) )
{
- OSL_ENSURE(aTree.hasChildNode(aNode, aChildName),"ERROR: Configuration: Existing Property not found by implementation");
+ OSL_ENSURE(aTree->hasChildNode(aNode, aChildName),"ERROR: Configuration: Existing Property not found by implementation");
- OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Configuration - Cannot set Property Value.") );
- sMessage += OUString( RTL_CONSTASCII_USTRINGPARAM(" Property '") );
+ rtl::OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Configuration - Cannot set Property Value.") );
+ sMessage += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(" Property '") );
sMessage += sPropertyName;
- sMessage += OUString( RTL_CONSTASCII_USTRINGPARAM("' is not a simple value.") );
+ sMessage += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("' is not a simple value.") );
- Reference<uno::XInterface> xContext( rNode.getUnoInstance() );
- throw PropertyVetoException( sMessage, xContext );
+ uno::Reference<uno::XInterface> xContext( rNode.getUnoInstance() );
+ throw beans::PropertyVetoException( sMessage, xContext );
}
else
{
- OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Configuration - Cannot set Property Value.") );
- sMessage += OUString( RTL_CONSTASCII_USTRINGPARAM(" Property '") );
+ rtl::OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Configuration - Cannot set Property Value.") );
+ sMessage += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(" Property '") );
sMessage += sPropertyName;
- sMessage += OUString( RTL_CONSTASCII_USTRINGPARAM("' not found in ") );
- sMessage += aTree.getAbsolutePath(aNode).toString();
+ sMessage += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("' not found in ") );
+ sMessage += aTree->getAbsolutePath(aNode).toString();
- Reference<uno::XInterface> xContext( rNode.getUnoInstance() );
- throw UnknownPropertyException( sMessage, xContext );
+ uno::Reference<uno::XInterface> xContext( rNode.getUnoInstance() );
+ throw beans::UnknownPropertyException( sMessage, xContext );
}
}
- NodeChange aChange = lock.getNodeUpdater().validateSetValue( aChild, aValue );
+ configuration::NodeChange aChange = lock.getNodeUpdater().validateSetValue( aChild, aValue );
if (aChange.test().isChange())
{
Broadcaster aSender(rNode.getNotifier().makeBroadcaster(aChange,true));
aSender.queryConstraints(aChange);
- aTree.integrate(aChange, aNode, true);
+ aTree->integrate(aChange, aNode, true);
lock.clearForBroadcast();
aSender.notifyListeners(aChange);
@@ -360,9 +331,9 @@ void implSetPropertyValue( NodeGroupAccess& rNode, const OUString& sPropertyName
catch (configuration::InvalidName& ex)
{
ExceptionMapper e(ex);
- OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Configuration - Cannot set Property Value: ") );
- Reference<uno::XInterface> xContext( rNode.getUnoInstance() );
- throw UnknownPropertyException( sMessage += e.message(), xContext );
+ rtl::OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Configuration - Cannot set Property Value: ") );
+ uno::Reference<uno::XInterface> xContext( rNode.getUnoInstance() );
+ throw beans::UnknownPropertyException( sMessage += e.message(), xContext );
}
catch (configuration::TypeMismatch& ex)
{
@@ -373,9 +344,9 @@ void implSetPropertyValue( NodeGroupAccess& rNode, const OUString& sPropertyName
catch (configuration::ConstraintViolation& ex)
{
ExceptionMapper e(ex);
- OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Configuration - Cannot set Property Value: ") );
- Reference<uno::XInterface> xContext( rNode.getUnoInstance() );
- throw PropertyVetoException( sMessage += e.message(), xContext );
+ rtl::OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Configuration - Cannot set Property Value: ") );
+ uno::Reference<uno::XInterface> xContext( rNode.getUnoInstance() );
+ throw beans::PropertyVetoException( sMessage += e.message(), xContext );
}
catch (configuration::Exception& ex)
{
@@ -387,44 +358,44 @@ void implSetPropertyValue( NodeGroupAccess& rNode, const OUString& sPropertyName
// XMultiPropertySet
//-----------------------------------------------------------------------------------
-void implSetPropertyValues( NodeGroupAccess& rNode, const Sequence< OUString >& aPropertyNames, const Sequence< Any >& aValues )
+void implSetPropertyValues( NodeGroupAccess& rNode, const uno::Sequence< rtl::OUString >& aPropertyNames, const uno::Sequence< uno::Any >& aValues )
throw(beans::PropertyVetoException, lang::IllegalArgumentException,
- lang::WrappedTargetException, RuntimeException)
+ lang::WrappedTargetException, uno::RuntimeException)
{
try
{
- GuardedGroupUpdateAccess lock( rNode );
+ GuardedNodeUpdate<NodeGroupAccess> lock( rNode );
- Tree const aTree( lock.getTree() );
- NodeRef const aNode( lock.getNode() );
+ rtl::Reference< configuration::Tree > const aTree( lock.getTree() );
+ configuration::NodeRef const aNode( lock.getNode() );
- NodeChanges aChanges;
+ configuration::NodeChanges aChanges;
for(sal_Int32 i = 0, count= aValues.getLength(); i < count; ++i)
{
- Name aChildName = configuration::makeNodeName( aPropertyNames[i], Name::NoValidate() ); // not validated
+ rtl::OUString aChildName( aPropertyNames[i] ); // not validated
- ValueRef aChild( aTree.getChildValue(aNode, aChildName) );
+ configuration::ValueRef aChild( aTree->getChildValue(aNode, aChildName) );
if (!aChild.isValid())
{
if ( configuration::hasChildOrElement(aTree, aNode, aChildName) )
{
- OSL_ENSURE(aTree.hasChildNode(aNode, aChildName),"ERROR: Configuration: Existing Property not found by implementation");
+ OSL_ENSURE(aTree->hasChildNode(aNode, aChildName),"ERROR: Configuration: Existing Property not found by implementation");
- OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Configuration - Cannot set Property Values.") );
- sMessage += OUString( RTL_CONSTASCII_USTRINGPARAM(" Property '") );
- sMessage += aChildName.toString();
- sMessage += OUString( RTL_CONSTASCII_USTRINGPARAM("' is not a simple value.") );
+ rtl::OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Configuration - Cannot set Property Values.") );
+ sMessage += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(" Property '") );
+ sMessage += aChildName;
+ sMessage += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("' is not a simple value.") );
- Reference<uno::XInterface> xContext( rNode.getUnoInstance() );
- throw PropertyVetoException( sMessage, xContext );
+ uno::Reference<uno::XInterface> xContext( rNode.getUnoInstance() );
+ throw beans::PropertyVetoException( sMessage, xContext );
}
OSL_TRACE("Configuration: MultiPropertySet: trying to set unknown property - ignored");
continue;
}
- NodeChange aChange = lock.getNodeUpdater().validateSetValue( aChild, aValues[i] );
+ configuration::NodeChange aChange = lock.getNodeUpdater().validateSetValue( aChild, aValues[i] );
if (aChange.maybeChange())
{
aChanges.add(aChange);
@@ -437,7 +408,7 @@ void implSetPropertyValues( NodeGroupAccess& rNode, const Sequence< OUString >&
aSender.queryConstraints(aChanges);
- aTree.integrate(aChanges, aNode, true);
+ aTree->integrate(aChanges, aNode, true);
lock.clearForBroadcast();
aSender.notifyListeners(aChanges, true);
@@ -452,9 +423,9 @@ void implSetPropertyValues( NodeGroupAccess& rNode, const Sequence< OUString >&
catch (configuration::ConstraintViolation& ex)
{
ExceptionMapper e(ex);
- OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Configuration - Cannot set Property Value: ") );
- Reference<uno::XInterface> xContext( rNode.getUnoInstance() );
- throw PropertyVetoException( sMessage += e.message(), xContext );
+ rtl::OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Configuration - Cannot set Property Value: ") );
+ uno::Reference<uno::XInterface> xContext( rNode.getUnoInstance() );
+ throw beans::PropertyVetoException( sMessage += e.message(), xContext );
}
catch (configuration::Exception& ex)
{
@@ -466,53 +437,50 @@ void implSetPropertyValues( NodeGroupAccess& rNode, const Sequence< OUString >&
// XHierarchicalPropertySet
//-----------------------------------------------------------------------------------
-void implSetHierarchicalPropertyValue( NodeGroupAccess& rNode, const OUString& aPropertyName, const Any& aValue )
+void implSetHierarchicalPropertyValue( NodeGroupAccess& rNode, const rtl::OUString& aPropertyName, const uno::Any& aValue )
throw(beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException,
- lang::WrappedTargetException, RuntimeException)
+ lang::WrappedTargetException, uno::RuntimeException)
{
- using configuration::validateRelativePath; // should actually be found by "Koenig" lookup, but MSVC6 fails
- using configuration::getLocalDescendant; // should actually be found by "Koenig" lookup, but MSVC6 fails
-
try
{
- GuardedGroupUpdateAccess lock( rNode );
+ GuardedNodeUpdate<NodeGroupAccess> lock( rNode );
- Tree const aTree( lock.getTree() );
- NodeRef const aNode( lock.getNode() );
+ rtl::Reference< configuration::Tree > const aTree( lock.getTree() );
+ configuration::NodeRef const aNode( lock.getNode() );
- RelativePath const aRelPath = validateRelativePath( aPropertyName, aTree, aNode );
+ configuration::RelativePath const aRelPath = configuration::validateRelativePath( aPropertyName, aTree, aNode );
- AnyNodeRef aNestedValue = getLocalDescendant( aTree, aNode, aRelPath );
+ configuration::AnyNodeRef aNestedValue = configuration::getLocalDescendant( aTree, aNode, aRelPath );
if (!aNestedValue.isValid())
{
- OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Configuration - Cannot set Property Value. Property '") );
+ rtl::OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Configuration - Cannot set Property Value. Property '") );
sMessage += aRelPath.toString();
- sMessage += OUString( RTL_CONSTASCII_USTRINGPARAM("' was not found in ") );
- sMessage += aTree.getAbsolutePath(aNode).toString();
+ sMessage += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("' was not found in ") );
+ sMessage += aTree->getAbsolutePath(aNode).toString();
- Reference<uno::XInterface> xContext( rNode.getUnoInstance() );
- throw UnknownPropertyException( sMessage, xContext );
+ uno::Reference<uno::XInterface> xContext( rNode.getUnoInstance() );
+ throw beans::UnknownPropertyException( sMessage, xContext );
}
if (aNestedValue.isNode())
{
- OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Configuration - Cannot set Property Value. Property '") );
+ rtl::OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Configuration - Cannot set Property Value. Property '") );
sMessage += aRelPath.toString();
- sMessage += OUString( RTL_CONSTASCII_USTRINGPARAM("' is not a simple value property.") );
+ sMessage += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("' is not a simple value property.") );
- Reference<uno::XInterface> xContext( rNode.getUnoInstance() );
- throw PropertyVetoException( sMessage, xContext );
+ uno::Reference<uno::XInterface> xContext( rNode.getUnoInstance() );
+ throw beans::PropertyVetoException( sMessage, xContext );
}
OSL_ASSERT(aNode.isValid());
- NodeChange aChange = lock.getNodeUpdater().validateSetValue( aNestedValue.toValue(), aValue );
+ configuration::NodeChange aChange = lock.getNodeUpdater().validateSetValue( aNestedValue.toValue(), aValue );
if (aChange.test().isChange())
{
Broadcaster aSender(rNode.getNotifier().makeBroadcaster(aChange,false));
aSender.queryConstraints(aChange);
- aTree.integrate(aChange, aNode, false);
+ aTree->integrate(aChange, aNode, false);
lock.clearForBroadcast();
aSender.notifyListeners(aChange);
@@ -521,9 +489,9 @@ void implSetHierarchicalPropertyValue( NodeGroupAccess& rNode, const OUString& a
catch (configuration::InvalidName& ex)
{
ExceptionMapper e(ex);
- OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Configuration - Cannot set Property Value: ") );
- Reference<uno::XInterface> xContext( rNode.getUnoInstance() );
- throw UnknownPropertyException( e.message(), xContext );
+ rtl::OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Configuration - Cannot set Property Value: ") );
+ uno::Reference<uno::XInterface> xContext( rNode.getUnoInstance() );
+ throw beans::UnknownPropertyException( e.message(), xContext );
}
catch (configuration::TypeMismatch& ex)
{
@@ -534,9 +502,9 @@ void implSetHierarchicalPropertyValue( NodeGroupAccess& rNode, const OUString& a
catch (configuration::ConstraintViolation& ex)
{
ExceptionMapper e(ex);
- OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Configuration - Cannot set Property Value: ") );
- Reference<uno::XInterface> xContext( rNode.getUnoInstance() );
- throw PropertyVetoException( sMessage += e.message(), xContext );
+ rtl::OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Configuration - Cannot set Property Value: ") );
+ uno::Reference<uno::XInterface> xContext( rNode.getUnoInstance() );
+ throw beans::PropertyVetoException( sMessage += e.message(), xContext );
}
catch (configuration::Exception& ex)
{
@@ -548,27 +516,24 @@ void implSetHierarchicalPropertyValue( NodeGroupAccess& rNode, const OUString& a
// XMultiHierarchicalPropertySet
//-----------------------------------------------------------------------------------
-void implSetHierarchicalPropertyValues( NodeGroupAccess& rNode, const Sequence< OUString >& aPropertyNames, const Sequence< Any >& aValues )
+void implSetHierarchicalPropertyValues( NodeGroupAccess& rNode, const uno::Sequence< rtl::OUString >& aPropertyNames, const uno::Sequence< uno::Any >& aValues )
throw(beans::PropertyVetoException, lang::IllegalArgumentException,
- lang::WrappedTargetException, RuntimeException)
+ lang::WrappedTargetException, uno::RuntimeException)
{
- using configuration::validateRelativePath; // should actually be found by "Koenig" lookup, but MSVC6 fails
- using configuration::getLocalDescendant; // should actually be found by "Koenig" lookup, but MSVC6 fails
-
try
{
- GuardedGroupUpdateAccess lock( rNode );
+ GuardedNodeUpdate<NodeGroupAccess> lock( rNode );
- Tree const aTree( lock.getTree() );
- NodeRef const aNode( lock.getNode() );
+ rtl::Reference< configuration::Tree > const aTree( lock.getTree() );
+ configuration::NodeRef const aNode( lock.getNode() );
- NodeChanges aChanges;
+ configuration::NodeChanges aChanges;
for(sal_Int32 i = 0, count= aValues.getLength(); i < count; ++i)
try
{
- RelativePath aRelPath = validateRelativePath( aPropertyNames[i], aTree, aNode );
+ configuration::RelativePath aRelPath = configuration::validateRelativePath( aPropertyNames[i], aTree, aNode );
- AnyNodeRef aNestedValue = getLocalDescendant( aTree, aNode, aRelPath );
+ configuration::AnyNodeRef aNestedValue = configuration::getLocalDescendant( aTree, aNode, aRelPath );
if (!aNestedValue.isValid())
{
@@ -577,17 +542,17 @@ void implSetHierarchicalPropertyValues( NodeGroupAccess& rNode, const Sequence<
}
if ( aNestedValue.isNode() )
{
- OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Configuration - Cannot set Property Values.") );
- sMessage += OUString( RTL_CONSTASCII_USTRINGPARAM(" Property '") );
+ rtl::OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Configuration - Cannot set Property Values.") );
+ sMessage += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(" Property '") );
sMessage += aRelPath.toString();
- sMessage += OUString( RTL_CONSTASCII_USTRINGPARAM("' is not a simple value property.") );
+ sMessage += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("' is not a simple value property.") );
- Reference<uno::XInterface> xContext( rNode.getUnoInstance() );
- throw PropertyVetoException( sMessage, xContext );
+ uno::Reference<uno::XInterface> xContext( rNode.getUnoInstance() );
+ throw beans::PropertyVetoException( sMessage, xContext );
}
OSL_ASSERT(aNode.isValid());
- NodeChange aChange = lock.getNodeUpdater().validateSetValue( aNestedValue.toValue(), aValues[i] );
+ configuration::NodeChange aChange = lock.getNodeUpdater().validateSetValue( aNestedValue.toValue(), aValues[i] );
if (aChange.maybeChange())
{
aChanges.add(aChange);
@@ -605,7 +570,7 @@ void implSetHierarchicalPropertyValues( NodeGroupAccess& rNode, const Sequence<
aSender.queryConstraints(aChanges);
- aTree.integrate(aChanges, aNode, false);
+ aTree->integrate(aChanges, aNode, false);
lock.clearForBroadcast();
aSender.notifyListeners(aChanges, true); // if we use 'false' we don't need 'Deep' change objects
@@ -620,9 +585,9 @@ void implSetHierarchicalPropertyValues( NodeGroupAccess& rNode, const Sequence<
catch (configuration::ConstraintViolation& ex)
{
ExceptionMapper e(ex);
- OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Configuration - Cannot set Property Value: ") );
- Reference<uno::XInterface> xContext( rNode.getUnoInstance() );
- throw PropertyVetoException( sMessage += e.message(), xContext );
+ rtl::OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Configuration - Cannot set Property Value: ") );
+ uno::Reference<uno::XInterface> xContext( rNode.getUnoInstance() );
+ throw beans::PropertyVetoException( sMessage += e.message(), xContext );
}
catch (configuration::Exception& ex)
{
@@ -638,31 +603,31 @@ void implSetHierarchicalPropertyValues( NodeGroupAccess& rNode, const Sequence<
// XPropertySet
//-----------------------------------------------------------------------------------
-Any implGetPropertyValue( NodeGroupInfoAccess& rNode,const OUString& aPropertyName )
- throw(beans::UnknownPropertyException, lang::WrappedTargetException, RuntimeException)
+uno::Any implGetPropertyValue( NodeGroupInfoAccess& rNode,const rtl::OUString& aPropertyName )
+ throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
{
try
{
- GuardedNodeDataAccess lock( rNode );
+ GuardedNodeData<NodeAccess> lock( rNode );
- Tree const aTree( lock.getTree() );
- NodeRef const aNode( lock.getNode() );
+ rtl::Reference< configuration::Tree > const aTree( lock.getTree() );
+ configuration::NodeRef const aNode( lock.getNode() );
- Name aChildName = validateChildName(aPropertyName,aTree,aNode);
+ rtl::OUString aChildName = configuration::validateChildName(aPropertyName,aTree,aNode);
- AnyNodeRef aChild( aTree.getAnyChild(aNode, aChildName) );
+ configuration::AnyNodeRef aChild( aTree->getAnyChild(aNode, aChildName) );
if (!aChild.isValid())
{
OSL_ENSURE(!configuration::hasChildOrElement(aTree,aNode,aChildName),"ERROR: Configuration: Existing Property not found by implementation");
- OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Configuration - Cannot get Property Value. Property '") );
+ rtl::OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Configuration - Cannot get Property Value. Property '") );
sMessage += aPropertyName;
- sMessage += OUString( RTL_CONSTASCII_USTRINGPARAM("' could not be found in ") );
- sMessage += aTree.getAbsolutePath(aNode).toString();
+ sMessage += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("' could not be found in ") );
+ sMessage += aTree->getAbsolutePath(aNode).toString();
- Reference<uno::XInterface> xContext( rNode.getUnoInstance() );
- throw UnknownPropertyException( sMessage, xContext );
+ uno::Reference<uno::XInterface> xContext( rNode.getUnoInstance() );
+ throw beans::UnknownPropertyException( sMessage, xContext );
}
return configapi::makeElement( rNode.getFactory(), aTree, aChild );
@@ -670,8 +635,8 @@ Any implGetPropertyValue( NodeGroupInfoAccess& rNode,const OUString& aPropertyNa
catch (configuration::InvalidName& ex)
{
ExceptionMapper e(ex);
- Reference<uno::XInterface> xContext( rNode.getUnoInstance() );
- throw UnknownPropertyException( e.message(), xContext );
+ uno::Reference<uno::XInterface> xContext( rNode.getUnoInstance() );
+ throw beans::UnknownPropertyException( e.message(), xContext );
}
catch (configuration::Exception& ex)
{
@@ -682,29 +647,29 @@ Any implGetPropertyValue( NodeGroupInfoAccess& rNode,const OUString& aPropertyNa
// unreachable, but still there to make some compilers happy
OSL_ASSERT(!"Unreachable code");
- return Any();
+ return uno::Any();
}
// XMultiPropertySet
//-----------------------------------------------------------------------------------
-Sequence< Any > implGetPropertyValues( NodeGroupInfoAccess& rNode, const Sequence< OUString >& aPropertyNames )
- throw(RuntimeException)
+uno::Sequence< uno::Any > implGetPropertyValues( NodeGroupInfoAccess& rNode, const uno::Sequence< rtl::OUString >& aPropertyNames )
+ throw(uno::RuntimeException)
{
sal_Int32 const count = aPropertyNames.getLength();
- Sequence<Any> aRet(count);
+ uno::Sequence<uno::Any> aRet(count);
try
{
- GuardedNodeDataAccess lock( rNode );
+ GuardedNodeData<NodeAccess> lock( rNode );
- Tree const aTree( lock.getTree() );
- NodeRef const aNode( lock.getNode() );
+ rtl::Reference< configuration::Tree > const aTree( lock.getTree() );
+ configuration::NodeRef const aNode( lock.getNode() );
for(sal_Int32 i = 0; i < count; ++i)
{
- Name aChildName = configuration::makeNodeName( aPropertyNames[i], Name::NoValidate() ); // not validated
+ rtl::OUString aChildName( aPropertyNames[i] ); // not validated
- AnyNodeRef aChild( aTree.getAnyChild(aNode, aChildName) );
+ configuration::AnyNodeRef aChild( aTree->getAnyChild(aNode, aChildName) );
if (aChild.isValid())
{
@@ -729,31 +694,29 @@ Sequence< Any > implGetPropertyValues( NodeGroupInfoAccess& rNode, const Sequenc
// XHierarchicalPropertySet
//-----------------------------------------------------------------------------------
-Any implGetHierarchicalPropertyValue( NodeGroupInfoAccess& rNode, const OUString& aPropertyName )
- throw(beans::UnknownPropertyException, lang::WrappedTargetException, RuntimeException)
+uno::Any implGetHierarchicalPropertyValue( NodeGroupInfoAccess& rNode, const rtl::OUString& aPropertyName )
+ throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
{
- using configuration::validateRelativePath; // should actually be found by "Koenig" lookup, but MSVC6 fails
- using configuration::getLocalDescendant; // should actually be found by "Koenig" lookup, but MSVC6 fails
try
{
- GuardedNodeDataAccess lock( rNode );
+ GuardedNodeData<NodeAccess> lock( rNode );
- Tree const aTree( lock.getTree() );
- NodeRef const aNode( lock.getNode() );
+ rtl::Reference< configuration::Tree > const aTree( lock.getTree() );
+ configuration::NodeRef const aNode( lock.getNode() );
- RelativePath aRelPath = validateRelativePath( aPropertyName, aTree, aNode );
+ configuration::RelativePath aRelPath = configuration::validateRelativePath( aPropertyName, aTree, aNode );
- AnyNodeRef aNestedNode = getLocalDescendant( aTree, aNode, aRelPath );
+ configuration::AnyNodeRef aNestedNode = configuration::getLocalDescendant( aTree, aNode, aRelPath );
if (!aNestedNode.isValid())
{
- OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Configuration - Cannot get Property Value. Property '") );
+ rtl::OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Configuration - Cannot get Property Value. Property '") );
sMessage += aRelPath.toString();
- sMessage += OUString( RTL_CONSTASCII_USTRINGPARAM("' could not be found in ") );
- sMessage += aTree.getAbsolutePath(aNode).toString();
+ sMessage += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("' could not be found in ") );
+ sMessage += aTree->getAbsolutePath(aNode).toString();
- Reference<uno::XInterface> xContext( rNode.getUnoInstance() );
- throw UnknownPropertyException( sMessage, xContext );
+ uno::Reference<uno::XInterface> xContext( rNode.getUnoInstance() );
+ throw beans::UnknownPropertyException( sMessage, xContext );
}
OSL_ASSERT(aNode.isValid());
@@ -762,8 +725,8 @@ Any implGetHierarchicalPropertyValue( NodeGroupInfoAccess& rNode, const OUString
catch (configuration::InvalidName& ex)
{
ExceptionMapper e(ex);
- Reference<uno::XInterface> xContext( rNode.getUnoInstance() );
- throw UnknownPropertyException( e.message(), xContext );
+ uno::Reference<uno::XInterface> xContext( rNode.getUnoInstance() );
+ throw beans::UnknownPropertyException( e.message(), xContext );
}
catch (configuration::Exception& ex)
{
@@ -774,33 +737,30 @@ Any implGetHierarchicalPropertyValue( NodeGroupInfoAccess& rNode, const OUString
// unreachable, but still there to make some compilers happy
OSL_ASSERT(!"Unreachable code");
- return Any();
+ return uno::Any();
}
// XMultiHierarchicalPropertySet
//-----------------------------------------------------------------------------------
-Sequence< Any > implGetHierarchicalPropertyValues( NodeGroupInfoAccess& rNode, const Sequence< OUString >& aPropertyNames )
- throw(RuntimeException)
+uno::Sequence< uno::Any > implGetHierarchicalPropertyValues( NodeGroupInfoAccess& rNode, const uno::Sequence< rtl::OUString >& aPropertyNames )
+ throw(uno::RuntimeException)
{
- using configuration::validateRelativePath; // should actually be found by "Koenig" lookup, but MSVC6 fails
- using configuration::getLocalDescendant; // should actually be found by "Koenig" lookup, but MSVC6 fails
-
sal_Int32 const count = aPropertyNames.getLength();
- Sequence<Any> aRet(count);
+ uno::Sequence<uno::Any> aRet(count);
try
{
- GuardedNodeDataAccess lock( rNode );
+ GuardedNodeData<NodeAccess> lock( rNode );
- Tree const aTree( lock.getTree() );
- NodeRef const aNode( lock.getNode() );
+ rtl::Reference< configuration::Tree > const aTree( lock.getTree() );
+ configuration::NodeRef const aNode( lock.getNode() );
for(sal_Int32 i = 0; i < count; ++i)
try
{
- RelativePath aRelPath = validateRelativePath( aPropertyNames[i], aTree, aNode );
+ configuration::RelativePath aRelPath = configuration::validateRelativePath( aPropertyNames[i], aTree, aNode );
- AnyNodeRef aNestedValue = getLocalDescendant( aTree, aNode, aRelPath );
+ configuration::AnyNodeRef aNestedValue = configuration::getLocalDescendant( aTree, aNode, aRelPath );
if (aNestedValue.isValid())
{
@@ -831,8 +791,8 @@ Sequence< Any > implGetHierarchicalPropertyValues( NodeGroupInfoAccess& rNode, c
// SPECIAL: XMultiPropertySet::firePropertiesChangeEvent
//------------------------------------------------------------------------------------------------------------------
-void implFirePropertiesChangeEvent( NodeGroupInfoAccess& rNode, const Sequence< OUString >& aPropertyNames, const Reference< beans::XPropertiesChangeListener >& xListener )
- throw(RuntimeException)
+void implFirePropertiesChangeEvent( NodeGroupInfoAccess& rNode, const uno::Sequence< rtl::OUString >& aPropertyNames, const uno::Reference< beans::XPropertiesChangeListener >& xListener )
+ throw(uno::RuntimeException)
{
OSL_ENSURE(xListener.is(), "ERROR: requesting to fire Events to a NULL listener.");
if (!xListener.is())
@@ -841,28 +801,28 @@ void implFirePropertiesChangeEvent( NodeGroupInfoAccess& rNode, const Sequence<
}
sal_Int32 const count = aPropertyNames.getLength();
- Sequence<beans::PropertyChangeEvent> aEvents(count);
+ uno::Sequence<beans::PropertyChangeEvent> aEvents(count);
try
{
- GuardedNodeDataAccess lock( rNode );
+ GuardedNodeData<NodeAccess> lock( rNode );
- Tree const aTree( lock.getTree() );
- NodeRef const aNode( lock.getNode() );
+ rtl::Reference< configuration::Tree > const aTree( lock.getTree() );
+ configuration::NodeRef const aNode( lock.getNode() );
configapi::Factory& rFactory = rNode.getFactory();
sal_Int32 nFire = 0;
for(sal_Int32 i = 0; i < count; ++i)
{
- Name aChildName = configuration::makeNodeName( aPropertyNames[i], Name::NoValidate() ); // not validated
+ rtl::OUString aChildName( aPropertyNames[i] ); // not validated
- AnyNodeRef aChild( aTree.getAnyChild(aNode, aChildName) );
+ configuration::AnyNodeRef aChild( aTree->getAnyChild(aNode, aChildName) );
if (aChild.isValid())
{
aEvents[nFire].Source = rNode.getUnoInstance();
- aEvents[nFire].PropertyName = aChildName.toString();
+ aEvents[nFire].PropertyName = aChildName;
aEvents[nFire].PropertyHandle = -1;
aEvents[nFire].NewValue = aEvents[nFire].OldValue = configapi::makeElement( rFactory, aTree, aChild );
@@ -891,42 +851,40 @@ void implFirePropertiesChangeEvent( NodeGroupInfoAccess& rNode, const Sequence<
// XPropertyState
//------------------------------------------------------------------------------------------------------------------
-beans::PropertyState implGetPropertyState( NodeAccess& rNode, const OUString& sPropertyName )
- throw(beans::UnknownPropertyException, RuntimeException)
+beans::PropertyState implGetPropertyState( NodeAccess& rNode, const rtl::OUString& sPropertyName )
+ throw(beans::UnknownPropertyException, uno::RuntimeException)
{
try
{
- using configuration::getChildOrElement;
+ GuardedNodeData<NodeAccess> lock( rNode );
- GuardedNodeDataAccess lock( rNode );
+ rtl::Reference< configuration::Tree > aTree( lock.getTree() );
+ configuration::NodeRef const aNode( lock.getNode() );
- Tree aTree( lock.getTree() );
- NodeRef const aNode( lock.getNode() );
+ rtl::OUString aChildName = configuration::validateChildOrElementName(sPropertyName,aTree,aNode);
- Name aChildName = validateChildOrElementName(sPropertyName,aTree,aNode);
-
- AnyNodeRef aChild = getChildOrElement(aTree,aNode,aChildName);
+ configuration::AnyNodeRef aChild = configuration::getChildOrElement(aTree,aNode,aChildName);
if (!aChild.isValid())
{
- OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Configuration - Cannot get PropertyState. Property '") );
+ rtl::OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Configuration - Cannot get PropertyState. Property '") );
sMessage += sPropertyName;
- sMessage += OUString( RTL_CONSTASCII_USTRINGPARAM("' not found in ") );
- sMessage += aTree.getAbsolutePath(aNode).toString();
+ sMessage += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("' not found in ") );
+ sMessage += aTree->getAbsolutePath(aNode).toString();
- Reference<uno::XInterface> xContext( rNode.getUnoInstance() );
- throw UnknownPropertyException( sMessage, xContext );
+ uno::Reference<uno::XInterface> xContext( rNode.getUnoInstance() );
+ throw beans::UnknownPropertyException( sMessage, xContext );
}
OSL_ASSERT(aNode.isValid());
- return aTree.isNodeDefault(aChild) ? beans::PropertyState_DEFAULT_VALUE :
+ return aTree->isNodeDefault(aChild) ? beans::PropertyState_DEFAULT_VALUE :
aChild.isNode() ? beans::PropertyState_AMBIGUOUS_VALUE :
beans::PropertyState_DIRECT_VALUE;
}
catch (configuration::InvalidName& ex)
{
ExceptionMapper e(ex);
- Reference<uno::XInterface> xContext( rNode.getUnoInstance() );
- throw UnknownPropertyException( e.message(), xContext );
+ uno::Reference<uno::XInterface> xContext( rNode.getUnoInstance() );
+ throw beans::UnknownPropertyException( e.message(), xContext );
}
catch (configuration::Exception& ex)
{
@@ -941,41 +899,39 @@ beans::PropertyState implGetPropertyState( NodeAccess& rNode, const OUString& sP
}
//-----------------------------------------------------------------------------------
-Sequence< beans::PropertyState > implGetPropertyStates( NodeAccess& rNode, const Sequence< OUString >& aPropertyNames )
- throw(beans::UnknownPropertyException, RuntimeException)
+uno::Sequence< beans::PropertyState > implGetPropertyStates( NodeAccess& rNode, const uno::Sequence< rtl::OUString >& aPropertyNames )
+ throw(beans::UnknownPropertyException, uno::RuntimeException)
{
sal_Int32 const count = aPropertyNames.getLength();
- Sequence<beans::PropertyState> aRet(count);
+ uno::Sequence<beans::PropertyState> aRet(count);
try
{
- GuardedNodeDataAccess lock( rNode );
+ GuardedNodeData<NodeAccess> lock( rNode );
- Tree const aTree( lock.getTree() );
- NodeRef const aNode( lock.getNode() );
+ rtl::Reference< configuration::Tree > const aTree( lock.getTree() );
+ configuration::NodeRef const aNode( lock.getNode() );
for(sal_Int32 i = 0; i < count; ++i)
{
- using configuration::getChildOrElement;
-
- Name aChildName = validateChildOrElementName(aPropertyNames[i],aTree,aNode);
+ rtl::OUString aChildName = configuration::validateChildOrElementName(aPropertyNames[i],aTree,aNode);
- Tree aChildTree( aTree);
+ rtl::Reference< configuration::Tree > aChildTree( aTree);
- AnyNodeRef aChildNode = getChildOrElement(aChildTree,aNode,aChildName);
+ configuration::AnyNodeRef aChildNode = configuration::getChildOrElement(aChildTree,aNode,aChildName);
if (!aChildNode.isValid())
{
- OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Configuration - Cannot get PropertyStates. Property '") );
+ rtl::OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Configuration - Cannot get PropertyStates. Property '") );
sMessage += aPropertyNames[i];
- sMessage += OUString( RTL_CONSTASCII_USTRINGPARAM("' could not be found in ") );
- sMessage += aTree.getAbsolutePath(aNode).toString();
+ sMessage += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("' could not be found in ") );
+ sMessage += aTree->getAbsolutePath(aNode).toString();
- Reference<uno::XInterface> xContext( rNode.getUnoInstance() );
- throw UnknownPropertyException( sMessage, xContext );
+ uno::Reference<uno::XInterface> xContext( rNode.getUnoInstance() );
+ throw beans::UnknownPropertyException( sMessage, xContext );
}
OSL_ASSERT(aChildNode.isValid());
- aRet[i] = aChildTree.isNodeDefault(aChildNode) ? beans::PropertyState_DEFAULT_VALUE :
+ aRet[i] = aChildTree->isNodeDefault(aChildNode) ? beans::PropertyState_DEFAULT_VALUE :
aChildNode.isNode() ? beans::PropertyState_AMBIGUOUS_VALUE :
beans::PropertyState_DIRECT_VALUE;
}
@@ -984,8 +940,8 @@ Sequence< beans::PropertyState > implGetPropertyStates( NodeAccess& rNode, const
catch (configuration::InvalidName& ex)
{
ExceptionMapper e(ex);
- Reference<uno::XInterface> xContext( rNode.getUnoInstance() );
- throw UnknownPropertyException( e.message(), xContext );
+ uno::Reference<uno::XInterface> xContext( rNode.getUnoInstance() );
+ throw beans::UnknownPropertyException( e.message(), xContext );
}
catch (configuration::Exception& ex)
{
@@ -998,7 +954,7 @@ Sequence< beans::PropertyState > implGetPropertyStates( NodeAccess& rNode, const
}
//-----------------------------------------------------------------------------------
-static inline NodeChange validateSetToDefaultHelper(configuration::GroupDefaulter& _rDefaulter, AnyNodeRef _aNode)
+static inline configuration::NodeChange validateSetToDefaultHelper(configuration::GroupDefaulter& _rDefaulter, configuration::AnyNodeRef _aNode)
{
if (!_aNode.isNode())
return _rDefaulter.validateSetToDefaultValue( _aNode.toValue() );
@@ -1007,24 +963,24 @@ static inline NodeChange validateSetToDefaultHelper(configuration::GroupDefaulte
return _rDefaulter.validateSetToDefaultState( _aNode.toNode() );
}
//-----------------------------------------------------------------------------------
-void implSetPropertyToDefault( NodeGroupAccess& rNode, const OUString& sPropertyName )
- throw(beans::UnknownPropertyException, RuntimeException)
+void implSetPropertyToDefault( NodeGroupAccess& rNode, const rtl::OUString& sPropertyName )
+ throw(beans::UnknownPropertyException, uno::RuntimeException)
{
try
{
UnoApiLock aWithDefaultLock;
- GuardedGroupUpdateAccess lock( withDefaultData( rNode ) );
+ GuardedNodeUpdate<NodeGroupAccess> lock( withDefaultData( rNode ) );
- Tree const aTree( lock.getTree() );
- NodeRef const aNode( lock.getNode() );
+ rtl::Reference< configuration::Tree > const aTree( lock.getTree() );
+ configuration::NodeRef const aNode( lock.getNode() );
configuration::GroupDefaulter aDefaulter = lock.getNodeDefaulter();
- Name aChildName = validateChildName(sPropertyName,aTree,aNode);
+ rtl::OUString aChildName = configuration::validateChildName(sPropertyName,aTree,aNode);
- AnyNodeRef aChild( aTree.getAnyChild(aNode, aChildName) );
+ configuration::AnyNodeRef aChild( aTree->getAnyChild(aNode, aChildName) );
- NodeChange aChange = validateSetToDefaultHelper( aDefaulter, aChild );
+ configuration::NodeChange aChange = validateSetToDefaultHelper( aDefaulter, aChild );
const bool bLocal = !aDefaulter.hasDoneSet();
@@ -1034,7 +990,7 @@ void implSetPropertyToDefault( NodeGroupAccess& rNode, const OUString& sProperty
aSender.queryConstraints(aChange);
- aTree.integrate(aChange, aNode, bLocal);
+ aTree->integrate(aChange, aNode, bLocal);
lock.clearForBroadcast();
aSender.notifyListeners(aChange);
@@ -1043,16 +999,16 @@ void implSetPropertyToDefault( NodeGroupAccess& rNode, const OUString& sProperty
catch (configuration::InvalidName& ex)
{
ExceptionMapper e(ex);
- OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Configuration - Cannot restore Default: ") );
- Reference<uno::XInterface> xContext( rNode.getUnoInstance() );
- throw UnknownPropertyException( sMessage += e.message(), xContext );
+ rtl::OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Configuration - Cannot restore Default: ") );
+ uno::Reference<uno::XInterface> xContext( rNode.getUnoInstance() );
+ throw beans::UnknownPropertyException( sMessage += e.message(), xContext );
}
catch (configuration::ConstraintViolation & ex)
{
ExceptionMapper e(ex);
- OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Configuration - Cannot restore Default: ") );
- Reference<uno::XInterface> xContext( rNode.getUnoInstance() );
- throw UnknownPropertyException( sMessage += e.message(), xContext );
+ rtl::OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Configuration - Cannot restore Default: ") );
+ uno::Reference<uno::XInterface> xContext( rNode.getUnoInstance() );
+ throw beans::UnknownPropertyException( sMessage += e.message(), xContext );
}
catch (configuration::Exception& ex)
{
@@ -1062,58 +1018,58 @@ void implSetPropertyToDefault( NodeGroupAccess& rNode, const OUString& sProperty
}
}
//-----------------------------------------------------------------------------------
-void implSetPropertiesToDefault( NodeGroupAccess& rNode, const Sequence< OUString >& aPropertyNames )
- throw(beans::UnknownPropertyException, RuntimeException)
+void implSetPropertiesToDefault( NodeGroupAccess& rNode, const uno::Sequence< rtl::OUString >& aPropertyNames )
+ throw(beans::UnknownPropertyException, uno::RuntimeException)
{
try
{
UnoApiLock aWithDefaultLock;
- GuardedGroupUpdateAccess lock( withDefaultData( rNode ) );
+ GuardedNodeUpdate<NodeGroupAccess> lock( withDefaultData( rNode ) );
- Tree const aTree( lock.getTree() );
- NodeRef const aNode( lock.getNode() );
+ rtl::Reference< configuration::Tree > const aTree( lock.getTree() );
+ configuration::NodeRef const aNode( lock.getNode() );
configuration::GroupDefaulter aDefaulter = lock.getNodeDefaulter();
- NodeChanges aChanges;
+ configuration::NodeChanges aChanges;
for(sal_Int32 i = 0, count= aPropertyNames.getLength(); i < count; ++i)
{
- Name aChildName = validateChildName( aPropertyNames[i], aTree, aNode ); // validated
+ rtl::OUString aChildName = configuration::validateChildName( aPropertyNames[i], aTree, aNode ); // validated
- AnyNodeRef aChild( aTree.getAnyChild(aNode, aChildName) );
+ configuration::AnyNodeRef aChild( aTree->getAnyChild(aNode, aChildName) );
if (!aChild.isValid())
{
OSL_ENSURE(!configuration::hasChildOrElement(aTree, aNode, aChildName),"ERROR: Configuration: Existing Property not found by implementation");
- OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Configuration - Cannot restore Default.") );
- sMessage += OUString( RTL_CONSTASCII_USTRINGPARAM(" Property '") );
- sMessage += aChildName.toString();
- sMessage += OUString( RTL_CONSTASCII_USTRINGPARAM("' not found in ") );
- sMessage += aTree.getAbsolutePath(aNode).toString();
+ rtl::OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Configuration - Cannot restore Default.") );
+ sMessage += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(" Property '") );
+ sMessage += aChildName;
+ sMessage += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("' not found in ") );
+ sMessage += aTree->getAbsolutePath(aNode).toString();
- Reference<uno::XInterface> xContext( rNode.getUnoInstance() );
- throw UnknownPropertyException( sMessage, xContext );
+ uno::Reference<uno::XInterface> xContext( rNode.getUnoInstance() );
+ throw beans::UnknownPropertyException( sMessage, xContext );
}
OSL_ASSERT(aNode.isValid());
- if (!aTree.hasNodeDefault(aChild))
+ if (!aTree->hasNodeDefault(aChild))
{
- OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Configuration - Cannot restore Default.") );
- sMessage += OUString( RTL_CONSTASCII_USTRINGPARAM(" Property '") );
- sMessage += aChildName.toString();
+ rtl::OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Configuration - Cannot restore Default.") );
+ sMessage += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(" Property '") );
+ sMessage += aChildName;
if (aChild.isNode())
- sMessage += OUString( RTL_CONSTASCII_USTRINGPARAM("' is not a simple value.") );
+ sMessage += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("' is not a simple value.") );
else
- sMessage += OUString( RTL_CONSTASCII_USTRINGPARAM("' does not have a default value.") );
+ sMessage += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("' does not have a default value.") );
- Reference<uno::XInterface> xContext( rNode.getUnoInstance() );
- throw UnknownPropertyException( sMessage, xContext );
+ uno::Reference<uno::XInterface> xContext( rNode.getUnoInstance() );
+ throw beans::UnknownPropertyException( sMessage, xContext );
}
- NodeChange aChildChange = validateSetToDefaultHelper(aDefaulter, aChild );
+ configuration::NodeChange aChildChange = validateSetToDefaultHelper(aDefaulter, aChild );
if (aChildChange.maybeChange())
aChanges.add(aChildChange);
}
@@ -1126,7 +1082,7 @@ void implSetPropertiesToDefault( NodeGroupAccess& rNode, const Sequence< OUStrin
aSender.queryConstraints(aChanges);
- aTree.integrate(aChanges, aNode, bLocal);
+ aTree->integrate(aChanges, aNode, bLocal);
lock.clearForBroadcast();
aSender.notifyListeners(aChanges, bLocal);
@@ -1136,16 +1092,16 @@ void implSetPropertiesToDefault( NodeGroupAccess& rNode, const Sequence< OUStrin
catch (configuration::InvalidName& ex)
{
ExceptionMapper e(ex);
- OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Configuration - Cannot restore Defaults: ") );
- Reference<uno::XInterface> xContext( rNode.getUnoInstance() );
- throw UnknownPropertyException( sMessage += e.message(), xContext );
+ rtl::OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Configuration - Cannot restore Defaults: ") );
+ uno::Reference<uno::XInterface> xContext( rNode.getUnoInstance() );
+ throw beans::UnknownPropertyException( sMessage += e.message(), xContext );
}
catch (configuration::ConstraintViolation & ex)
{
ExceptionMapper e(ex);
- OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Configuration - Cannot restore Defaults: ") );
- Reference<uno::XInterface> xContext( rNode.getUnoInstance() );
- throw UnknownPropertyException( sMessage += e.message(), xContext );
+ rtl::OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Configuration - Cannot restore Defaults: ") );
+ uno::Reference<uno::XInterface> xContext( rNode.getUnoInstance() );
+ throw beans::UnknownPropertyException( sMessage += e.message(), xContext );
}
catch (configuration::Exception& ex)
{
@@ -1157,19 +1113,19 @@ void implSetPropertiesToDefault( NodeGroupAccess& rNode, const Sequence< OUStrin
//-----------------------------------------------------------------------------------
void implSetAllPropertiesToDefault( NodeGroupAccess& rNode )
- throw(RuntimeException)
+ throw(uno::RuntimeException)
{
try
{
UnoApiLock aWithDefaultLock;
- GuardedGroupUpdateAccess lock( withDefaultData( rNode ) );
+ GuardedNodeUpdate<NodeGroupAccess> lock( withDefaultData( rNode ) );
- Tree const aTree( lock.getTree() );
- NodeRef const aNode( lock.getNode() );
+ rtl::Reference< configuration::Tree > const aTree( lock.getTree() );
+ configuration::NodeRef const aNode( lock.getNode() );
configuration::GroupDefaulter aDefaulter = lock.getNodeDefaulter();
- NodeChanges aChanges = aDefaulter.validateSetAllToDefault( );
+ configuration::NodeChanges aChanges = aDefaulter.validateSetAllToDefault( );
const bool bLocal = !aDefaulter.hasDoneSet();
@@ -1179,7 +1135,7 @@ void implSetAllPropertiesToDefault( NodeGroupAccess& rNode )
aSender.queryConstraints(aChanges);
- aTree.integrate(aChanges, aNode, bLocal);
+ aTree->integrate(aChanges, aNode, bLocal);
lock.clearForBroadcast();
aSender.notifyListeners(aChanges, bLocal);
@@ -1189,16 +1145,16 @@ void implSetAllPropertiesToDefault( NodeGroupAccess& rNode )
catch (configuration::InvalidName& ex)
{
ExceptionMapper e(ex);
- OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Configuration - Cannot restore Defaults: ") );
- Reference<uno::XInterface> xContext( rNode.getUnoInstance() );
- throw UnknownPropertyException( sMessage += e.message(), xContext );
+ rtl::OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Configuration - Cannot restore Defaults: ") );
+ uno::Reference<uno::XInterface> xContext( rNode.getUnoInstance() );
+ throw beans::UnknownPropertyException( sMessage += e.message(), xContext );
}
catch (configuration::ConstraintViolation & ex)
{
ExceptionMapper e(ex);
- OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Configuration - Cannot restore Defaults: ") );
- Reference<uno::XInterface> xContext( rNode.getUnoInstance() );
- throw UnknownPropertyException( sMessage += e.message(), xContext );
+ rtl::OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Configuration - Cannot restore Defaults: ") );
+ uno::Reference<uno::XInterface> xContext( rNode.getUnoInstance() );
+ throw beans::UnknownPropertyException( sMessage += e.message(), xContext );
}
catch (configuration::Exception& ex)
{
@@ -1209,49 +1165,49 @@ void implSetAllPropertiesToDefault( NodeGroupAccess& rNode )
}
//-----------------------------------------------------------------------------------
-Any implGetPropertyDefault( NodeGroupInfoAccess& rNode, const OUString& sPropertyName )
- throw(beans::UnknownPropertyException, lang::WrappedTargetException, RuntimeException)
+uno::Any implGetPropertyDefault( NodeGroupInfoAccess& rNode, const rtl::OUString& sPropertyName )
+ throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
{
- Any aDefault;
+ uno::Any aDefault;
try
{
- GuardedNodeDataAccess lock( rNode );
+ GuardedNodeData<NodeAccess> lock( rNode );
- Tree const aTree( lock.getTree() );
- NodeRef const aNode( lock.getNode() );
+ rtl::Reference< configuration::Tree > const aTree( lock.getTree() );
+ configuration::NodeRef const aNode( lock.getNode() );
- Name aChildName = validateChildName(sPropertyName,aTree,aNode);
+ rtl::OUString aChildName = configuration::validateChildName(sPropertyName,aTree,aNode);
- AnyNodeRef aChildNode = aTree.getAnyChild(aNode, aChildName);
+ configuration::AnyNodeRef aChildNode = aTree->getAnyChild(aNode, aChildName);
if (!aChildNode.isValid())
{
- OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Configuration - Cannot get Default. Property '") );
+ rtl::OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Configuration - Cannot get Default. Property '") );
sMessage += sPropertyName;
- sMessage += OUString( RTL_CONSTASCII_USTRINGPARAM("' not found in ") );
- sMessage += aTree.getAbsolutePath(aNode).toString();
+ sMessage += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("' not found in ") );
+ sMessage += aTree->getAbsolutePath(aNode).toString();
- Reference<uno::XInterface> xContext( rNode.getUnoInstance() );
- throw UnknownPropertyException( sMessage, xContext );
+ uno::Reference<uno::XInterface> xContext( rNode.getUnoInstance() );
+ throw beans::UnknownPropertyException( sMessage, xContext );
}
OSL_ASSERT(aNode.isValid());
if (!aChildNode.isNode())
{
- aDefault = aTree.getNodeDefaultValue(aChildNode.toValue());
+ aDefault = aTree->getNodeDefaultValue(aChildNode.toValue());
}
}
catch (configuration::InvalidName& ex)
{
ExceptionMapper e(ex);
- Reference<uno::XInterface> xContext( rNode.getUnoInstance() );
- throw UnknownPropertyException( e.message(), xContext );
+ uno::Reference<uno::XInterface> xContext( rNode.getUnoInstance() );
+ throw beans::UnknownPropertyException( e.message(), xContext );
}
catch (configuration::ConstraintViolation & ex)
{
ExceptionMapper e(ex);
- OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Configuration - Cannot get Default: ") );
- Reference<uno::XInterface> xContext( rNode.getUnoInstance() );
- throw UnknownPropertyException( sMessage += e.message(), xContext );
+ rtl::OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Configuration - Cannot get Default: ") );
+ uno::Reference<uno::XInterface> xContext( rNode.getUnoInstance() );
+ throw beans::UnknownPropertyException( sMessage += e.message(), xContext );
}
catch (configuration::Exception& ex)
{
@@ -1264,56 +1220,54 @@ Any implGetPropertyDefault( NodeGroupInfoAccess& rNode, const OUString& sPropert
}
//-----------------------------------------------------------------------------------
-Sequence< Any > implGetPropertyDefaults( NodeGroupInfoAccess& rNode, const Sequence< OUString >& aPropertyNames )
- throw(beans::UnknownPropertyException, lang::WrappedTargetException, RuntimeException)
+uno::Sequence< uno::Any > implGetPropertyDefaults( NodeGroupInfoAccess& rNode, const uno::Sequence< rtl::OUString >& aPropertyNames )
+ throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
{
sal_Int32 const count = aPropertyNames.getLength();
- Sequence<Any> aDefaults(count);
+ uno::Sequence<uno::Any> aDefaults(count);
try
{
- using configuration::getChildOrElement;
-
- GuardedNodeDataAccess lock( rNode );
+ GuardedNodeData<NodeAccess> lock( rNode );
- Tree const aTree( lock.getTree() );
- NodeRef const aNode( lock.getNode() );
+ rtl::Reference< configuration::Tree > const aTree( lock.getTree() );
+ configuration::NodeRef const aNode( lock.getNode() );
for(sal_Int32 i = 0; i < count; ++i)
{
- Name aChildName = validateChildName(aPropertyNames[i],aTree,aNode);
+ rtl::OUString aChildName = configuration::validateChildName(aPropertyNames[i],aTree,aNode);
- AnyNodeRef aChildNode = aTree.getAnyChild(aNode, aChildName);
+ configuration::AnyNodeRef aChildNode = aTree->getAnyChild(aNode, aChildName);
if (!aChildNode.isValid())
{
- OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Configuration - Cannot get Default. Property '") );
+ rtl::OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Configuration - Cannot get Default. Property '") );
sMessage += aPropertyNames[i];
- sMessage += OUString( RTL_CONSTASCII_USTRINGPARAM("' not found in ") );
- sMessage += aTree.getAbsolutePath(aNode).toString();
+ sMessage += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("' not found in ") );
+ sMessage += aTree->getAbsolutePath(aNode).toString();
- Reference<uno::XInterface> xContext( rNode.getUnoInstance() );
- throw UnknownPropertyException( sMessage, xContext );
+ uno::Reference<uno::XInterface> xContext( rNode.getUnoInstance() );
+ throw beans::UnknownPropertyException( sMessage, xContext );
}
OSL_ASSERT(aNode.isValid());
if (!aChildNode.isNode())
{
- aDefaults[i] = aTree.getNodeDefaultValue(aChildNode.toValue());
+ aDefaults[i] = aTree->getNodeDefaultValue(aChildNode.toValue());
}
}
}
catch (configuration::InvalidName& ex)
{
ExceptionMapper e(ex);
- Reference<uno::XInterface> xContext( rNode.getUnoInstance() );
- throw UnknownPropertyException( e.message(), xContext );
+ uno::Reference<uno::XInterface> xContext( rNode.getUnoInstance() );
+ throw beans::UnknownPropertyException( e.message(), xContext );
}
catch (configuration::ConstraintViolation & ex)
{
ExceptionMapper e(ex);
- OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Configuration - Cannot get Default: ") );
- Reference<uno::XInterface> xContext( rNode.getUnoInstance() );
- throw UnknownPropertyException( sMessage += e.message(), xContext );
+ rtl::OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Configuration - Cannot get Default: ") );
+ uno::Reference<uno::XInterface> xContext( rNode.getUnoInstance() );
+ throw beans::UnknownPropertyException( sMessage += e.message(), xContext );
}
catch (configuration::Exception& ex)
{
diff --git a/configmgr/source/api2/propsetaccessimpl.hxx b/configmgr/source/api2/propsetaccessimpl.hxx
index 16d026cad1..223205c2ec 100644
--- a/configmgr/source/api2/propsetaccessimpl.hxx
+++ b/configmgr/source/api2/propsetaccessimpl.hxx
@@ -48,7 +48,6 @@ namespace configmgr
namespace uno = ::com::sun::star::uno;
namespace lang = ::com::sun::star::lang;
namespace beans = ::com::sun::star::beans;
- using rtl::OUString;
/* implementations of the interfaces supported by a (parent) node
within the configuration tree.
@@ -71,68 +70,68 @@ namespace configmgr
// setting values - may all throw (PropertyVeto)Exceptions on read-only property sets
// XPropertySet
- void implSetPropertyValue( NodeGroupAccess& rNode, const OUString& aPropertyName, const uno::Any& aValue )
+ void implSetPropertyValue( NodeGroupAccess& rNode, const rtl::OUString& aPropertyName, const uno::Any& aValue )
throw(beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException,
lang::WrappedTargetException, uno::RuntimeException);
// XMultiPropertySet
- void implSetPropertyValues( NodeGroupAccess& rNode, const uno::Sequence< OUString >& PropertyNames, const uno::Sequence< uno::Any >& Values )
+ void implSetPropertyValues( NodeGroupAccess& rNode, const uno::Sequence< rtl::OUString >& PropertyNames, const uno::Sequence< uno::Any >& Values )
throw(beans::PropertyVetoException, lang::IllegalArgumentException,
lang::WrappedTargetException, uno::RuntimeException);
// XHierarchicalPropertySet
- void implSetHierarchicalPropertyValue( NodeGroupAccess& rNode, const OUString& aPropertyName, const uno::Any& aValue )
+ void implSetHierarchicalPropertyValue( NodeGroupAccess& rNode, const rtl::OUString& aPropertyName, const uno::Any& aValue )
throw(beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException,
lang::WrappedTargetException, uno::RuntimeException);
// XMultiHierarchicalPropertySet
- void implSetHierarchicalPropertyValues( NodeGroupAccess& rNode, const uno::Sequence< OUString >& PropertyNames, const uno::Sequence< uno::Any >& Values )
+ void implSetHierarchicalPropertyValues( NodeGroupAccess& rNode, const uno::Sequence< rtl::OUString >& PropertyNames, const uno::Sequence< uno::Any >& Values )
throw(beans::PropertyVetoException, lang::IllegalArgumentException,
lang::WrappedTargetException, uno::RuntimeException);
// getting values
// XPropertySet
- uno::Any implGetPropertyValue( NodeGroupInfoAccess& rNode,const OUString& PropertyName )
+ uno::Any implGetPropertyValue( NodeGroupInfoAccess& rNode,const rtl::OUString& PropertyName )
throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException);
// XMultiPropertySet
- uno::Sequence< uno::Any > implGetPropertyValues( NodeGroupInfoAccess& rNode, const uno::Sequence< OUString >& aPropertyNames )
+ uno::Sequence< uno::Any > implGetPropertyValues( NodeGroupInfoAccess& rNode, const uno::Sequence< rtl::OUString >& aPropertyNames )
throw(uno::RuntimeException);
// XHierarchicalPropertySet
- uno::Any implGetHierarchicalPropertyValue( NodeGroupInfoAccess& rNode, const OUString& PropertyName )
+ uno::Any implGetHierarchicalPropertyValue( NodeGroupInfoAccess& rNode, const rtl::OUString& PropertyName )
throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException);
// XMultiHierarchicalPropertySet
- uno::Sequence< uno::Any > implGetHierarchicalPropertyValues( NodeGroupInfoAccess& rNode, const uno::Sequence< OUString >& aPropertyNames )
+ uno::Sequence< uno::Any > implGetHierarchicalPropertyValues( NodeGroupInfoAccess& rNode, const uno::Sequence< rtl::OUString >& aPropertyNames )
throw(uno::RuntimeException);
// SPECIAL: firePropertiesChangeEvent
// XMultiPropertySet
- void implFirePropertiesChangeEvent( NodeGroupInfoAccess& rNode, const uno::Sequence< OUString >& aPropertyNames, const uno::Reference< beans::XPropertiesChangeListener >& xListener )
+ void implFirePropertiesChangeEvent( NodeGroupInfoAccess& rNode, const uno::Sequence< rtl::OUString >& aPropertyNames, const uno::Reference< beans::XPropertiesChangeListener >& xListener )
throw(uno::RuntimeException);
// XPropertyState
- beans::PropertyState implGetPropertyState( NodeAccess& rNode, const OUString& sPropertyName )
+ beans::PropertyState implGetPropertyState( NodeAccess& rNode, const rtl::OUString& sPropertyName )
throw(beans::UnknownPropertyException, uno::RuntimeException);
- void implSetPropertyToDefault( NodeGroupAccess& rNode, const OUString& sPropertyName )
+ void implSetPropertyToDefault( NodeGroupAccess& rNode, const rtl::OUString& sPropertyName )
throw(beans::UnknownPropertyException, uno::RuntimeException);
- uno::Any implGetPropertyDefault( NodeGroupInfoAccess& rNode, const OUString& sPropertyName )
+ uno::Any implGetPropertyDefault( NodeGroupInfoAccess& rNode, const rtl::OUString& sPropertyName )
throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException);
// XMultiPropertyState
- uno::Sequence< beans::PropertyState > implGetPropertyStates( NodeAccess& rNode, const uno::Sequence< OUString >& aPropertyName )
+ uno::Sequence< beans::PropertyState > implGetPropertyStates( NodeAccess& rNode, const uno::Sequence< rtl::OUString >& aPropertyName )
throw(beans::UnknownPropertyException, uno::RuntimeException);
- void implSetPropertiesToDefault( NodeGroupAccess& rNode, const uno::Sequence< OUString >& aPropertyNames )
+ void implSetPropertiesToDefault( NodeGroupAccess& rNode, const uno::Sequence< rtl::OUString >& aPropertyNames )
throw(beans::UnknownPropertyException, uno::RuntimeException);
void implSetAllPropertiesToDefault( NodeGroupAccess& rNode )
throw(uno::RuntimeException);
- uno::Sequence< uno::Any > implGetPropertyDefaults( NodeGroupInfoAccess& rNode, const uno::Sequence< OUString >& aPropertyNames )
+ uno::Sequence< uno::Any > implGetPropertyDefaults( NodeGroupInfoAccess& rNode, const uno::Sequence< rtl::OUString >& aPropertyNames )
throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException);
}
diff --git a/configmgr/source/api2/provider.cxx b/configmgr/source/api2/provider.cxx
index dcb0e3c67b..37043d5705 100644
--- a/configmgr/source/api2/provider.cxx
+++ b/configmgr/source/api2/provider.cxx
@@ -30,11 +30,18 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_configmgr.hxx"
+
+#include "apiserviceinfo.hxx"
+#include "confapifactory.hxx"
+#include "configpath.hxx"
+#include "datalock.hxx"
#include "provider.hxx"
#include "providerimpl.hxx"
#include "tracer.hxx"
#include "bootstrap.hxx"
+#include "wrapexception.hxx"
#include <osl/mutex.hxx>
+#include <rtl/ustrbuf.hxx>
#ifndef __SGI_STL_ALGORITHM
#include <algorithm>
#endif
@@ -42,8 +49,8 @@
#include <cppuhelper/typeprovider.hxx>
#include <com/sun/star/beans/PropertyValue.hpp>
#include <cppuhelper/typeprovider.hxx>
+#include <com/sun/star/lang/ServiceNotRegisteredException.hpp>
#include <com/sun/star/lang/XEventListener.hpp>
-#define THISREF() static_cast< ::cppu::OWeakObject* >(this)
namespace configmgr
{
@@ -51,13 +58,214 @@ namespace configmgr
namespace uno = css::uno;
namespace lang = css::lang;
namespace beans = css::beans;
- using ::rtl::OUString;
- using ::vos::ORef;
- using namespace osl;
+
+ namespace
+ {
+ //------------------------------------------------------------------------
+ sal_Char const * const aConfigProviderServices[] =
+ {
+ "com.sun.star.configuration.ConfigurationProvider",
+ 0
+ };
+ sal_Char const * const aAdminProviderServices[] =
+ {
+ "com.sun.star.configuration.AdministrationProvider",
+ 0
+ };
+ //------------------------------------------------------------------------
+
+ ServiceImplementationInfo const aConfigProviderInfo =
+ {
+ "com.sun.star.comp.configuration.ConfigurationProvider",
+ aConfigProviderServices,
+ 0
+ };
+ ServiceImplementationInfo const aAdminProviderInfo =
+ {
+ "com.sun.star.comp.configuration.AdministrationProvider",
+ aAdminProviderServices,
+ aConfigProviderServices
+ };
+ //------------------------------------------------------------------------
+
+ sal_Char const * const
+ aDefaultProviderServiceAndImplName = A_DefaultProviderServiceAndImplName;
+
+ //------------------------------------------------------------------------
+
+ sal_Char const * const aDefaultProviderServices[] =
+ {
+ aDefaultProviderServiceAndImplName,
+ 0
+ };
+ //------------------------------------------------------------------------
+
+ ServiceRegistrationInfo const aDefaultProviderInfo =
+ {
+ aDefaultProviderServiceAndImplName,
+ aDefaultProviderServices
+ };
+ SingletonRegistrationInfo const aDefaultProviderSingletonInfo =
+ {
+ A_DefaultProviderSingletonName,
+ aDefaultProviderServiceAndImplName,
+ aDefaultProviderServiceAndImplName,
+ 0
+ };
+ //------------------------------------------------------------------------
+ typedef uno::Reference< uno::XInterface > (OProviderImpl::*CreatorFunc)(const uno::Sequence< uno::Any >& aArguments);
+ struct ServiceCreationInfo
+ {
+ ServiceRegistrationInfo const* info;
+ CreatorFunc create;
+ };
+
+ static sal_Int32 getCreateServiceDataCount()
+ {
+ return 2;
+ }
+
+ static const ServiceCreationInfo* getCreateServiceData()
+ {
+ static ServiceCreationInfo const createServiceData[] =
+ {
+ { &configapi::aCreateReadAccessSI, &OProviderImpl::createReadAccess },
+ { &configapi::aCreateUpdateAccessSI, &OProviderImpl::createUpdateAccess },
+ };
+ OSL_ENSURE(sizeof(createServiceData)/sizeof(createServiceData[0]) == getCreateServiceDataCount(),
+ "getCreateServiceData : inconsistent data !");
+ return createServiceData;
+ }
+ //------------------------------------------------------------------------
+ }
+
+ static ServiceCreationInfo const* findCreationInfo( const rtl::OUString& aServiceSpecifier )
+ {
+ for (int i= 0; i<getCreateServiceDataCount(); ++i)
+ {
+ ServiceCreationInfo const& rCreationInfo = getCreateServiceData()[i];
+
+ ServiceRegistrationInfo const* pInfo = rCreationInfo.info;
+ if (!pInfo)
+ continue;
+
+ if (sal_Char const * pImplName = pInfo->implementationName)
+ {
+ if (0 == aServiceSpecifier.compareToAscii(pImplName))
+ return &rCreationInfo;
+ }
+
+ if (sal_Char const * const* pNames = pInfo->registeredServiceNames)
+ {
+ while(*pNames)
+ {
+ if (0 == aServiceSpecifier.compareToAscii(*pNames))
+ return &rCreationInfo;
+
+ ++pNames;
+ }
+ }
+ }
+ // not found
+ return 0;
+ }
+
+ //#define ID_PREFETCH 1
+ static const int ID_PREFETCH=1;
+ static const int ID_ENABLEASYNC=2;
+
+ static inline
+ rtl::OUString getPrefetchPropName() { return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("PrefetchNodes") ); }
+ static inline
+ rtl::OUString getEnableAsyncPropName() { return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("EnableAsync") ); }
+ //=============================================================================
+ //= OProvider
+ //=============================================================================
+ // service info export
+ const ServiceRegistrationInfo* getConfigurationProviderServiceInfo()
+ {
+ return getRegistrationInfo(&aConfigProviderInfo);
+ }
+
+ const ServiceRegistrationInfo* getAdminProviderServiceInfo()
+ {
+ return getRegistrationInfo(&aAdminProviderInfo);
+ }
+
+ const ServiceRegistrationInfo* getDefaultProviderServiceInfo()
+ {
+ return &aDefaultProviderInfo;
+ }
+
+ const SingletonRegistrationInfo* getDefaultProviderSingletonInfo()
+ {
+ return &aDefaultProviderSingletonInfo;
+ }
+
+ //-----------------------------------------------------------------------------
+ uno::Reference<uno::XInterface> SAL_CALL
+ getDefaultConfigProviderSingleton( uno::Reference< uno::XComponentContext > const& xContext )
+ {
+ OSL_ENSURE( xContext.is(), "ERROR: NULL context has no singletons" );
+
+ UnoContextTunnel aTunnel;
+ aTunnel.passthru( xContext );
+
+ uno::Reference<uno::XInterface> xResult;
+
+ if (xContext.is())
+ try
+ {
+ rtl::OUString aSingletonName = SINGLETON(A_DefaultProviderSingletonName);
+ uno::Any aResult = xContext->getValueByName(aSingletonName);
+ aResult >>= xResult;
+ }
+ catch (uno::Exception & )
+ {
+ // to do: really use the tunneled failure when that is set properly
+ if ( aTunnel.recoverFailure(true).hasValue() )
+ {
+ // have a failure, but can't recover it
+ // -> try to regenerate
+ instantiateDefaultProvider(xContext);
+
+ OSL_ENSURE(false, "Cannot recreate configuration backend instantiation failure - using generic error");
+ }
+ // cannot recover any failure
+ throw;
+ }
+
+ return xResult;
+ }
+ // ------------------------------------------------------------------------
+ // ----------------------------------------------------------------------------
+ #define TUNNEL_ALL_EXCEPTIONS() \
+ WRAP_CONFIGBACKEND_CREATION_EXCEPTIONS1( UnoContextTunnel::tunnelFailure, true)
+
+ // ----------------------------------------------------------------------------
+ // ------------------------------------------------------------------------
+
+ uno::Reference< uno::XInterface > SAL_CALL instantiateDefaultProvider( uno::Reference< uno::XComponentContext > const & xTargetContext )
+ {
+ uno::Reference< uno::XComponentContext > xContext = UnoContextTunnel::recoverContext(xTargetContext);
+
+ ServiceImplementationInfo const * pProviderInfo =
+ ContextReader::testAdminService(xContext,true) ? &aAdminProviderInfo : &aConfigProviderInfo;
+
+ OProvider* pNewProvider = new OProvider(xContext,pProviderInfo);
+ uno::Reference< lang::XMultiServiceFactory > aRet( pNewProvider );
+
+ try
+ {
+ pNewProvider->connect();
+ }
+ TUNNEL_ALL_EXCEPTIONS()
+
+ return uno::Reference< uno::XInterface >( aRet, uno::UNO_QUERY );
+ }
// -----------------------------------------------------------------------------
- typedef ::cppu::WeakImplHelper1<lang::XEventListener> XEventListener_BASE;
- class OProviderDisposingListener : public XEventListener_BASE
+ class OProviderDisposingListener : public cppu::WeakImplHelper1<lang::XEventListener>
{
OProvider* m_pProvider;
@@ -80,22 +288,44 @@ namespace configmgr
//= OProvider
//=============================================================================
//-----------------------------------------------------------------------------
- OProvider::OProvider(CreationContext const & xContext, ServiceImplementationInfo const* pInfo)
+ OProvider::OProvider(uno::Reference< uno::XComponentContext > const & xContext, ServiceImplementationInfo const* pInfo)
:ServiceComponentImpl(pInfo)
,OPropertyContainer(ServiceComponentImpl::rBHelper)
,m_xContext(xContext)
+ ,m_pImpl(NULL)
+ ,m_bEnableAsync(false)
{
OSL_ENSURE(m_xContext.is(), "Creating a provider without a context");
attachToContext();
+ registerProperty(getPrefetchPropName(), ID_PREFETCH, 0,&m_aPrefetchNodes, ::getCppuType(&m_aPrefetchNodes));
+ registerProperty(getEnableAsyncPropName(), ID_ENABLEASYNC, 0, &m_bEnableAsync, ::getBooleanCppuType());
}
//-----------------------------------------------------------------------------
OProvider::~OProvider()
{
+ delete m_pImpl;
discardContext(releaseContext());
}
//-----------------------------------------------------------------------------
+ void OProvider::connect() throw (uno::Exception)
+ {
+ OSL_ENSURE( m_pImpl == NULL, "Error: Configuration Provider already is connected");
+
+ std::auto_ptr<OProviderImpl> pNewImpl( new OProviderImpl(this, m_xContext) );
+
+ implConnect(*pNewImpl,ContextReader(m_xContext));
+
+ m_pImpl = pNewImpl.release();
+ if (m_pImpl)
+ {
+ sal_Bool isEnabled = m_pImpl->getDefaultOptions().isAsyncEnabled();
+ this->setPropertyValue( getEnableAsyncPropName(), uno::makeAny(isEnabled) );
+ }
+ }
+
+ //-----------------------------------------------------------------------------
void OProvider::attachToContext()
{
UnoApiLock aLock;
@@ -166,7 +396,11 @@ namespace configmgr
//-----------------------------------------------------------------------------
uno::Sequence< uno::Type > SAL_CALL OProvider::getTypes( ) throw(uno::RuntimeException)
{
- return ::comphelper::concatSequences(ServiceComponentImpl::getTypes(), OProvider_Base::getTypes());
+ cppu::OTypeCollection aCollection(::getCppuType( (const uno::Reference< beans::XPropertySet > *)0 ),
+ ::getCppuType( (const uno::Reference< beans::XFastPropertySet > *)0 ),
+ ::getCppuType( (const uno::Reference< beans::XMultiPropertySet > *)0 ),
+ ::comphelper::concatSequences(ServiceComponentImpl::getTypes(), cppu::ImplHelper4< lang::XMultiServiceFactory, lang::XLocalizable, util::XRefreshable, util::XFlushable >::getTypes()));
+ return aCollection.getTypes();
}
// XPropertySet
@@ -176,6 +410,202 @@ namespace configmgr
return ::cppu::OPropertySetHelper::createPropertySetInfo(getInfoHelper());
}
+ //-----------------------------------------------------------------------------
+ uno::Reference< uno::XInterface > SAL_CALL OProvider::createInstance( const rtl::OUString& aServiceSpecifier )
+ throw(uno::Exception, uno::RuntimeException)
+ {
+ UnoApiLock aLock;
+ // same as creating with empty sequence of arguments
+ return this->createInstanceWithArguments( aServiceSpecifier, uno::Sequence< uno::Any >() );
+ }
+
+ //-----------------------------------------------------------------------------
+ uno::Reference< uno::XInterface > SAL_CALL
+ OProvider::createInstanceWithArguments( const rtl::OUString& aServiceSpecifier, const uno::Sequence< uno::Any >& aArguments )
+ throw(uno::Exception, uno::RuntimeException)
+ {
+ UnoApiLock aLock;
+
+ OSL_ENSURE(m_pImpl, "OProvider: no implementation available");
+
+ if (ServiceCreationInfo const* pInfo = findCreationInfo(aServiceSpecifier))
+ {
+ // it's a known service name - try to create without args
+ if (CreatorFunc create = pInfo->create)
+ {
+ return (m_pImpl->*create)(aArguments);
+ }
+ }
+
+ rtl::OUStringBuffer sMsg;
+ sMsg.appendAscii("ConfigurationProvider: Cannot create view - ");
+ sMsg.append( aServiceSpecifier ) .appendAscii(" is not a valid configuration access service. ");
+
+ throw lang::ServiceNotRegisteredException(sMsg.makeStringAndClear(),*this);
+ }
+
+ //-----------------------------------------------------------------------------
+ uno::Sequence< rtl::OUString > SAL_CALL OProvider::getAvailableServiceNames( )
+ throw(uno::RuntimeException)
+ {
+ UnoApiLock aLock;
+
+ sal_Int32 nCount = 0;
+ {
+ for (int i= 0; i< getCreateServiceDataCount(); ++i)
+ nCount += countServices(getCreateServiceData()[i].info);
+ }
+
+ uno::Sequence< rtl::OUString > aNames(nCount);
+ if (nCount > 0)
+ {
+ sal_Int32 n = 0;
+ for (int i= 0; i<getCreateServiceDataCount(); ++i)
+ {
+ ServiceRegistrationInfo const* pInfo = getCreateServiceData()[i].info;
+ sal_Char const * const* pNames = pInfo ? pInfo->registeredServiceNames : 0;
+
+ if (pNames)
+ {
+ while(*pNames)
+ {
+ aNames[n] = rtl::OUString::createFromAscii(*pNames);
+ ++n;
+ ++pNames;
+ }
+ }
+ }
+ }
+
+ return aNames;
+ }
+
+ // XLocalizable
+ //-----------------------------------------------------------------------------
+ void SAL_CALL OProvider::setLocale( const lang::Locale& eLocale )
+ throw (uno::RuntimeException)
+ {
+ UnoApiLock aLock;
+
+ OSL_ENSURE(m_pImpl, "OProvider: no implementation available");
+
+ m_pImpl->setDefaultLocale( eLocale );
+ }
+
+ //-----------------------------------------------------------------------------
+ lang::Locale SAL_CALL OProvider::getLocale()
+ throw (uno::RuntimeException)
+ {
+ UnoApiLock aLock;
+
+ OSL_ENSURE(m_pImpl, "OProvider: no implementation available");
+
+ return m_pImpl->getDefaultOptions().getUnoLocale();
+ }
+
+ //XRefreshable
+ //-----------------------------------------------------------------------------
+ void SAL_CALL OProvider::refresh()
+ throw (uno::RuntimeException)
+ {
+ UnoApiLock aLock;
+
+ OSL_ENSURE(m_pImpl, "OProvider: no implementation available");
+
+ try
+ {
+ m_pImpl->refreshAll();
+ }
+ catch (uno::RuntimeException& ) { throw; }
+ catch (uno::Exception& e)
+ {
+ // FIXME: use getCaughtException()
+ throw lang::WrappedTargetRuntimeException(e.Message, *this, uno::makeAny(e));
+ }
+ //Broadcast the changes
+ uno::Reference< css::util::XRefreshListener > const * const pRefresh = 0;
+ cppu::OInterfaceContainerHelper * aInterfaceContainer=
+ getBroadcastHelper().getContainer (::getCppuType(pRefresh));
+
+ if(aInterfaceContainer)
+ {
+ lang::EventObject aEventObject(*this);
+
+ cppu::OInterfaceIteratorHelper aIterator(*aInterfaceContainer);
+ while(aIterator.hasMoreElements())
+ {
+ uno::Reference< uno::XInterface > xIface = aIterator.next();
+ uno::Reference< util::XRefreshListener > xRefresh (xIface, uno::UNO_QUERY);
+ if (xRefresh.is())
+ {
+ xRefresh->refreshed(aEventObject);
+ }
+ }
+ }
+ }
+ //-----------------------------------------------------------------------------
+ void SAL_CALL OProvider::addRefreshListener(
+ const uno::Reference< util::XRefreshListener >& aListener )
+ throw (uno::RuntimeException)
+ {
+ UnoApiLock aLock;
+ getBroadcastHelper().addListener(::getCppuType(&aListener), aListener);
+ }
+ //-----------------------------------------------------------------------------
+ void SAL_CALL OProvider::removeRefreshListener(
+ const uno::Reference< util::XRefreshListener >& aListener )
+ throw (uno::RuntimeException)
+ {
+ UnoApiLock aLock;
+ getBroadcastHelper().removeListener(::getCppuType(&aListener), aListener);
+ }
+ //XFlushable
+ //-----------------------------------------------------------------------------
+ void SAL_CALL OProvider::flush( )
+ throw (uno::RuntimeException)
+ {
+ UnoApiLock aLock;
+ OSL_ENSURE(m_pImpl, "OProvider: no implementation available");
+ m_pImpl->flushAll();
+
+ //Broadcast the changes
+ uno::Reference< css::util::XFlushListener > const * const pFlush = 0;
+ cppu::OInterfaceContainerHelper * aInterfaceContainer=
+ getBroadcastHelper().getContainer(::getCppuType(pFlush));
+
+ if(aInterfaceContainer)
+ {
+ lang::EventObject aEventObject(*this);
+
+ cppu::OInterfaceIteratorHelper aIterator(*aInterfaceContainer);
+ while(aIterator.hasMoreElements())
+ {
+ uno::Reference< uno::XInterface > xIface = aIterator.next();
+ uno::Reference< util::XFlushListener > xFlush (xIface, uno::UNO_QUERY);
+ if (xFlush.is())
+ {
+ xFlush->flushed(aEventObject);
+ }
+ }
+ }
+ }
+ //-----------------------------------------------------------------------------
+ void SAL_CALL OProvider::addFlushListener(
+ const uno::Reference< util::XFlushListener >& aListener )
+ throw (uno::RuntimeException)
+ {
+ UnoApiLock aLock;
+ getBroadcastHelper().addListener(::getCppuType(&aListener), aListener);
+ }
+ //-----------------------------------------------------------------------------
+ void SAL_CALL OProvider::removeFlushListener(
+ const uno::Reference< util::XFlushListener >& aListener )
+ throw (uno::RuntimeException)
+ {
+ UnoApiLock aLock;
+ getBroadcastHelper().removeListener(::getCppuType(&aListener), aListener);
+ }
+
// XInterface
//-----------------------------------------------------------------------------
uno::Any SAL_CALL OProvider::queryInterface(uno::Type const& rType) throw(uno::RuntimeException)
@@ -183,7 +613,9 @@ namespace configmgr
UnoApiLock aLock;
uno::Any aRet( ServiceComponentImpl::queryInterface(rType) );
if ( !aRet.hasValue() )
- aRet = OProvider_Base::queryInterface(rType);
+ aRet = cppu::ImplHelper4< lang::XMultiServiceFactory, lang::XLocalizable, util::XRefreshable, util::XFlushable >::queryInterface(rType);
+ if ( !aRet.hasValue() )
+ aRet = queryPropertyInterface(rType);
return aRet;
}
@@ -192,7 +624,7 @@ namespace configmgr
{
UnoApiLock aLock;
if (!_rFreshProviderImpl.initSession(_rSettings))
- throw uno::Exception(::rtl::OUString::createFromAscii("Could not connect to the configuration. Please check your settings."), THISREF() );
+ throw uno::Exception(::rtl::OUString::createFromAscii("Could not connect to the configuration. Please check your settings."), static_cast< ::cppu::OWeakObject* >(this) );
}
//-----------------------------------------------------------------------------
@@ -207,6 +639,10 @@ namespace configmgr
void SAL_CALL OProvider::disposing()
{
UnoApiLock aLock;
+
+ if (m_pImpl)
+ m_pImpl->dispose();
+
uno::Reference< lang::XComponent > xComp = releaseContext();
ServiceComponentImpl::disposing();
@@ -214,36 +650,65 @@ namespace configmgr
discardContext( xComp );
}
-/*
- // com::sun::star::lang::XUnoTunnel
- //------------------------------------------------------------------
- sal_Int64 OProvider::getSomething( const uno::Sequence< sal_Int8 > & _rId ) throw (uno::RuntimeException)
- {
- if (_rId.getLength() != 16)
- return 0;
-
- if (0 == rtl_compareMemory(getUnoTunnelImplementationId().getConstArray(), _rId.getConstArray(), 16 ) )
- return reinterpret_cast<sal_Int64>(this);
- return 0;
+ // OPropertyArrayUsageHelper
+ // -------------------------------------------------------------------------
+ ::cppu::IPropertyArrayHelper* OProvider::createArrayHelper( ) const
+ {
+ UnoApiLock aLock;
+ uno::Sequence< beans::Property > aProps;
+ describeProperties(aProps);
+ return new ::cppu::OPropertyArrayHelper(aProps);
+ }
+ // -------------------------------------------------------------------------
+ ::cppu::IPropertyArrayHelper & OProvider::getInfoHelper()
+ {
+ UnoApiLock aLock;
+ return *getArrayHelper();
}
- //--------------------------------------------------------------------------
- uno::Sequence< sal_Int8 > OProvider::getUnoTunnelImplementationId() throw (uno::RuntimeException)
+ void SAL_CALL OProvider::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue)
+ throw (::com::sun::star::uno::Exception)
{
- static ::cppu::OImplementationId * pId = 0;
- if (! pId)
+ UnoApiLock aLock;
+
+ OPropertyContainer::setFastPropertyValue_NoBroadcast( nHandle, rValue );
+
+ switch(nHandle)
{
- ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
- if (! pId)
+ case ID_PREFETCH:
{
- static ::cppu::OImplementationId aId;
- pId = &aId;
+ uno::Sequence< rtl::OUString > aNodeList;
+ rValue >>= aNodeList;
+
+ RequestOptions const aOptions = m_pImpl->getDefaultOptions();
+
+ for (sal_Int32 i = 0; i < aNodeList.getLength(); i++)
+ {
+ configuration::AbsolutePath aModulePath = configuration::AbsolutePath::makeModulePath(aNodeList[i]);
+ m_pImpl->fetchSubtree(aModulePath , aOptions);
+ }
+ }break;
+
+ case ID_ENABLEASYNC:
+ {
+ //Forward to TreeManager
+ sal_Bool bAsync;
+ if (rValue >>= bAsync)
+ {
+ m_pImpl->enableAsync(bAsync);
+ if (!bAsync)
+ this->flush();
+ }
+ else
+ OSL_ENSURE(false, "Unexpected type of new property value");
+ }
+ break;
+ default:
+ {
+ OSL_ENSURE(false, "OProvider::setFastPropertyValue_NoBroadcast -unknown property");
}
+
}
- return pId->getImplementationId();
}
-*/
} // namespace configmgr
-
-
diff --git a/configmgr/source/api2/provider.hxx b/configmgr/source/api2/provider.hxx
index b37200999c..916cb0aef8 100644
--- a/configmgr/source/api2/provider.hxx
+++ b/configmgr/source/api2/provider.hxx
@@ -43,6 +43,7 @@
#include <rtl/ustring.hxx>
#include <vos/ref.hxx>
#include <cppuhelper/implbase4.hxx>
+#include <comphelper/proparrhlp.hxx>
#include <comphelper/propertycontainer.hxx>
namespace configmgr
@@ -52,39 +53,34 @@ namespace configmgr
namespace lang = css::lang;
namespace beans = css::beans;
namespace util = css::util;
- using ::rtl::OUString;
- using ::vos::ORef;
class Module;
class ContextReader;
class OProviderImpl;
- typedef ::cppu::ImplHelper4 < lang::XMultiServiceFactory
- ,lang::XLocalizable
- ,util::XRefreshable
- ,util::XFlushable
- > OProvider_Base;
-
//==========================================================================
//= OProvider
//==========================================================================
/** Base class to receive access to the configuration data. A provider for configuration is
a factory for service which allow a readonly or update access to the configuration trees.
*/
- class OProvider : protected ServiceComponentImpl
- , protected ::comphelper::OPropertyContainer
+ class OProvider:
+ private ServiceComponentImpl, private comphelper::OPropertyContainer,
+ public comphelper::OPropertyArrayUsageHelper< OProvider >
// don't want to allow our derivees to access the mutex of ServiceComponentImpl
// (this helps to prevent deadlocks: The mutex of the base class is used by the OComponentHelper to
// protect addEvenetListener calls. Unfortunately these calls are made from within API object we create,
// too, which can lead do deadlocks ....)
- , public OProvider_Base
+ , public cppu::ImplHelper4< lang::XMultiServiceFactory, lang::XLocalizable, util::XRefreshable, util::XFlushable >
{
-// friend class OProviderFactory;
+ private:
friend class OProviderDisposingListener;
- protected:
uno::Reference< uno::XComponentContext > m_xContext;
uno::Reference< lang::XEventListener > m_xDisposeListener;
+ OProviderImpl * m_pImpl;
+ uno::Sequence< ::rtl::OUString > m_aPrefetchNodes;
+ sal_Bool m_bEnableAsync;
public:
// make ServiceComponentImpl allocation functions public
@@ -93,11 +89,11 @@ namespace configmgr
static void SAL_CALL operator delete( void * pMem ) throw()
{ ServiceComponentImpl::operator delete( pMem ); }
- typedef uno::Reference< uno::XComponentContext > CreationContext;
-
- OProvider(CreationContext const & xContext, ServiceImplementationInfo const* pInfo);
+ OProvider(uno::Reference< uno::XComponentContext > const & xContext, ServiceImplementationInfo const* pInfo);
virtual ~OProvider();
+ void connect() throw (uno::Exception);
+
/// XTypeOProvider
virtual uno::Sequence< uno::Type > SAL_CALL getTypes( ) throw(uno::RuntimeException);
@@ -109,23 +105,64 @@ namespace configmgr
// XPropertySet
virtual uno::Reference< beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(uno::RuntimeException);
+ /// XMultiServiceFactory
+ virtual uno::Reference< uno::XInterface > SAL_CALL
+ createInstance( const rtl::OUString& aServiceSpecifier )
+ throw(uno::Exception, uno::RuntimeException);
+
+ virtual uno::Reference< uno::XInterface > SAL_CALL
+ createInstanceWithArguments( const ::rtl::OUString& ServiceSpecifier, const uno::Sequence< uno::Any >& Arguments )
+ throw(uno::Exception, uno::RuntimeException);
+
+ virtual uno::Sequence< rtl::OUString > SAL_CALL
+ getAvailableServiceNames( )
+ throw(uno::RuntimeException);
+
+ /// XLocalizable
+ virtual void SAL_CALL
+ setLocale( const lang::Locale& eLocale )
+ throw (uno::RuntimeException);
+
+ virtual lang::Locale SAL_CALL
+ getLocale( )
+ throw (uno::RuntimeException);
+
+
+ //XRefreshable
+ virtual void SAL_CALL
+ refresh( )
+ throw (uno::RuntimeException);
+ virtual void SAL_CALL
+ addRefreshListener(
+ const uno::Reference< util::XRefreshListener >& aListener )
+ throw (uno::RuntimeException);
+ virtual void SAL_CALL
+ removeRefreshListener(
+ const uno::Reference< util::XRefreshListener >& aListener )
+ throw (uno::RuntimeException);
+ //XFlushable
+ virtual void SAL_CALL
+ flush( )
+ throw (uno::RuntimeException);
+ virtual void SAL_CALL
+ addFlushListener(
+ const uno::Reference< util::XFlushListener >& aListener )
+ throw (uno::RuntimeException);
+ virtual void SAL_CALL
+ removeFlushListener(
+ const uno::Reference< util::XFlushListener >& aListener )
+ throw (uno::RuntimeException);
+
// OPropertSetHelper
virtual void SAL_CALL setFastPropertyValue_NoBroadcast(
- sal_Int32 nHandle,
- const uno::Any& rValue
- )
- throw (uno::Exception)
- {
- OPropertyContainer::setFastPropertyValue_NoBroadcast(nHandle, rValue);
- }
+ sal_Int32 nHandle, const uno::Any& rValue) throw (uno::Exception);
static sal_Int32 countServices(ServiceRegistrationInfo const* aInfo) { return ServiceRegistrationHelper(aInfo).countServices(); }
- protected:
+ private:
// creates a new session
void implConnect(OProviderImpl& rFreshProviderImpl, const ContextReader& _rSettings) throw (uno::Exception);
- protected:
// disambuiguated access
cppu::OBroadcastHelper & getBroadcastHelper()
{ return ServiceComponentImpl::rBHelper; }
@@ -134,9 +171,14 @@ namespace configmgr
virtual void SAL_CALL disposing();
virtual void SAL_CALL disposing(lang::EventObject const& rEvt) throw();
+ // OPropertyArrayUsageHelper
+ virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const;
+
+ // OPropertySetHelper
+ virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper();
// OPropertyContainer
- void registerProperty(const OUString& _rName, sal_Int32 _nHandle, sal_Int32 _nAttributes,
+ void registerProperty(const rtl::OUString& _rName, sal_Int32 _nHandle, sal_Int32 _nAttributes,
void* _pPointerToMember, const uno::Type& _rMemberType)
{ OPropertyContainer::registerProperty(_rName, _nHandle, _nAttributes, _pPointerToMember, _rMemberType);}
@@ -147,7 +189,6 @@ namespace configmgr
uno::Any SAL_CALL queryPropertyInterface(uno::Type const& rType) throw (uno::RuntimeException)
{ return OPropertyContainer::queryInterface(rType);}
- private:
void attachToContext();
uno::Reference< lang::XComponent > releaseContext();
void discardContext(uno::Reference< lang::XComponent > const & xContext);
diff --git a/configmgr/source/api2/providerimpl.cxx b/configmgr/source/api2/providerimpl.cxx
index f5e7c37074..2c1e559d26 100644
--- a/configmgr/source/api2/providerimpl.cxx
+++ b/configmgr/source/api2/providerimpl.cxx
@@ -38,16 +38,13 @@
#include "apitreeimplobj.hxx"
#include "apitreeaccess.hxx"
#include "roottree.hxx"
+#include "node.hxx"
#include "noderef.hxx"
#include "objectregistry.hxx"
#include "bootstrap.hxx"
#include "cachefactory.hxx"
#include "provider.hxx"
-#include "treeprovider.hxx"
#include "treemanager.hxx"
-#include "treeaccessor.hxx"
-#include "groupnodeaccess.hxx"
-#include "valuenodeaccess.hxx"
#include "tracer.hxx"
#include <osl/interlck.h>
#include <com/sun/star/beans/PropertyValue.hpp>
@@ -63,17 +60,13 @@ namespace configmgr
namespace css = ::com::sun::star;
namespace uno = css::uno;
namespace beans = css::beans;
- using ::rtl::OUString;
- using configapi::NodeElement;
- using configuration::RootTree;
-
namespace configapi
{
class ApiProviderInstances
{
- ObjectRegistryHolder m_aObjectRegistry;
+ rtl::Reference<ObjectRegistry> m_aObjectRegistry;
ReadOnlyObjectFactory m_aReaderFactory;
UpdateObjectFactory m_aWriterFactory;
ApiProvider m_aReaderProvider;
@@ -104,7 +97,7 @@ namespace configmgr
//= OProviderImpl
//=============================================================================
//-----------------------------------------------------------------------------
- OProviderImpl::OProviderImpl(OProvider* _pProvider, CreationContext const & _xContext)
+ OProviderImpl::OProviderImpl(OProvider* _pProvider, uno::Reference< uno::XComponentContext > const & _xContext)
:m_pProvider(_pProvider)
,m_xTypeConverter()
,m_aDefaultOptions()
@@ -118,32 +111,32 @@ namespace configmgr
OSL_ENSURE(xFactory.is(), "OProviderImpl : missing service factory !");
m_xTypeConverter = m_xTypeConverter.query(
- xFactory->createInstanceWithContext( OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.script.Converter" )),
+ xFactory->createInstanceWithContext( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.script.Converter" )),
_xContext));
OSL_ENSURE(m_xTypeConverter.is(), "Module::Module : could not create an instance of the type converter !");
}
//-----------------------------------------------------------------------------
- rtl::Reference< TreeManager > OProviderImpl::maybeGetTreeManager() const CFG_NOTHROW()
+ rtl::Reference< TreeManager > OProviderImpl::maybeGetTreeManager() const SAL_THROW(())
{
osl::MutexGuard aGuard(m_aTreeManagerMutex);
rtl::Reference< TreeManager > xResult(m_pTreeManager);
return xResult;
}
//-----------------------------------------------------------------------------
- rtl::Reference< TreeManager > OProviderImpl::getTreeManager() const CFG_UNO_THROW_RTE()
+ rtl::Reference< TreeManager > OProviderImpl::getTreeManager() const SAL_THROW((com::sun::star::uno::RuntimeException))
{
osl::MutexGuard aGuard(m_aTreeManagerMutex);
if (m_pTreeManager == NULL)
{
- OUString sMsg = OUString::createFromAscii("OProviderImpl: No cache available - provider was already disposed.");
+ rtl::OUString sMsg = rtl::OUString::createFromAscii("OProviderImpl: No cache available - provider was already disposed.");
throw com::sun::star::lang::DisposedException(sMsg,static_cast<lang::XMultiServiceFactory*>(m_pProvider));
}
rtl::Reference< TreeManager > xResult(m_pTreeManager);
return xResult;
}
//-----------------------------------------------------------------------------
- void OProviderImpl::setTreeManager(TreeManager * pTreeManager) CFG_UNO_THROW_RTE()
+ void OProviderImpl::setTreeManager(TreeManager * pTreeManager) SAL_THROW((com::sun::star::uno::RuntimeException))
{
osl::MutexGuard aGuard(m_aTreeManagerMutex);
@@ -152,14 +145,14 @@ namespace configmgr
if (pTreeManager == NULL)
{
- OUString sMsg = OUString::createFromAscii("OProviderImpl: No cache available - cache creation failed.");
+ rtl::OUString sMsg = rtl::OUString::createFromAscii("OProviderImpl: No cache available - cache creation failed.");
throw com::sun::star::uno::RuntimeException(sMsg,NULL);
}
(m_pTreeManager = pTreeManager) -> acquire();
}
//-----------------------------------------------------------------------------
- void OProviderImpl::clearTreeManager() CFG_NOTHROW()
+ void OProviderImpl::clearTreeManager() SAL_THROW(())
{
osl::ClearableMutexGuard aGuard(m_aTreeManagerMutex);
if (TreeManager * pTM = m_pTreeManager)
@@ -181,7 +174,7 @@ namespace configmgr
}
else
{
- throw com::sun::star::uno::RuntimeException(OUString::createFromAscii("OProviderImpl: Only UNO Backends Supported"),NULL);
+ throw com::sun::star::uno::RuntimeException(rtl::OUString::createFromAscii("OProviderImpl: Only UNO Backends Supported"),NULL);
}
setTreeManager( xNewTreeManager.get() );
@@ -195,12 +188,12 @@ namespace configmgr
try
{
static ::rtl::OUString ssUserProfile(RTL_CONSTASCII_USTRINGPARAM("org.openoffice.Setup"));
- AbsolutePath aProfileModule = AbsolutePath::makeModulePath(ssUserProfile, AbsolutePath::NoValidate());
+ configuration::AbsolutePath aProfileModule = configuration::AbsolutePath::makeModulePath(ssUserProfile);
- data::NodeAccess aProfileTree = xNewTreeManager->requestSubtree(aProfileModule, m_aDefaultOptions);
- if (aProfileTree.isValid())
+ sharable::Node * profileTree = xNewTreeManager->requestSubtree(aProfileModule, m_aDefaultOptions);
+ if (profileTree != 0)
{
- implInitFromProfile(aProfileTree);
+ implInitFromProfile(profileTree);
// should we clean this up ?
// xNewTreeManager->releaseSubtree(aProfileModule, xTempOptions);
@@ -222,7 +215,7 @@ namespace configmgr
{
}
//-----------------------------------------------------------------------------
- void OProviderImpl::initFromProfile(data::NodeAccess const& )
+ void OProviderImpl::initFromProfile(sharable::Node *)
{
}
//-----------------------------------------------------------------------------
@@ -258,31 +251,29 @@ namespace configmgr
rNeedProfile = true; // to get locale
}
//-----------------------------------------------------------------------------
- void OProviderImpl::implInitFromProfile(data::NodeAccess const& aProfile)
+ void OProviderImpl::implInitFromProfile(sharable::Node * profile)
{
- OSL_ASSERT(aProfile.isValid());
+ OSL_ASSERT(profile != 0);
- data::GroupNodeAccess aProfileNode( aProfile );
+ sharable::GroupNode * profileNode = sharable::GroupNode::from(profile);
- OSL_ASSERT(aProfileNode.isValid());
+ OSL_ASSERT(profileNode != 0);
// read the default locale for the user
if (!m_aDefaultOptions.hasLocale())
{
- using configuration::Name;
- using configuration::makeNodeName;
- static Name ssSubGroup = makeNodeName(OUString(RTL_CONSTASCII_USTRINGPARAM("L10N")), Name::NoValidate());
- static Name ssLocale = makeNodeName(OUString(RTL_CONSTASCII_USTRINGPARAM("ooLocale")), Name::NoValidate());
+ static rtl::OUString ssSubGroup(RTL_CONSTASCII_USTRINGPARAM("L10N"));
+ static rtl::OUString ssLocale(RTL_CONSTASCII_USTRINGPARAM("ooLocale"));
- data::GroupNodeAccess aL10NNode( aProfileNode.getChildNode(ssSubGroup) );
- if (aL10NNode.isValid())
+ sharable::GroupNode * l10nNode = sharable::GroupNode::from(profileNode->getChild(ssSubGroup));
+ if (l10nNode != 0)
{
- data::ValueNodeAccess aValue( aL10NNode.getChildNode(ssLocale) );
+ sharable::ValueNode * value = sharable::ValueNode::from(l10nNode->getChild(ssLocale));
- if (aValue.isValid())
+ if (value != 0)
{
rtl::OUString sDefaultLocale;
- if (aValue.getValue() >>= sDefaultLocale)
+ if (value->getValue() >>= sDefaultLocale)
{
m_aDefaultOptions.setIsoLocale(sDefaultLocale);
}
@@ -293,14 +284,14 @@ namespace configmgr
}
// call the template method
- this->initFromProfile(aProfile);
+ this->initFromProfile(profile);
// last fallback, if there is no locale - even in ooLocale
m_aDefaultOptions.ensureLocaleSet();
}
//-----------------------------------------------------------------------------
- void OProviderImpl::setDefaultLocale( RequestOptions::Locale const & aLocale )
+ void OProviderImpl::setDefaultLocale( com::sun::star::lang::Locale const & aLocale )
{
m_aDefaultOptions.setLocale( aLocale );
// ensure that the locale is never cleared to 'empty'
@@ -338,38 +329,30 @@ namespace configmgr
//-----------------------------------------------------------------------------
// access to the raw notifications
- IConfigBroadcaster* OProviderImpl::getNotifier() CFG_NOTHROW()
+ TreeManager * OProviderImpl::getNotifier() SAL_THROW(())
{
rtl::Reference< TreeManager > xTM = maybeGetTreeManager();
- return xTM.is() ? xTM->getBroadcaster() : NULL;
+ return xTM.get();
}
// DefaultProvider access
//-----------------------------------------------------------------------------
- rtl::Reference< IConfigDefaultProvider > OProviderImpl::getDefaultProvider() const CFG_UNO_THROW_RTE( )
- {
- return getTreeManager().get();
- }
-
- // TemplateManager access
- //-----------------------------------------------------------------------------
- rtl::Reference< IConfigTemplateManager > OProviderImpl::getTemplateProvider() const CFG_UNO_THROW_RTE( )
+ rtl::Reference< TreeManager > OProviderImpl::getDefaultProvider() const SAL_THROW((com::sun::star::uno::RuntimeException))
{
return getTreeManager().get();
}
- // ITreeProvider /ITreeManager
//-----------------------------------------------------------------------------
- data::NodeAccess OProviderImpl::requestSubtree( AbsolutePath const& aSubtreePath,
+ sharable::Node * OProviderImpl::requestSubtree( configuration::AbsolutePath const& aSubtreePath,
RequestOptions const & _aOptions
- ) CFG_UNO_THROW_ALL( )
+ ) SAL_THROW((com::sun::star::uno::Exception))
{
rtl::Reference< TreeManager > xTreeManager = getTreeManager();
- data::NodeAccess aTree( NULL );
+ sharable::Node * tree = 0;
try
{
- aTree = xTreeManager->requestSubtree(aSubtreePath, _aOptions);
+ tree = xTreeManager->requestSubtree(aSubtreePath, _aOptions);
}
catch(uno::Exception&e)
{
@@ -381,7 +364,7 @@ namespace configmgr
throw lang::WrappedTargetException(sMessage, getProviderInstance(), uno::makeAny(e));
}
- if (!aTree.isValid())
+ if (tree == 0)
{
::rtl::OUString sMessage = getErrorMessage(aSubtreePath, _aOptions);
@@ -390,17 +373,17 @@ namespace configmgr
throw uno::Exception(sMessage, getProviderInstance());
}
- return aTree;
+ return tree;
}
//-----------------------------------------------------------------------------
- void OProviderImpl::updateTree(TreeChangeList& aChanges) CFG_UNO_THROW_ALL( )
+ void OProviderImpl::updateTree(TreeChangeList& aChanges) SAL_THROW((com::sun::star::uno::Exception))
{
getTreeManager()->updateTree(aChanges);
}
//-----------------------------------------------------------------------------
- void OProviderImpl::releaseSubtree( AbsolutePath const& aSubtreePath, RequestOptions const& _aOptions ) CFG_NOTHROW()
+ void OProviderImpl::releaseSubtree( configuration::AbsolutePath const& aSubtreePath, RequestOptions const& _aOptions ) SAL_THROW(())
{
rtl::Reference< TreeManager > xTM = maybeGetTreeManager();
if (xTM.is())
@@ -408,21 +391,13 @@ namespace configmgr
}
//-----------------------------------------------------------------------------
- void OProviderImpl::disposeData(RequestOptions const& _aOptions) CFG_NOTHROW()
- {
- rtl::Reference< TreeManager > xTM = maybeGetTreeManager();
- if (xTM.is())
- xTM->disposeData(_aOptions);
- }
-
- //-----------------------------------------------------------------------------
- void OProviderImpl::saveAndNotifyUpdate(TreeChangeList const& aChanges) CFG_UNO_THROW_ALL( )
+ void OProviderImpl::saveAndNotifyUpdate(TreeChangeList const& aChanges) SAL_THROW((com::sun::star::uno::Exception))
{
getTreeManager()->saveAndNotifyUpdate(aChanges);
}
//-----------------------------------------------------------------------------
- void OProviderImpl::fetchSubtree(AbsolutePath const& aSubtreePath, RequestOptions const& _aOptions) CFG_NOTHROW()
+ void OProviderImpl::fetchSubtree(configuration::AbsolutePath const& aSubtreePath, RequestOptions const& _aOptions) SAL_THROW(())
{
rtl::Reference< TreeManager > xTM = maybeGetTreeManager();
if (xTM.is())
@@ -430,26 +405,25 @@ namespace configmgr
}
//-----------------------------------------------------------------------------
- sal_Bool OProviderImpl::fetchDefaultData(AbsolutePath const& aSubtreePath, RequestOptions const& _aOptions) CFG_UNO_THROW_ALL( )
+ sal_Bool OProviderImpl::fetchDefaultData(configuration::AbsolutePath const& aSubtreePath, RequestOptions const& _aOptions) SAL_THROW((com::sun::star::uno::Exception))
{
return getTreeManager()->fetchDefaultData(aSubtreePath, _aOptions);
}
//-----------------------------------------------------------------------------------
- void OProviderImpl::refreshAll()CFG_UNO_THROW_ALL( )
+ void OProviderImpl::refreshAll()SAL_THROW((com::sun::star::uno::Exception))
{
m_pTreeManager->refreshAll();
}
//-----------------------------------------------------------------------------------
- void OProviderImpl::flushAll()CFG_NOTHROW()
+ void OProviderImpl::flushAll()SAL_THROW(())
{
m_pTreeManager->flushAll();
}
//-----------------------------------------------------------------------------------
- void OProviderImpl::enableAsync(const sal_Bool& bEnableAsync) CFG_NOTHROW()
+ void OProviderImpl::enableAsync(const sal_Bool& bEnableAsync) SAL_THROW(())
{
m_pTreeManager->enableAsync(bEnableAsync);
}
- // IInterface
//-----------------------------------------------------------------------------
void SAL_CALL OProviderImpl::acquire( ) throw ()
{
@@ -469,9 +443,9 @@ namespace configmgr
}
//-----------------------------------------------------------------------------------
- OUString OProviderImpl::getErrorMessage(AbsolutePath const& _rAccessor, RequestOptions const& _aOptions)
+ rtl::OUString OProviderImpl::getErrorMessage(configuration::AbsolutePath const& _rAccessor, RequestOptions const& _aOptions)
{
- OUString const sAccessor = _rAccessor.toString();
+ rtl::OUString const sAccessor = _rAccessor.toString();
CFG_TRACE_ERROR("config provider: the cache manager could not provide the tree (neither from the cache nor from the session)");
::rtl::OUString sMessage;
@@ -500,7 +474,7 @@ namespace configmgr
// actual factory methods
//-----------------------------------------------------------------------------------
- NodeElement* OProviderImpl::buildReadAccess(OUString const& _rAccessor, RequestOptions const& _aOptions, sal_Int32 nMinLevels) CFG_UNO_THROW_ALL( )
+ configapi::NodeElement* OProviderImpl::buildReadAccess(rtl::OUString const& _rAccessor, RequestOptions const& _aOptions, sal_Int32 nMinLevels) SAL_THROW((com::sun::star::uno::Exception))
{
CFG_TRACE_INFO("config provider: requesting the tree from the cache manager");
@@ -511,21 +485,19 @@ namespace configmgr
try
{
- using namespace configuration;
-
- AbsolutePath aAccessorPath = AbsolutePath::parse(_rAccessor);
+ configuration::AbsolutePath aAccessorPath = configuration::AbsolutePath::parse(_rAccessor);
- data::NodeAccess aTree = this->requestSubtree(aAccessorPath,_aOptions);
+ sharable::Node * tree = requestSubtree(aAccessorPath,_aOptions);
RTL_LOGFILE_CONTEXT_TRACE(aLog, "data loaded" );
- TreeDepth nDepth = (nMinLevels == treeop::ALL_LEVELS) ? C_TreeDepthAll : TreeDepth(nMinLevels);
+ unsigned int nDepth = (nMinLevels == treeop::ALL_LEVELS) ? configuration::C_TreeDepthAll : (unsigned int)(nMinLevels);
RTL_LOGFILE_CONTEXT_AUTHOR(aLog2, "configmgr::OProviderImpl", "jb99855", "configmgr: createReadOnlyTree()");
- RootTree aRootTree( createReadOnlyTree(
- aAccessorPath, aTree, nDepth,
- TemplateProvider( this->getTemplateProvider(), _aOptions )
+ rtl::Reference< configuration::Tree > aRootTree( configuration::createReadOnlyTree(
+ aAccessorPath, tree, nDepth,
+ configuration::TemplateProvider( getTreeManager(), _aOptions )
));
return m_pNewProviders->getReaderFactory().makeAccessRoot(aRootTree, _aOptions);
@@ -541,8 +513,8 @@ namespace configmgr
//-----------------------------------------------------------------------------------
- NodeElement* OProviderImpl::buildUpdateAccess(OUString const& _rAccessor, RequestOptions const& _aOptions,
- sal_Int32 nMinLevels) CFG_UNO_THROW_ALL( )
+ configapi::NodeElement* OProviderImpl::buildUpdateAccess(rtl::OUString const& _rAccessor, RequestOptions const& _aOptions,
+ sal_Int32 nMinLevels) SAL_THROW((com::sun::star::uno::Exception))
{
CFG_TRACE_INFO("config provider: requesting the tree from the cache manager");
OSL_ASSERT(sal_Int16(nMinLevels) == nMinLevels);
@@ -552,21 +524,19 @@ namespace configmgr
try
{
- using namespace configuration;
+ configuration::AbsolutePath aAccessorPath = configuration::AbsolutePath::parse(_rAccessor);
- AbsolutePath aAccessorPath = AbsolutePath::parse(_rAccessor);
-
- data::NodeAccess aTree = requestSubtree(aAccessorPath, _aOptions);
+ sharable::Node * tree = requestSubtree(aAccessorPath, _aOptions);
RTL_LOGFILE_CONTEXT_TRACE(aLog, "data loaded" );
- TreeDepth nDepth = (nMinLevels == treeop::ALL_LEVELS) ? C_TreeDepthAll : TreeDepth(nMinLevels);
+ unsigned int nDepth = (nMinLevels == treeop::ALL_LEVELS) ? configuration::C_TreeDepthAll : (unsigned int)(nMinLevels);
RTL_LOGFILE_CONTEXT_AUTHOR(aLog2, "configmgr::OProviderImpl", "jb99855", "createUpdatableTree()");
- RootTree aRootTree( createUpdatableTree(
- aAccessorPath, aTree, nDepth,
- TemplateProvider( this->getTemplateProvider(), _aOptions )
+ rtl::Reference< configuration::Tree > aRootTree( configuration::createUpdatableTree(
+ aAccessorPath, tree, nDepth,
+ configuration::TemplateProvider( getTreeManager(), _aOptions )
));
@@ -601,16 +571,14 @@ namespace configmgr
OProviderImpl::FactoryArguments::Argument
OProviderImpl::FactoryArguments::lookupArgument(const rtl::OUString& rName)
- CFG_NOTHROW()
+ SAL_THROW(())
{
- OUString sCheck( rName.toAsciiLowerCase() );
+ rtl::OUString sCheck( rName.toAsciiLowerCase() );
- typedef sal_Char const * const * ArgNameIter;
-
- ArgNameIter const pFirst = asciiArgumentNames;
- ArgNameIter const pLast = pFirst + _arg_count;
+ sal_Char const * const * const pFirst = asciiArgumentNames;
+ sal_Char const * const * const pLast = pFirst + _arg_count;
- ArgNameIter it = pFirst;
+ sal_Char const * const * it = pFirst;
for(; it != pLast; ++it)
{
@@ -626,17 +594,17 @@ namespace configmgr
//-----------------------------------------------------------------------------------
bool OProviderImpl::FactoryArguments::extractOneArgument(
- OUString const& aName, uno::Any const& aValue,
- OUString& /* [out] */ _rNodeAccessor,
+ rtl::OUString const& aName, uno::Any const& aValue,
+ rtl::OUString& /* [out] */ _rNodeAccessor,
sal_Int32& /* [out] */ _nLevels,
RequestOptions& /* [in/out] */ _rOptions )
- CFG_NOTHROW()
+ SAL_THROW(())
{
switch ( lookupArgument(aName) )
{
case ARG_NODEPATH:
{
- OUString sStringVal;
+ rtl::OUString sStringVal;
if (aValue >>= sStringVal)
_rNodeAccessor = sStringVal;
else
@@ -657,7 +625,7 @@ namespace configmgr
case ARG_ENTITY:
case ARG_USER_DEPRECATED:
{
- OUString sStringVal;
+ rtl::OUString sStringVal;
if (aValue >>= sStringVal)
_rOptions.setEntity(sStringVal);
else
@@ -667,7 +635,7 @@ namespace configmgr
case ARG_LOCALE:
{
- OUString sStringVal;
+ rtl::OUString sStringVal;
if (aValue >>= sStringVal)
{
_rOptions.setIsoLocale(sStringVal);
@@ -737,7 +705,7 @@ namespace configmgr
//-----------------------------------------------------------------------------------
static
void failInvalidArg(uno::Any const & aArg, sal_Int32 _nArg = -1)
- CFG_THROW1 (lang::IllegalArgumentException)
+ SAL_THROW((lang::IllegalArgumentException))
{
OSL_ENSURE( sal_Int16(_nArg) == _nArg, "Argument number out of range. Raising imprecise exception.");
@@ -754,8 +722,8 @@ namespace configmgr
//-----------------------------------------------------------------------------------
static
- void failInvalidArgValue(OUString const & aName, uno::Any const & aValue, sal_Int32 _nArg = -1)
- CFG_THROW1 (lang::IllegalArgumentException)
+ void failInvalidArgValue(rtl::OUString const & aName, uno::Any const & aValue, sal_Int32 _nArg = -1)
+ SAL_THROW((lang::IllegalArgumentException))
{
OSL_ENSURE( sal_Int16(_nArg) == _nArg, "Argument number out of range. Raising imprecise exception.");
@@ -772,9 +740,9 @@ namespace configmgr
//-----------------------------------------------------------------------------------
static
bool extractLegacyArguments( const uno::Sequence<uno::Any>& _rArgs,
- OUString& /* [out] */ _rNodeAccessor,
+ rtl::OUString& /* [out] */ _rNodeAccessor,
sal_Int32& /* [out] */ _nLevels )
- CFG_THROW1 (lang::IllegalArgumentException)
+ SAL_THROW((lang::IllegalArgumentException))
{
OSL_ASSERT( _rArgs.getLength() != 0 );
@@ -801,7 +769,7 @@ namespace configmgr
{
// valid second argument, but too many arguments altogether
throw lang::IllegalArgumentException(
- OUString(RTL_CONSTASCII_USTRINGPARAM(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
"Configuration Provider: Too many arguments. "
"Additional arguments are not supported when passing the node path as string (deprecated convention).")),
uno::Reference<uno::XInterface>(),
@@ -817,7 +785,7 @@ namespace configmgr
if (_rArgs[1].getValueTypeClass() != uno::TypeClass_STRUCT)
{
// completely invalid second argument
- failInvalidArgValue(OUString::createFromAscii("<depth>"),_rArgs[1],1);
+ failInvalidArgValue(rtl::OUString::createFromAscii("<depth>"),_rArgs[1],1);
}
// Assume PropertyValue or NamedValue,
@@ -827,10 +795,10 @@ namespace configmgr
//-----------------------------------------------------------------------------------
void OProviderImpl::FactoryArguments::extractArgs( const uno::Sequence<uno::Any>& _rArgs,
- OUString& /* [out] */ _rNodeAccessor,
+ rtl::OUString& /* [out] */ _rNodeAccessor,
sal_Int32& /* [out] */ _nLevels,
RequestOptions & /* [in/out] */ _aOptions )
- CFG_THROW1 (lang::IllegalArgumentException)
+ SAL_THROW((lang::IllegalArgumentException))
{
UnoApiLock aLock;
@@ -864,10 +832,74 @@ namespace configmgr
if (_rNodeAccessor.getLength() == 0)
{
- OUString sMessage(RTL_CONSTASCII_USTRINGPARAM("Configuration Provider: Missing argument: no nodepath was provided"));
+ rtl::OUString sMessage(RTL_CONSTASCII_USTRINGPARAM("Configuration Provider: Missing argument: no nodepath was provided"));
throw lang::IllegalArgumentException(sMessage,uno::Reference<uno::XInterface>(),0);
}
}
+
+ //--------------------------------------------------------------------------
+ uno::Reference<uno::XInterface> OProviderImpl::createReadAccess( uno::Sequence<uno::Any> const& aArgs)
+ SAL_THROW((com::sun::star::uno::Exception))
+ {
+ CFG_TRACE_INFO("config provider: going to create a read access instance");
+
+ // extract the args
+ rtl::OUString sPath;
+ sal_Int32 nLevels;
+
+ RequestOptions aOptions = getDefaultOptions();
+
+ OProviderImpl::FactoryArguments::extractArgs(aArgs, sPath, nLevels, aOptions);
+
+ CFG_TRACE_INFO_NI("config provider: node accessor extracted from the args is %s", OUSTRING2ASCII(sPath));
+ CFG_TRACE_INFO_NI("config provider: level depth extracted from the args is %i", nLevels);
+
+ // create the access object
+ uno::Reference< uno::XInterface > xReturn;
+
+ configapi::NodeElement* pElement = buildReadAccess(sPath, aOptions, nLevels);
+ if (pElement != 0)
+ {
+ xReturn = pElement->getUnoInstance();
+ if (xReturn.is())
+ // acquired once by buildReadAccess
+ xReturn->release();
+ }
+
+ return xReturn;
+ }
+
+ //-----------------------------------------------------------------------------------
+ uno::Reference<uno::XInterface> OProviderImpl::createUpdateAccess( uno::Sequence<uno::Any> const& aArgs)
+ SAL_THROW((com::sun::star::uno::Exception))
+ {
+ CFG_TRACE_INFO("config provider: going to create an update access instance");
+
+ // extract the args
+ rtl::OUString sPath;
+ sal_Int32 nLevels;
+
+ RequestOptions aOptions = getDefaultOptions();
+
+ OProviderImpl::FactoryArguments::extractArgs(aArgs, sPath, nLevels, aOptions);
+
+ CFG_TRACE_INFO_NI("config provider: node accessor extracted from the args is %s", OUSTRING2ASCII(sPath));
+ CFG_TRACE_INFO_NI("config provider: level depth extracted from the args is %i", nLevels);
+
+ // create the access object
+ uno::Reference< uno::XInterface > xReturn;
+
+ configapi::NodeElement* pElement = buildUpdateAccess(sPath, aOptions, nLevels);
+ if (pElement != 0)
+ {
+ xReturn = pElement->getUnoInstance();
+ if (xReturn.is())
+ // acquired once by buildReadAccess
+ xReturn->release();
+ }
+
+ return xReturn;
+ }
//-----------------------------------------------------------------------------------
diff --git a/configmgr/source/api2/providerimpl.hxx b/configmgr/source/api2/providerimpl.hxx
index 1154c3ad90..3c7c4f8978 100644
--- a/configmgr/source/api2/providerimpl.hxx
+++ b/configmgr/source/api2/providerimpl.hxx
@@ -31,9 +31,7 @@
#ifndef CONFIGMGR_API_PROVIDERIMPL_HXX_
#define CONFIGMGR_API_PROVIDERIMPL_HXX_
-#include "treeprovider.hxx"
#include "defaultprovider.hxx"
-#include "commontypes.hxx" // IInterface
#include "requestoptions.hxx"
#include <com/sun/star/uno/XComponentContext.hpp>
#include <com/sun/star/script/XTypeConverter.hpp>
@@ -69,29 +67,25 @@ namespace configmgr
namespace script = css::script;
namespace lang = css::lang;
namespace beans = css::beans;
- using ::rtl::OUString;
class ISubtree;
- class ITemplateManager;
- class IConfigDefaultProvider;
+ struct TreeChangeList;
class TreeManager;
class ContextReader;
class OProvider;
- struct IConfigBroadcaster;
-
namespace configapi
{
class NodeElement;
class ApiProviderInstances;
class Factory;
}
+ namespace sharable { union Node; }
// -----------------------------------------------------------------------------
- class OProviderImpl : public ITreeManager, public IDefaultableTreeManager, public IInterface
+ class OProviderImpl : public IDefaultableTreeManager
{
friend class OProvider;
- friend class OConfigurationProvider;
public:
//==========================================================================
//= FactoryArguments
@@ -117,7 +111,7 @@ namespace configmgr
};
static sal_Char const * const asciiArgumentNames[];
- static Argument lookupArgument(OUString const& sArgumentName) CFG_NOTHROW();
+ static Argument lookupArgument(rtl::OUString const& sArgumentName) SAL_THROW(());
public:
/** extracts arguments from the argument sequence into to the parameter variables
@@ -130,94 +124,108 @@ namespace configmgr
or if no non-empty node path argument could be extracted,
*/
static void extractArgs( const uno::Sequence<uno::Any>& _rArgs,
- OUString& /* [out] */ _rNodeAccessor,
+ rtl::OUString& /* [out] */ _rNodeAccessor,
sal_Int32& /* [out] */ _nLevels,
- RequestOptions& /* [in/out] */ xOptions
- ) CFG_THROW1(lang::IllegalArgumentException);
+ RequestOptions& /* [in/out] */ xOptions)
+ SAL_THROW((lang::IllegalArgumentException));
- static bool extractOneArgument( OUString const& aName, uno::Any const& aValue,
- OUString& /* [out] */ _rNodeAccessor,
+ static bool extractOneArgument( rtl::OUString const& aName, uno::Any const& aValue,
+ rtl::OUString& /* [out] */ _rNodeAccessor,
sal_Int32& /* [out] */ _nLevels,
RequestOptions& /* [in/out] */ xOptions
- ) CFG_NOTHROW();
+ ) SAL_THROW(());
};
- public:
- typedef uno::Reference< uno::XComponentContext > CreationContext;
- typedef uno::Reference< script::XTypeConverter > TypeConverterRef;
private:
OProvider* m_pProvider; /// used for ref counting, uno representation
- TypeConverterRef m_xTypeConverter;
+ uno::Reference< script::XTypeConverter > m_xTypeConverter;
RequestOptions m_aDefaultOptions;
configapi::ApiProviderInstances* m_pNewProviders;
mutable osl::Mutex m_aTreeManagerMutex;
TreeManager* m_pTreeManager; /// the tree cache. Will hold a reference to us as long as it life
- rtl::Reference< TreeManager > maybeGetTreeManager() const CFG_NOTHROW();
- rtl::Reference< TreeManager > getTreeManager() const CFG_UNO_THROW_RTE();
- void setTreeManager(TreeManager * pTreeManager) CFG_UNO_THROW_RTE();
- void clearTreeManager() CFG_NOTHROW();
- public:
- OProviderImpl(OProvider* _pProvider, CreationContext const & _xContext);
+ rtl::Reference< TreeManager > maybeGetTreeManager() const SAL_THROW(());
+ rtl::Reference< TreeManager > getTreeManager() const SAL_THROW((com::sun::star::uno::RuntimeException));
+ void setTreeManager(TreeManager * pTreeManager) SAL_THROW((com::sun::star::uno::RuntimeException));
+ void clearTreeManager() SAL_THROW(());
-
+ OProviderImpl(OProvider* _pProvider,
+ uno::Reference< uno::XComponentContext > const & xContext);
+
+ public:
virtual ~OProviderImpl();
- /// ITreeManager
- virtual data::NodeAccess requestSubtree(AbsolutePath const& aSubtreePath, const RequestOptions& _aOptions) CFG_UNO_THROW_ALL( );
- virtual void updateTree(TreeChangeList& aChanges) CFG_UNO_THROW_ALL( );
+ /** request that the tree named by a path is added to the collection of managed trees
+ respecting certain options and requiring a specific loading depth.
+ Return a reference to that managed tree.
+ The reference must later be released by calling releaseSubtree with the same path and options.
+ */
+ sharable::Node * requestSubtree(configuration::AbsolutePath const& aSubtreePath, const RequestOptions& _aOptions) SAL_THROW((com::sun::star::uno::Exception));
- virtual void releaseSubtree( AbsolutePath const& aSubtreePath, const RequestOptions& _aOptions ) CFG_NOTHROW();
- virtual void saveAndNotifyUpdate(TreeChangeList const& aChanges) CFG_UNO_THROW_ALL( );
- virtual void disposeData(const RequestOptions& _aOptions) CFG_NOTHROW();
- virtual void fetchSubtree(AbsolutePath const& aSubtreePath, const RequestOptions& _aOptions) CFG_NOTHROW();
-
- virtual void refreshAll() CFG_UNO_THROW_ALL( );
- virtual void flushAll() CFG_NOTHROW();
- virtual void enableAsync(const sal_Bool& bEnableAsync) CFG_NOTHROW();
+ /// update the managed data according to a changes list - update the changes list accordingly with old values
+ void updateTree(TreeChangeList& aChanges) SAL_THROW((com::sun::star::uno::Exception));
+
+ // bookkeeping support
+ void releaseSubtree( configuration::AbsolutePath const& aSubtreePath, const RequestOptions& _aOptions ) SAL_THROW(());
+
+ // notification
+ void saveAndNotifyUpdate(TreeChangeList const& aChanges) SAL_THROW((com::sun::star::uno::Exception));
+
+ /** request that the tree named by a path is added to the collection of managed trees
+ respecting certain options and requiring a specific loading depth.
+ */
+ void fetchSubtree(configuration::AbsolutePath const& aSubtreePath, const RequestOptions& _aOptions) SAL_THROW(());
+
+ //Refresh all components in the cache
+ void refreshAll() SAL_THROW((com::sun::star::uno::Exception));
+
+ //Flush all components in the cache
+ void flushAll() SAL_THROW(());
+
+ //Enable/Disable Asynchronous write-back to cache
+ void enableAsync(const sal_Bool& bEnableAsync) SAL_THROW(());
/// IDefaultableTreeManager
- virtual sal_Bool fetchDefaultData(AbsolutePath const& aSubtreePath, const RequestOptions& _aOptions
- ) CFG_UNO_THROW_ALL( );
+ virtual sal_Bool fetchDefaultData(configuration::AbsolutePath const& aSubtreePath, const RequestOptions& _aOptions
+ ) SAL_THROW((com::sun::star::uno::Exception));
- // IInterface
- virtual void SAL_CALL acquire( ) throw ();
- virtual void SAL_CALL release( ) throw ();
+ void SAL_CALL acquire( ) throw ();
+ void SAL_CALL release( ) throw ();
// DefaultProvider access
- rtl::Reference< IConfigDefaultProvider > getDefaultProvider() const CFG_UNO_THROW_RTE( );
+ rtl::Reference< TreeManager > getDefaultProvider() const SAL_THROW((com::sun::star::uno::RuntimeException));
- // TemplateManager access
- rtl::Reference< IConfigTemplateManager > getTemplateProvider() const CFG_UNO_THROW_RTE( );
-
protected:
- static OUString getErrorMessage(AbsolutePath const& _rAccessor, const RequestOptions& _aOptions);
+ static rtl::OUString getErrorMessage(configuration::AbsolutePath const& _rAccessor, const RequestOptions& _aOptions);
- virtual void SAL_CALL dispose() throw();
+ void SAL_CALL dispose() throw();
public:
- void setDefaultLocale( RequestOptions::Locale const & aLocale );
+ void setDefaultLocale( com::sun::star::lang::Locale const & aLocale );
RequestOptions const& getDefaultOptions() const {return m_aDefaultOptions;}
- TypeConverterRef getTypeConverter() const {return m_xTypeConverter;}
- IConfigBroadcaster* getNotifier() CFG_NOTHROW();
+ uno::Reference< script::XTypeConverter > getTypeConverter() const {return m_xTypeConverter;}
+ TreeManager * getNotifier() SAL_THROW(());
uno::XInterface* getProviderInstance();
// actual factory methods
// the returned object (if any) has to be acquired once)
- configapi::NodeElement* buildReadAccess( OUString const& _rAccessor, const RequestOptions& _aOptions, sal_Int32 nMinLevels) CFG_UNO_THROW_ALL( );
+ configapi::NodeElement* buildReadAccess( rtl::OUString const& _rAccessor, const RequestOptions& _aOptions, sal_Int32 nMinLevels) SAL_THROW((com::sun::star::uno::Exception));
// the returned object (if any) has to be acquired once)
- configapi::NodeElement* buildUpdateAccess(OUString const& _rAccessor, const RequestOptions& _aOptions, sal_Int32 nMinLevels) CFG_UNO_THROW_ALL( );
+ configapi::NodeElement* buildUpdateAccess(rtl::OUString const& _rAccessor, const RequestOptions& _aOptions, sal_Int32 nMinLevels) SAL_THROW((com::sun::star::uno::Exception));
+ // factory methods
+ uno::Reference<uno::XInterface> createReadAccess( uno::Sequence<uno::Any> const& aArgs) SAL_THROW((com::sun::star::uno::Exception));
+ uno::Reference<uno::XInterface> createUpdateAccess( uno::Sequence<uno::Any> const& aArgs) SAL_THROW((com::sun::star::uno::Exception));
private:
bool initSession(const ContextReader& _rSettings);
private:
void implInitFromSettings(const ContextReader& _rSettings, bool& rNeedProfile);
- void implInitFromProfile(data::NodeAccess const& aProfile);
+ void implInitFromProfile(sharable::Node * aProfile);
- virtual void initFromSettings(const ContextReader& _rSettings, bool& rNeedProfile);
- virtual void initFromProfile(data::NodeAccess const& aProfile);
+ void initFromSettings(const ContextReader& _rSettings, bool& rNeedProfile);
+ void initFromProfile(sharable::Node * aProfile);
};
} // namespace configmgr
diff --git a/configmgr/source/api2/setaccess.cxx b/configmgr/source/api2/setaccess.cxx
index 0fd00ef6fd..c421e6430b 100644
--- a/configmgr/source/api2/setaccess.cxx
+++ b/configmgr/source/api2/setaccess.cxx
@@ -39,21 +39,16 @@
namespace configmgr
{
- using uno::Reference;
- using uno::Sequence;
- using uno::Any;
- using uno::RuntimeException;
-
// XHierarchicalName
//------------------------------------------------------------------------------------------------------------------
-OUString SAL_CALL BasicSetAccess::getHierarchicalName( ) throw(RuntimeException)
+rtl::OUString SAL_CALL BasicSetAccess::getHierarchicalName( ) throw(uno::RuntimeException)
{
return configapi::implGetHierarchicalName( getNode() );
}
//------------------------------------------------------------------------------------------------------------------
-OUString SAL_CALL BasicSetAccess::composeHierarchicalName( const OUString& sRelativeName )
- throw(css::lang::IllegalArgumentException, css::lang::NoSupportException, RuntimeException)
+rtl::OUString SAL_CALL BasicSetAccess::composeHierarchicalName( const rtl::OUString& sRelativeName )
+ throw(css::lang::IllegalArgumentException, css::lang::NoSupportException, uno::RuntimeException)
{
return configapi::implComposeHierarchicalName( getNode(), sRelativeName );
}
@@ -63,13 +58,13 @@ OUString SAL_CALL BasicSetAccess::composeHierarchicalName( const OUString& sRela
// XElementAccess, base class of XNameAccess (and XHierarchicalNameAccess ? )
//-----------------------------------------------------------------------------------
-uno::Type SAL_CALL BasicSetAccess::getElementType( ) throw(RuntimeException)
+uno::Type SAL_CALL BasicSetAccess::getElementType( ) throw(uno::RuntimeException)
{
return configapi::implGetElementType( getNode() );
}
//-----------------------------------------------------------------------------------
-sal_Bool SAL_CALL BasicSetAccess::hasElements( ) throw(RuntimeException)
+sal_Bool SAL_CALL BasicSetAccess::hasElements( ) throw(uno::RuntimeException)
{
return configapi::implHasElements( getNode() );
}
@@ -77,7 +72,7 @@ sal_Bool SAL_CALL BasicSetAccess::hasElements( ) throw(RuntimeException)
// XExactName
//-----------------------------------------------------------------------------------
-OUString SAL_CALL BasicSetAccess::getExactName( const OUString& rApproximateName ) throw(RuntimeException)
+rtl::OUString SAL_CALL BasicSetAccess::getExactName( const rtl::OUString& rApproximateName ) throw(uno::RuntimeException)
{
return configapi::implGetExactName( getNode(), rApproximateName);
}
@@ -85,7 +80,7 @@ OUString SAL_CALL BasicSetAccess::getExactName( const OUString& rApproximateName
// XProperty
//-----------------------------------------------------------------------------------
-css::beans::Property SAL_CALL BasicSetAccess::getAsProperty( ) throw(RuntimeException)
+css::beans::Property SAL_CALL BasicSetAccess::getAsProperty( ) throw(uno::RuntimeException)
{
return configapi::implGetAsProperty( getNode() );
}
@@ -93,54 +88,54 @@ css::beans::Property SAL_CALL BasicSetAccess::getAsProperty( ) throw(RuntimeExc
// XPropertySetInfo
//-----------------------------------------------------------------------------------
-Sequence< css::beans::Property > SAL_CALL BasicSetAccess::getProperties( ) throw (uno::RuntimeException)
+uno::Sequence< css::beans::Property > SAL_CALL BasicSetAccess::getProperties( ) throw (uno::RuntimeException)
{
return configapi::implGetProperties( getNode() );
}
-css::beans::Property SAL_CALL BasicSetAccess::getPropertyByName( const OUString& aName )
- throw (css::beans::UnknownPropertyException, RuntimeException)
+css::beans::Property SAL_CALL BasicSetAccess::getPropertyByName( const rtl::OUString& aName )
+ throw (css::beans::UnknownPropertyException, uno::RuntimeException)
{
return configapi::implGetPropertyByName( getNode(), aName );
}
-sal_Bool SAL_CALL BasicSetAccess::hasPropertyByName( const OUString& Name ) throw (RuntimeException)
+sal_Bool SAL_CALL BasicSetAccess::hasPropertyByName( const rtl::OUString& name ) throw (uno::RuntimeException)
{
- return configapi::implHasPropertyByName( getNode(), Name );
+ return configapi::implHasPropertyByName( getNode(), name );
}
// XNameAccess
//-----------------------------------------------------------------------------------
-sal_Bool SAL_CALL BasicSetAccess::hasByName( const OUString& sName ) throw(RuntimeException)
+sal_Bool SAL_CALL BasicSetAccess::hasByName( const rtl::OUString& sName ) throw(uno::RuntimeException)
{
return configapi::implHasByName( getNode(), sName);
}
//-----------------------------------------------------------------------------------
-Any SAL_CALL BasicSetAccess::getByName( const OUString& sName )
- throw(css::container::NoSuchElementException, css::lang::WrappedTargetException, RuntimeException)
+uno::Any SAL_CALL BasicSetAccess::getByName( const rtl::OUString& sName )
+ throw(css::container::NoSuchElementException, css::lang::WrappedTargetException, uno::RuntimeException)
{
return configapi::implGetByName( getNode(), sName );
}
//-----------------------------------------------------------------------------------
-Sequence< OUString > SAL_CALL BasicSetAccess::getElementNames( ) throw( RuntimeException)
+uno::Sequence< rtl::OUString > SAL_CALL BasicSetAccess::getElementNames( ) throw( uno::RuntimeException)
{
return configapi::implGetElementNames( getNode() );
}
// XHierarchicalNameAccess
//-----------------------------------------------------------------------------------
-sal_Bool SAL_CALL BasicSetAccess::hasByHierarchicalName( const OUString& sName ) throw(RuntimeException)
+sal_Bool SAL_CALL BasicSetAccess::hasByHierarchicalName( const rtl::OUString& sName ) throw(uno::RuntimeException)
{
return configapi::implHasByHierarchicalName( getNode(), sName);
}
//-----------------------------------------------------------------------------------
-Any SAL_CALL BasicSetAccess::getByHierarchicalName( const OUString& sName )
- throw(css::container::NoSuchElementException, RuntimeException)
+uno::Any SAL_CALL BasicSetAccess::getByHierarchicalName( const rtl::OUString& sName )
+ throw(css::container::NoSuchElementException, uno::RuntimeException)
{
return configapi::implGetByHierarchicalName( getNode(), sName );
}
@@ -149,14 +144,14 @@ Any SAL_CALL BasicSetAccess::getByHierarchicalName( const OUString& sName )
// XContainer
//-----------------------------------------------------------------------------------
-void SAL_CALL BasicSetAccess::addContainerListener( const Reference< css::container::XContainerListener >& xListener )
- throw(RuntimeException)
+void SAL_CALL BasicSetAccess::addContainerListener( const uno::Reference< css::container::XContainerListener >& xListener )
+ throw(uno::RuntimeException)
{
configapi::implAddListener( getNode(), xListener );
}
-void SAL_CALL BasicSetAccess::removeContainerListener( const Reference< css::container::XContainerListener >& xListener )
- throw(RuntimeException)
+void SAL_CALL BasicSetAccess::removeContainerListener( const uno::Reference< css::container::XContainerListener >& xListener )
+ throw(uno::RuntimeException)
{
configapi::implRemoveListener( getNode(), xListener );
}
@@ -167,7 +162,7 @@ void SAL_CALL BasicSetAccess::removeContainerListener( const Reference< css::con
// XTemplateContainer
//-----------------------------------------------------------------------------------
-OUString SAL_CALL BasicSetAccess::getElementTemplateName( )
+rtl::OUString SAL_CALL BasicSetAccess::getElementTemplateName( )
throw(uno::RuntimeException)
{
return configapi::implGetElementTemplateName( getNode() );
@@ -175,14 +170,14 @@ OUString SAL_CALL BasicSetAccess::getElementTemplateName( )
// XStringEscape
//-----------------------------------------------------------------------------------
-OUString SAL_CALL BasicSetAccess::escapeString( const OUString& aString )
- throw(css::lang::IllegalArgumentException, RuntimeException)
+rtl::OUString SAL_CALL BasicSetAccess::escapeString( const rtl::OUString& aString )
+ throw(css::lang::IllegalArgumentException, uno::RuntimeException)
{
return aString;
}
-OUString SAL_CALL BasicSetAccess::unescapeString( const OUString& aEscapedString )
- throw(css::lang::IllegalArgumentException, RuntimeException)
+rtl::OUString SAL_CALL BasicSetAccess::unescapeString( const rtl::OUString& aEscapedString )
+ throw(css::lang::IllegalArgumentException, uno::RuntimeException)
{
return aEscapedString;
}
diff --git a/configmgr/source/api2/setaccess.hxx b/configmgr/source/api2/setaccess.hxx
index 82361c8088..a8975ff90d 100644
--- a/configmgr/source/api2/setaccess.hxx
+++ b/configmgr/source/api2/setaccess.hxx
@@ -46,7 +46,6 @@ namespace configmgr
{
namespace css = ::com::sun::star;
namespace uno = ::com::sun::star::uno;
- using rtl::OUString;
namespace configapi { class NodeSetInfoAccess; }
@@ -74,12 +73,12 @@ namespace configmgr
public:
// Interface methods
// XHierarchicalName
- virtual OUString SAL_CALL
+ virtual rtl::OUString SAL_CALL
getHierarchicalName( )
throw(uno::RuntimeException);
- virtual OUString SAL_CALL
- composeHierarchicalName( const OUString& aRelativeName )
+ virtual rtl::OUString SAL_CALL
+ composeHierarchicalName( const rtl::OUString& aRelativeName )
throw(css::lang::IllegalArgumentException, css::lang::NoSupportException,
uno::RuntimeException);
@@ -94,25 +93,25 @@ namespace configmgr
// XNameAccess
virtual uno::Any SAL_CALL
- getByName( const OUString& aName )
+ getByName( const rtl::OUString& aName )
throw(css::container::NoSuchElementException, css::lang::WrappedTargetException,
uno::RuntimeException);
- virtual uno::Sequence< OUString > SAL_CALL
+ virtual uno::Sequence< rtl::OUString > SAL_CALL
getElementNames( )
throw( uno::RuntimeException);
virtual sal_Bool SAL_CALL
- hasByName( const OUString& aName )
+ hasByName( const rtl::OUString& aName )
throw(uno::RuntimeException);
// XHierarchicalNameAccess
virtual uno::Any SAL_CALL
- getByHierarchicalName( const OUString& aName )
+ getByHierarchicalName( const rtl::OUString& aName )
throw(css::container::NoSuchElementException, uno::RuntimeException);
virtual sal_Bool SAL_CALL
- hasByHierarchicalName( const OUString& aName )
+ hasByHierarchicalName( const rtl::OUString& aName )
throw(uno::RuntimeException);
// XContainer
@@ -125,8 +124,8 @@ namespace configmgr
throw(uno::RuntimeException);
// XExactName
- virtual OUString SAL_CALL
- getExactName( const OUString& aApproximateName )
+ virtual rtl::OUString SAL_CALL
+ getExactName( const rtl::OUString& aApproximateName )
throw(uno::RuntimeException);
// XProperty
@@ -140,25 +139,25 @@ namespace configmgr
throw (uno::RuntimeException);
virtual css::beans::Property SAL_CALL
- getPropertyByName( const OUString& aName )
+ getPropertyByName( const rtl::OUString& aName )
throw (css::beans::UnknownPropertyException, uno::RuntimeException);
virtual sal_Bool SAL_CALL
- hasPropertyByName( const OUString& Name )
+ hasPropertyByName( const rtl::OUString& name )
throw (uno::RuntimeException);
// XTemplateContainer
- OUString SAL_CALL
+ rtl::OUString SAL_CALL
getElementTemplateName( )
throw(uno::RuntimeException);
// XStringEscape
- OUString SAL_CALL
- escapeString( const OUString& aString )
+ rtl::OUString SAL_CALL
+ escapeString( const rtl::OUString& aString )
throw(css::lang::IllegalArgumentException, uno::RuntimeException);
- OUString SAL_CALL
- unescapeString( const OUString& aEscapedString )
+ rtl::OUString SAL_CALL
+ unescapeString( const rtl::OUString& aEscapedString )
throw(css::lang::IllegalArgumentException, uno::RuntimeException);
protected:
diff --git a/configmgr/source/api2/setobjects.cxx b/configmgr/source/api2/setobjects.cxx
index 18391f128a..54d1e514c6 100644
--- a/configmgr/source/api2/setobjects.cxx
+++ b/configmgr/source/api2/setobjects.cxx
@@ -76,17 +76,17 @@ uno::Sequence< sal_Int8 > SAL_CALL OInnerSetInfo::getImplementationId( ) throw (
}
-NodeAccess& OInnerSetInfo::getNodeAccess()
+configapi::NodeAccess& OInnerSetInfo::getNodeAccess()
{
return m_aAccessElement;
}
-NodeSetInfoAccess& OInnerSetInfo::getNode()
+configapi::NodeSetInfoAccess& OInnerSetInfo::getNode()
{
return m_aAccessElement;
}
-InnerElement& OInnerSetInfo::getElementClass()
+configapi::InnerElement& OInnerSetInfo::getElementClass()
{
return m_aAccessElement;
}
@@ -129,22 +129,22 @@ uno::Sequence< sal_Int8 > SAL_CALL OInnerTreeSetUpdate::getImplementationId( ) t
}
-NodeAccess& OInnerTreeSetUpdate::getNodeAccess()
+configapi::NodeAccess& OInnerTreeSetUpdate::getNodeAccess()
{
return m_aAccessElement;
}
-NodeSetInfoAccess& OInnerTreeSetUpdate::getNode()
+configapi::NodeSetInfoAccess& OInnerTreeSetUpdate::getNode()
{
return m_aAccessElement;
}
-NodeTreeSetAccess* OInnerTreeSetUpdate::maybeGetUpdateAccess()
+configapi::NodeTreeSetAccess* OInnerTreeSetUpdate::maybeGetUpdateAccess()
{
return &m_aAccessElement;
}
-InnerElement& OInnerTreeSetUpdate::getElementClass()
+configapi::InnerElement& OInnerTreeSetUpdate::getElementClass()
{
return m_aAccessElement;
}
@@ -187,22 +187,22 @@ uno::Sequence< sal_Int8 > SAL_CALL OInnerValueSetUpdate::getImplementationId( )
}
-NodeAccess& OInnerValueSetUpdate::getNodeAccess()
+configapi::NodeAccess& OInnerValueSetUpdate::getNodeAccess()
{
return m_aAccessElement;
}
-NodeSetInfoAccess& OInnerValueSetUpdate::getNode()
+configapi::NodeSetInfoAccess& OInnerValueSetUpdate::getNode()
{
return m_aAccessElement;
}
-NodeValueSetAccess* OInnerValueSetUpdate::maybeGetUpdateAccess()
+configapi::NodeValueSetAccess* OInnerValueSetUpdate::maybeGetUpdateAccess()
{
return &m_aAccessElement;
}
-InnerElement& OInnerValueSetUpdate::getElementClass()
+configapi::InnerElement& OInnerValueSetUpdate::getElementClass()
{
return m_aAccessElement;
}
@@ -245,17 +245,17 @@ uno::Sequence< sal_Int8 > SAL_CALL OSetElementSetInfo::getImplementationId( ) th
}
-NodeAccess& OSetElementSetInfo::getNodeAccess()
+configapi::NodeAccess& OSetElementSetInfo::getNodeAccess()
{
return m_aAccessElement;
}
-NodeSetInfoAccess& OSetElementSetInfo::getNode()
+configapi::NodeSetInfoAccess& OSetElementSetInfo::getNode()
{
return m_aAccessElement;
}
-SetElement& OSetElementSetInfo::getElementClass()
+configapi::SetElement& OSetElementSetInfo::getElementClass()
{
return m_aAccessElement;
}
@@ -298,22 +298,22 @@ uno::Sequence< sal_Int8 > SAL_CALL OSetElementTreeSetUpdate::getImplementationId
}
-NodeAccess& OSetElementTreeSetUpdate::getNodeAccess()
+configapi::NodeAccess& OSetElementTreeSetUpdate::getNodeAccess()
{
return m_aAccessElement;
}
-NodeSetInfoAccess& OSetElementTreeSetUpdate::getNode()
+configapi::NodeSetInfoAccess& OSetElementTreeSetUpdate::getNode()
{
return m_aAccessElement;
}
-NodeTreeSetAccess* OSetElementTreeSetUpdate::maybeGetUpdateAccess()
+configapi::NodeTreeSetAccess* OSetElementTreeSetUpdate::maybeGetUpdateAccess()
{
return &m_aAccessElement;
}
-SetElement& OSetElementTreeSetUpdate::getElementClass()
+configapi::SetElement& OSetElementTreeSetUpdate::getElementClass()
{
return m_aAccessElement;
}
@@ -356,22 +356,22 @@ uno::Sequence< sal_Int8 > SAL_CALL OSetElementValueSetUpdate::getImplementationI
}
-NodeAccess& OSetElementValueSetUpdate::getNodeAccess()
+configapi::NodeAccess& OSetElementValueSetUpdate::getNodeAccess()
{
return m_aAccessElement;
}
-NodeSetInfoAccess& OSetElementValueSetUpdate::getNode()
+configapi::NodeSetInfoAccess& OSetElementValueSetUpdate::getNode()
{
return m_aAccessElement;
}
-NodeValueSetAccess* OSetElementValueSetUpdate::maybeGetUpdateAccess()
+configapi::NodeValueSetAccess* OSetElementValueSetUpdate::maybeGetUpdateAccess()
{
return &m_aAccessElement;
}
-SetElement& OSetElementValueSetUpdate::getElementClass()
+configapi::SetElement& OSetElementValueSetUpdate::getElementClass()
{
return m_aAccessElement;
}
@@ -414,17 +414,17 @@ uno::Sequence< sal_Int8 > SAL_CALL ORootElementSetInfo::getImplementationId( ) t
}
-NodeAccess& ORootElementSetInfo::getNodeAccess()
+configapi::NodeAccess& ORootElementSetInfo::getNodeAccess()
{
return m_aAccessElement;
}
-NodeSetInfoAccess& ORootElementSetInfo::getNode()
+configapi::NodeSetInfoAccess& ORootElementSetInfo::getNode()
{
return m_aAccessElement;
}
-RootElement& ORootElementSetInfo::getElementClass()
+configapi::RootElement& ORootElementSetInfo::getElementClass()
{
return m_aAccessElement;
}
@@ -467,22 +467,22 @@ uno::Sequence< sal_Int8 > SAL_CALL ORootElementTreeSetUpdate::getImplementationI
}
-NodeAccess& ORootElementTreeSetUpdate::getNodeAccess()
+configapi::NodeAccess& ORootElementTreeSetUpdate::getNodeAccess()
{
return m_aAccessElement;
}
-NodeSetInfoAccess& ORootElementTreeSetUpdate::getNode()
+configapi::NodeSetInfoAccess& ORootElementTreeSetUpdate::getNode()
{
return m_aAccessElement;
}
-NodeTreeSetAccess* ORootElementTreeSetUpdate::maybeGetUpdateAccess()
+configapi::NodeTreeSetAccess* ORootElementTreeSetUpdate::maybeGetUpdateAccess()
{
return &m_aAccessElement;
}
-UpdateRootElement& ORootElementTreeSetUpdate::getElementClass()
+configapi::UpdateRootElement& ORootElementTreeSetUpdate::getElementClass()
{
return m_aAccessElement;
}
@@ -525,22 +525,22 @@ uno::Sequence< sal_Int8 > SAL_CALL ORootElementValueSetUpdate::getImplementation
}
-NodeAccess& ORootElementValueSetUpdate::getNodeAccess()
+configapi::NodeAccess& ORootElementValueSetUpdate::getNodeAccess()
{
return m_aAccessElement;
}
-NodeSetInfoAccess& ORootElementValueSetUpdate::getNode()
+configapi::NodeSetInfoAccess& ORootElementValueSetUpdate::getNode()
{
return m_aAccessElement;
}
-NodeValueSetAccess* ORootElementValueSetUpdate::maybeGetUpdateAccess()
+configapi::NodeValueSetAccess* ORootElementValueSetUpdate::maybeGetUpdateAccess()
{
return &m_aAccessElement;
}
-UpdateRootElement& ORootElementValueSetUpdate::getElementClass()
+configapi::UpdateRootElement& ORootElementValueSetUpdate::getElementClass()
{
return m_aAccessElement;
}
diff --git a/configmgr/source/api2/setobjects.hxx b/configmgr/source/api2/setobjects.hxx
index 78af69601b..472796ddf8 100644
--- a/configmgr/source/api2/setobjects.hxx
+++ b/configmgr/source/api2/setobjects.hxx
@@ -41,18 +41,6 @@
namespace configmgr
{
//........................................................................
- using configapi::ApiTreeImpl;
- using configapi::ApiProvider;
-
- using configapi::NodeAccess;
- using configapi::NodeSetInfoAccess;
- using configapi::NodeTreeSetAccess;
- using configapi::NodeValueSetAccess;
-
- using configapi::InnerElement;
- using configapi::SetElement;
- using configapi::RootElement;
- using configapi::UpdateRootElement;
//==========================================================================
//= Inner Set Instances
@@ -66,7 +54,7 @@ namespace configmgr
{
public:
// Construction/Destruction
- OInnerSetInfo(ApiTreeImpl& rTree, configuration::NodeRef const& aNode)
+ OInnerSetInfo(configapi::ApiTreeImpl& rTree, configuration::NodeRef const& aNode)
: m_aAccessElement(static_cast<css::container::XChild*>(this),rTree,aNode)
{
}
@@ -83,11 +71,11 @@ namespace configmgr
uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) throw (uno::RuntimeException );
// Base class implementation
- virtual NodeAccess& getNodeAccess();
- virtual NodeSetInfoAccess& getNode();
- virtual InnerElement& getElementClass();
+ virtual configapi::NodeAccess& getNodeAccess();
+ virtual configapi::NodeSetInfoAccess& getNode();
+ virtual configapi::InnerElement& getElementClass();
private:
- configapi::OInnerSetInfoAccess m_aAccessElement;
+ configapi::OInnerElement<configapi::NodeSetInfoAccess> m_aAccessElement;
};
/** updating access class for configuration nodes which are inner nodes and dynamic sets of complex types (trees)
@@ -98,7 +86,7 @@ namespace configmgr
{
public:
// Construction/Destruction
- OInnerTreeSetUpdate(ApiTreeImpl& rTree, configuration::NodeRef const& aNode)
+ OInnerTreeSetUpdate(configapi::ApiTreeImpl& rTree, configuration::NodeRef const& aNode)
: m_aAccessElement(static_cast<css::container::XChild*>(this),rTree,aNode)
{
}
@@ -115,12 +103,12 @@ namespace configmgr
uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) throw (uno::RuntimeException );
// Base class implementation
- virtual NodeAccess& getNodeAccess();
- virtual NodeSetInfoAccess& getNode();
- virtual NodeTreeSetAccess* maybeGetUpdateAccess();
- virtual InnerElement& getElementClass();
+ virtual configapi::NodeAccess& getNodeAccess();
+ virtual configapi::NodeSetInfoAccess& getNode();
+ virtual configapi::NodeTreeSetAccess* maybeGetUpdateAccess();
+ virtual configapi::InnerElement& getElementClass();
private:
- configapi::OInnerTreeSetUpdateAccess m_aAccessElement;
+ configapi::OInnerElement<configapi::NodeTreeSetAccess> m_aAccessElement;
};
@@ -132,7 +120,7 @@ namespace configmgr
{
public:
// Construction/Destruction
- OInnerValueSetUpdate(ApiTreeImpl& rTree, configuration::NodeRef const& aNode)
+ OInnerValueSetUpdate(configapi::ApiTreeImpl& rTree, configuration::NodeRef const& aNode)
: m_aAccessElement(static_cast<css::container::XChild*>(this),rTree,aNode)
{
}
@@ -149,12 +137,12 @@ namespace configmgr
uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) throw (uno::RuntimeException );
// Base class implementation
- virtual NodeAccess& getNodeAccess();
- virtual NodeSetInfoAccess& getNode();
- virtual NodeValueSetAccess* maybeGetUpdateAccess();
- virtual InnerElement& getElementClass();
+ virtual configapi::NodeAccess& getNodeAccess();
+ virtual configapi::NodeSetInfoAccess& getNode();
+ virtual configapi::NodeValueSetAccess* maybeGetUpdateAccess();
+ virtual configapi::InnerElement& getElementClass();
private:
- configapi::OInnerValueSetUpdateAccess m_aAccessElement;
+ configapi::OInnerElement<configapi::NodeValueSetAccess> m_aAccessElement;
};
//==========================================================================
@@ -169,11 +157,11 @@ namespace configmgr
{
public:
// Construction/Destruction
- OSetElementSetInfo(configuration::TreeRef const& aTree, ApiTreeImpl& rParentTree)
+ OSetElementSetInfo(rtl::Reference< configuration::Tree > const& aTree, configapi::ApiTreeImpl& rParentTree)
: m_aAccessElement(static_cast<css::container::XChild*>(this),aTree,rParentTree)
{
}
- OSetElementSetInfo(configuration::TreeRef const& aTree, ApiProvider& rProvider, ApiTreeImpl* pParentTree = 0)
+ OSetElementSetInfo(rtl::Reference< configuration::Tree > const& aTree, configapi::ApiProvider& rProvider, configapi::ApiTreeImpl* pParentTree = 0)
: m_aAccessElement(static_cast<css::container::XChild*>(this),aTree,rProvider,pParentTree)
{
}
@@ -190,11 +178,11 @@ namespace configmgr
uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) throw (uno::RuntimeException );
// Base class implementation
- virtual NodeAccess& getNodeAccess();
- virtual NodeSetInfoAccess& getNode();
- virtual SetElement& getElementClass();
+ virtual configapi::NodeAccess& getNodeAccess();
+ virtual configapi::NodeSetInfoAccess& getNode();
+ virtual configapi::SetElement& getElementClass();
private:
- configapi::OSetElementSetInfoAccess m_aAccessElement;
+ configapi::OSetElement<configapi::NodeSetInfoAccess> m_aAccessElement;
};
/** updating access class for configuration nodes which are set elements and dynamic sets of complex types (trees)
@@ -205,11 +193,11 @@ namespace configmgr
{
public:
// Construction/Destruction
- OSetElementTreeSetUpdate(configuration::TreeRef const& aTree, ApiTreeImpl& rParentTree)
+ OSetElementTreeSetUpdate(rtl::Reference< configuration::Tree > const& aTree, configapi::ApiTreeImpl& rParentTree)
: m_aAccessElement(static_cast<css::container::XChild*>(this),aTree,rParentTree)
{
}
- OSetElementTreeSetUpdate(configuration::TreeRef const& aTree, ApiProvider& rProvider, ApiTreeImpl* pParentTree = 0)
+ OSetElementTreeSetUpdate(rtl::Reference< configuration::Tree > const& aTree, configapi::ApiProvider& rProvider, configapi::ApiTreeImpl* pParentTree = 0)
: m_aAccessElement(static_cast<css::container::XChild*>(this),aTree,rProvider,pParentTree)
{
}
@@ -226,12 +214,12 @@ namespace configmgr
uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) throw (uno::RuntimeException );
// Base class implementation
- virtual NodeAccess& getNodeAccess();
- virtual NodeSetInfoAccess& getNode();
- virtual NodeTreeSetAccess* maybeGetUpdateAccess();
- virtual SetElement& getElementClass();
+ virtual configapi::NodeAccess& getNodeAccess();
+ virtual configapi::NodeSetInfoAccess& getNode();
+ virtual configapi::NodeTreeSetAccess* maybeGetUpdateAccess();
+ virtual configapi::SetElement& getElementClass();
private:
- configapi::OSetElementTreeSetUpdateAccess m_aAccessElement;
+ configapi::OSetElement<configapi::NodeTreeSetAccess> m_aAccessElement;
};
@@ -243,11 +231,11 @@ namespace configmgr
{
public:
// Construction/Destruction
- OSetElementValueSetUpdate(configuration::TreeRef const& aTree, ApiTreeImpl& rParentTree)
+ OSetElementValueSetUpdate(rtl::Reference< configuration::Tree > const& aTree, configapi::ApiTreeImpl& rParentTree)
: m_aAccessElement(static_cast<css::container::XChild*>(this),aTree,rParentTree)
{
}
- OSetElementValueSetUpdate(configuration::TreeRef const& aTree, ApiProvider& rProvider, ApiTreeImpl* pParentTree = 0)
+ OSetElementValueSetUpdate(rtl::Reference< configuration::Tree > const& aTree, configapi::ApiProvider& rProvider, configapi::ApiTreeImpl* pParentTree = 0)
: m_aAccessElement(static_cast<css::container::XChild*>(this),aTree,rProvider,pParentTree)
{
}
@@ -264,12 +252,12 @@ namespace configmgr
uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) throw (uno::RuntimeException );
// Base class implementation
- virtual NodeAccess& getNodeAccess();
- virtual NodeSetInfoAccess& getNode();
- virtual NodeValueSetAccess* maybeGetUpdateAccess();
- virtual SetElement& getElementClass();
+ virtual configapi::NodeAccess& getNodeAccess();
+ virtual configapi::NodeSetInfoAccess& getNode();
+ virtual configapi::NodeValueSetAccess* maybeGetUpdateAccess();
+ virtual configapi::SetElement& getElementClass();
private:
- configapi::OSetElementValueSetUpdateAccess m_aAccessElement;
+ configapi::OSetElement<configapi::NodeValueSetAccess> m_aAccessElement;
};
//==========================================================================
@@ -284,7 +272,7 @@ namespace configmgr
{
public:
// Construction/Destruction
- ORootElementSetInfo(ApiProvider& rProvider, configuration::Tree const& aTree, vos::ORef< OOptions >const& _xOptions)
+ ORootElementSetInfo(configapi::ApiProvider& rProvider, rtl::Reference< configuration::Tree > const& aTree, vos::ORef< OOptions >const& _xOptions)
: m_aAccessElement(static_cast<css::lang::XComponent*>(this),rProvider,aTree,_xOptions)
{
}
@@ -301,11 +289,11 @@ namespace configmgr
uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) throw (uno::RuntimeException );
// Base class implementation
- virtual NodeAccess& getNodeAccess();
- virtual NodeSetInfoAccess& getNode();
- virtual RootElement& getElementClass();
+ virtual configapi::NodeAccess& getNodeAccess();
+ virtual configapi::NodeSetInfoAccess& getNode();
+ virtual configapi::RootElement& getElementClass();
private:
- configapi::ORootElementSetInfoAccess m_aAccessElement;
+ configapi::OReadRootElement<configapi::NodeSetInfoAccess> m_aAccessElement;
};
/** updating access class for configuration nodes which are root nodes and dynamic sets of complex types (trees)
@@ -316,7 +304,7 @@ namespace configmgr
{
public:
// Construction/Destruction
- ORootElementTreeSetUpdate(ApiProvider& rProvider, configuration::Tree const& aTree, vos::ORef< OOptions >const& _xOptions)
+ ORootElementTreeSetUpdate(configapi::ApiProvider& rProvider, rtl::Reference< configuration::Tree > const& aTree, vos::ORef< OOptions >const& _xOptions)
: m_aAccessElement(static_cast<css::lang::XComponent*>(this),rProvider,aTree, _xOptions)
{
}
@@ -333,12 +321,12 @@ namespace configmgr
uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) throw (uno::RuntimeException );
// Base class implementation
- virtual NodeAccess& getNodeAccess();
- virtual NodeSetInfoAccess& getNode();
- virtual NodeTreeSetAccess* maybeGetUpdateAccess();
- virtual UpdateRootElement& getElementClass();
+ virtual configapi::NodeAccess& getNodeAccess();
+ virtual configapi::NodeSetInfoAccess& getNode();
+ virtual configapi::NodeTreeSetAccess* maybeGetUpdateAccess();
+ virtual configapi::UpdateRootElement& getElementClass();
private:
- configapi::ORootElementTreeSetUpdateAccess m_aAccessElement;
+ configapi::OUpdateRootElement<configapi::NodeTreeSetAccess> m_aAccessElement;
};
@@ -350,7 +338,7 @@ namespace configmgr
{
public:
// Construction/Destruction
- ORootElementValueSetUpdate(ApiProvider& rProvider, configuration::Tree const& aTree, vos::ORef< OOptions >const& _xOptions)
+ ORootElementValueSetUpdate(configapi::ApiProvider& rProvider, rtl::Reference< configuration::Tree > const& aTree, vos::ORef< OOptions >const& _xOptions)
: m_aAccessElement(static_cast<css::lang::XComponent*>(this),rProvider,aTree,_xOptions)
{
}
@@ -367,12 +355,12 @@ namespace configmgr
uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) throw (uno::RuntimeException );
// Base class implementation
- virtual NodeAccess& getNodeAccess();
- virtual NodeSetInfoAccess& getNode();
- virtual NodeValueSetAccess* maybeGetUpdateAccess();
- virtual UpdateRootElement& getElementClass();
+ virtual configapi::NodeAccess& getNodeAccess();
+ virtual configapi::NodeSetInfoAccess& getNode();
+ virtual configapi::NodeValueSetAccess* maybeGetUpdateAccess();
+ virtual configapi::UpdateRootElement& getElementClass();
private:
- configapi::ORootElementValueSetUpdateAccess m_aAccessElement;
+ configapi::OUpdateRootElement<configapi::NodeValueSetAccess> m_aAccessElement;
};
diff --git a/configmgr/source/api2/setupdate.cxx b/configmgr/source/api2/setupdate.cxx
index 5a80a20806..2dff6a99f4 100644
--- a/configmgr/source/api2/setupdate.cxx
+++ b/configmgr/source/api2/setupdate.cxx
@@ -42,13 +42,6 @@
namespace configmgr
{
//////////////////////////////////////////////////////////////////////////////////
-
- using uno::Reference;
- using uno::Sequence;
- using uno::Any;
- using uno::RuntimeException;
-
-//////////////////////////////////////////////////////////////////////////////////
// classes BasicSet / BasicValueSet
//////////////////////////////////////////////////////////////////////////////////
@@ -56,7 +49,7 @@ namespace configmgr
//////////////////////////////////////////////////////////////////////////////////
uno::Any SAL_CALL BasicSet::queryInterface( uno::Type const& rType ) throw (uno::RuntimeException )
{
- Any aRet = BasicSetAccess::queryInterface( rType );
+ uno::Any aRet = BasicSetAccess::queryInterface( rType );
if (!aRet.hasValue())
{
aRet = cppu::queryInterface(rType
@@ -72,7 +65,7 @@ uno::Any SAL_CALL BasicSet::queryInterface( uno::Type const& rType ) throw (uno:
uno::Any SAL_CALL BasicValueSet::queryInterface( uno::Type const& rType ) throw (uno::RuntimeException )
{
- Any aRet = BasicSetAccess::queryInterface( rType );
+ uno::Any aRet = BasicSetAccess::queryInterface( rType );
if (!aRet.hasValue())
{
aRet = cppu::queryInterface(rType
@@ -125,7 +118,7 @@ configapi::NodeTreeSetAccess& BasicSet::getSetNode()
if (!pAccess)
{
throw uno::RuntimeException(
- OUString(RTL_CONSTASCII_USTRINGPARAM("Configuration: Invalid Object - internal update-interface missing.")),
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Configuration: Invalid Object - internal update-interface missing.")),
static_cast< css::container::XNameReplace * >(this)
);
}
@@ -140,7 +133,7 @@ configapi::NodeValueSetAccess& BasicValueSet::getSetNode()
if (!pAccess)
{
throw uno::RuntimeException(
- OUString(RTL_CONSTASCII_USTRINGPARAM("Configuration: Invalid Object - internal update-interface missing.")),
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Configuration: Invalid Object - internal update-interface missing.")),
static_cast< css::container::XNameReplace* >(this)
);
}
@@ -150,14 +143,14 @@ configapi::NodeValueSetAccess& BasicValueSet::getSetNode()
// New Interface methods
// XNameReplace
//////////////////////////////////////////////////////////////////////////////////
-void SAL_CALL BasicSet::replaceByName( const OUString& rName, const uno::Any& rElement )
+void SAL_CALL BasicSet::replaceByName( const rtl::OUString& rName, const uno::Any& rElement )
throw(css::lang::IllegalArgumentException, css::container::NoSuchElementException, css::lang::WrappedTargetException, uno::RuntimeException)
{
configapi::implReplaceByName( getSetNode(), rName, rElement );
}
//..............................................................................
-void SAL_CALL BasicValueSet::replaceByName( const OUString& rName, const uno::Any& rElement )
+void SAL_CALL BasicValueSet::replaceByName( const rtl::OUString& rName, const uno::Any& rElement )
throw(css::lang::IllegalArgumentException, css::container::NoSuchElementException, css::lang::WrappedTargetException, uno::RuntimeException)
{
configapi::implReplaceByName( getSetNode(), rName, rElement );
@@ -165,28 +158,28 @@ void SAL_CALL BasicValueSet::replaceByName( const OUString& rName, const uno::An
// XNameContainer
//////////////////////////////////////////////////////////////////////////////////
-void SAL_CALL BasicSet::insertByName( const OUString& rName, const uno::Any& rElement)
+void SAL_CALL BasicSet::insertByName( const rtl::OUString& rName, const uno::Any& rElement)
throw(css::lang::IllegalArgumentException, css::container::ElementExistException, css::lang::WrappedTargetException, uno::RuntimeException)
{
configapi::implInsertByName( getSetNode(), rName, rElement );
}
//..............................................................................
-void SAL_CALL BasicValueSet::insertByName( const OUString& rName, const uno::Any& rElement)
+void SAL_CALL BasicValueSet::insertByName( const rtl::OUString& rName, const uno::Any& rElement)
throw(css::lang::IllegalArgumentException, css::container::ElementExistException, css::lang::WrappedTargetException, uno::RuntimeException)
{
configapi::implInsertByName( getSetNode(), rName, rElement );
}
//----------------------------------------------------------------------------------
-void SAL_CALL BasicSet::removeByName( const OUString& rName )
+void SAL_CALL BasicSet::removeByName( const rtl::OUString& rName )
throw(css::container::NoSuchElementException, css::lang::WrappedTargetException, uno::RuntimeException)
{
configapi::implRemoveByName( getSetNode(), rName );
}
//..............................................................................
-void SAL_CALL BasicValueSet::removeByName( const OUString& rName )
+void SAL_CALL BasicValueSet::removeByName( const rtl::OUString& rName )
throw(css::container::NoSuchElementException, css::lang::WrappedTargetException, uno::RuntimeException)
{
configapi::implRemoveByName( getSetNode(), rName );
diff --git a/configmgr/source/api2/setupdate.hxx b/configmgr/source/api2/setupdate.hxx
index ccb2270c6c..dd67364eaf 100644
--- a/configmgr/source/api2/setupdate.hxx
+++ b/configmgr/source/api2/setupdate.hxx
@@ -75,29 +75,29 @@ namespace configmgr
{ return BasicSetAccess::hasElements(); }
// XNameAccess forwarding
- virtual uno::Any SAL_CALL getByName( const OUString& aName )
+ virtual uno::Any SAL_CALL getByName( const rtl::OUString& aName )
throw(css::container::NoSuchElementException, css::lang::WrappedTargetException, uno::RuntimeException)
{ return BasicSetAccess::getByName(aName); }
- virtual uno::Sequence< OUString > SAL_CALL getElementNames( ) throw( uno::RuntimeException)
+ virtual uno::Sequence< rtl::OUString > SAL_CALL getElementNames( ) throw( uno::RuntimeException)
{ return BasicSetAccess::getElementNames(); }
- virtual sal_Bool SAL_CALL hasByName( const OUString& aName ) throw(uno::RuntimeException)
+ virtual sal_Bool SAL_CALL hasByName( const rtl::OUString& aName ) throw(uno::RuntimeException)
{ return BasicSetAccess::hasByName(aName); }
// New Interface methods
// XNameReplace
virtual void SAL_CALL
- replaceByName( const OUString& rName, const uno::Any& rElement )
+ replaceByName( const rtl::OUString& rName, const uno::Any& rElement )
throw(css::lang::IllegalArgumentException, css::container::NoSuchElementException, css::lang::WrappedTargetException, uno::RuntimeException);
// XNameContainer
virtual void SAL_CALL
- insertByName( const OUString& rName, const uno::Any& rElement)
+ insertByName( const rtl::OUString& rName, const uno::Any& rElement)
throw(css::lang::IllegalArgumentException, css::container::ElementExistException, css::lang::WrappedTargetException, uno::RuntimeException);
virtual void SAL_CALL
- removeByName( const OUString& rName )
+ removeByName( const rtl::OUString& rName )
throw(css::container::NoSuchElementException, css::lang::WrappedTargetException, uno::RuntimeException);
// XPropertyWithState
@@ -159,29 +159,29 @@ namespace configmgr
{ return BasicSetAccess::hasElements(); }
// XNameAccess forwarding
- virtual uno::Any SAL_CALL getByName( const OUString& aName )
+ virtual uno::Any SAL_CALL getByName( const rtl::OUString& aName )
throw(css::container::NoSuchElementException, css::lang::WrappedTargetException, uno::RuntimeException)
{ return BasicSetAccess::getByName(aName); }
- virtual uno::Sequence< OUString > SAL_CALL getElementNames( ) throw( uno::RuntimeException)
+ virtual uno::Sequence< rtl::OUString > SAL_CALL getElementNames( ) throw( uno::RuntimeException)
{ return BasicSetAccess::getElementNames(); }
- virtual sal_Bool SAL_CALL hasByName( const OUString& aName ) throw(uno::RuntimeException)
+ virtual sal_Bool SAL_CALL hasByName( const rtl::OUString& aName ) throw(uno::RuntimeException)
{ return BasicSetAccess::hasByName(aName); }
// New Interface methods
// XNameReplace
virtual void SAL_CALL
- replaceByName( const OUString& rName, const uno::Any& rElement )
+ replaceByName( const rtl::OUString& rName, const uno::Any& rElement )
throw(css::lang::IllegalArgumentException, css::container::NoSuchElementException, css::lang::WrappedTargetException, uno::RuntimeException);
// XNameContainer
virtual void SAL_CALL
- insertByName( const OUString& rName, const uno::Any& rElement)
+ insertByName( const rtl::OUString& rName, const uno::Any& rElement)
throw(css::lang::IllegalArgumentException, css::container::ElementExistException, css::lang::WrappedTargetException, uno::RuntimeException);
virtual void SAL_CALL
- removeByName( const OUString& rName )
+ removeByName( const rtl::OUString& rName )
throw(css::container::NoSuchElementException, css::lang::WrappedTargetException, uno::RuntimeException);
// XPropertyWithState
diff --git a/configmgr/source/api2/translatechanges.cxx b/configmgr/source/api2/translatechanges.cxx
index 06cf5fdfda..d78c89212b 100644
--- a/configmgr/source/api2/translatechanges.cxx
+++ b/configmgr/source/api2/translatechanges.cxx
@@ -52,7 +52,6 @@ namespace configmgr
{
class NodeChange;
class NodeChanges;
- class Tree;
class NodeRef;
class NodeID;
}
@@ -60,34 +59,22 @@ namespace configmgr
namespace configapi
{
- using configuration::Tree;
- using configuration::TreeRef;
- using configuration::Name;
- using configuration::AbsolutePath;
- using configuration::RelativePath;
- using configuration::NodeRef;
- using configuration::NodeID;
- using configuration::NodeChangeInformation;
- using configuration::NodeChangeData;
- using configuration::NodeChangeLocation;
// ---------------------------------------------------------------------------------------------------
//interpreting NodeChanges
// resolve the relative path from a given base to the changed node
-bool resolveChangeLocation(RelativePath& aPath, NodeChangeLocation const& aChange, Tree const& aBaseTree, NodeRef const& aBaseNode)
+bool resolveChangeLocation(configuration::RelativePath& aPath, configuration::NodeChangeLocation const& aChange, rtl::Reference< configuration::Tree > const& aBaseTree, configuration::NodeRef const& aBaseNode)
{
OSL_ENSURE(aChange.isValidLocation(), "Trying to resolve against change location that wasn't set up properly");
namespace Path = configuration::Path;
- typedef Path::Iterator Iter;
+ rtl::Reference< configuration::Tree > aChangeBaseTree = aChange.getBaseTree();
- Tree aChangeBaseTree = aChange.getBaseTree();
+ configuration::AbsolutePath aOuterBasePath = aBaseTree->getAbsolutePath(aBaseNode);
+ configuration::AbsolutePath aChangeBasePath = aChangeBaseTree->getAbsolutePath(aChange.getBaseNode());
- AbsolutePath aOuterBasePath = aBaseTree.getAbsolutePath(aBaseNode);
- AbsolutePath aChangeBasePath = aChangeBaseTree.getAbsolutePath(aChange.getBaseNode());
-
- Iter aChangeIt = aChangeBasePath.begin(), aChangeEnd = aChangeBasePath.end();
- Iter aOuterIt = aOuterBasePath.begin(), aOuterEnd = aOuterBasePath.end();
+ std::vector<configuration::Path::Component>::const_reverse_iterator aChangeIt = aChangeBasePath.begin(), aChangeEnd = aChangeBasePath.end();
+ std::vector<configuration::Path::Component>::const_reverse_iterator aOuterIt = aOuterBasePath.begin(), aOuterEnd = aOuterBasePath.end();
// First by resolve the base node pathes
while (aOuterIt != aOuterEnd && aChangeIt != aChangeEnd)
@@ -102,7 +89,7 @@ bool resolveChangeLocation(RelativePath& aPath, NodeChangeLocation const& aChang
{
Path::Rep aRemaining(aChangeIt, aChangeEnd);
- aPath = RelativePath(aRemaining).compose(aChange.getAccessor());
+ aPath = configuration::RelativePath(aRemaining).compose(aChange.getAccessor());
}
else if (aOuterIt == aOuterEnd) // exact match outside
{
@@ -110,7 +97,7 @@ bool resolveChangeLocation(RelativePath& aPath, NodeChangeLocation const& aChang
}
else //(aChangeIt == aChangeEnd) but outer left
{
- RelativePath aAccessor = aChange.getAccessor();
+ configuration::RelativePath aAccessor = aChange.getAccessor();
aChangeIt = aAccessor.begin();
aChangeEnd = aAccessor.end();
@@ -126,7 +113,7 @@ bool resolveChangeLocation(RelativePath& aPath, NodeChangeLocation const& aChang
{
Path::Rep aRemaining(aChangeIt, aChangeEnd);
- aPath = RelativePath( aRemaining );
+ aPath = configuration::RelativePath( aRemaining );
}
}
@@ -136,17 +123,17 @@ bool resolveChangeLocation(RelativePath& aPath, NodeChangeLocation const& aChang
// ---------------------------------------------------------------------------------------------------
// change path and base settings to start from the given base
-bool rebaseChange(NodeChangeLocation& aChange, TreeRef const& _aBaseTreeRef)
+bool rebaseChange(configuration::NodeChangeLocation& aChange, rtl::Reference< configuration::Tree > const& _aBaseTreeRef)
{
- return rebaseChange(aChange,_aBaseTreeRef,_aBaseTreeRef.getRootNode());
+ return rebaseChange(aChange,_aBaseTreeRef,_aBaseTreeRef->getRootNode());
}
-bool rebaseChange(NodeChangeLocation& aChange, TreeRef const& _aBaseTreeRef, NodeRef const& aBaseNode)
+bool rebaseChange(configuration::NodeChangeLocation& aChange, rtl::Reference< configuration::Tree > const& _aBaseTreeRef, configuration::NodeRef const& aBaseNode)
{
OSL_ENSURE(aChange.isValidLocation(), "Trying to rebase change location that wasn't set up properly");
- Tree aBaseTree(_aBaseTreeRef);
+ rtl::Reference< configuration::Tree > aBaseTree(_aBaseTreeRef);
- RelativePath aNewPath;
+ configuration::RelativePath aNewPath;
if (resolveChangeLocation(aNewPath,aChange,aBaseTree,aBaseNode))
{
aChange.setBase( aBaseTree, aBaseNode);
@@ -158,7 +145,7 @@ bool rebaseChange(NodeChangeLocation& aChange, TreeRef const& _aBaseTreeRef, Nod
}
// ---------------------------------------------------------------------------------------------------
// resolve non-uno elements to Uno Objects
-bool resolveUnoObjects(UnoChange& aUnoChange, NodeChangeData const& aChange,
+bool resolveUnoObjects(UnoChange& aUnoChange, configuration::NodeChangeData const& aChange,
Factory& rFactory)
{
if (aChange.isSetChange())
@@ -176,11 +163,11 @@ bool resolveUnoObjects(UnoChange& aUnoChange, NodeChangeData const& aChange,
}
//Check if complex or simple type
- Tree aTree = aChange.isRemoveSetChange()?
+ rtl::Reference< configuration::Tree > aTree = aChange.isRemoveSetChange()?
aChange.getOldElementTree():
aChange.getNewElementTree();
- NodeRef aNodeRef = aTree.getRootNode();
+ configuration::NodeRef aNodeRef = aTree->getRootNode();
if (configuration::isStructuralNode(aTree, aNodeRef))
{
@@ -198,9 +185,9 @@ bool resolveUnoObjects(UnoChange& aUnoChange, NodeChangeData const& aChange,
if (aChange.isReplaceSetChange() )
{
- Tree aOldTree = aChange.getOldElementTree();
+ rtl::Reference< configuration::Tree > aOldTree = aChange.getOldElementTree();
- aNodeRef = aOldTree.getRootNode();
+ aNodeRef = aOldTree->getRootNode();
OSL_ENSURE(!configuration::isStructuralNode(aOldTree, aNodeRef), "resolveUnoObject types mismatch");
aUnoChange.oldValue = configuration::getSimpleElementValue(aOldTree, aNodeRef);
}
@@ -221,7 +208,7 @@ bool resolveUnoObjects(UnoChange& aUnoChange, NodeChangeData const& aChange,
}
// ---------------------------------------------------------------------------------------------------
// resolve non-uno elements to Uno Objects inplace
-bool resolveToUno(NodeChangeData& aChange, Factory& rFactory)
+bool resolveToUno(configuration::NodeChangeData& aChange, Factory& rFactory)
{
struct UnoChange aUnoChange;
if (resolveUnoObjects(aUnoChange,aChange, rFactory))
@@ -236,14 +223,14 @@ bool resolveToUno(NodeChangeData& aChange, Factory& rFactory)
// ---------------------------------------------------------------------------------------------------
/// fill a change info from a NodeChangeInfo
-void fillChange(util::ElementChange& rChange, NodeChangeInformation const& aInfo, Tree const& aBaseTree, Factory& rFactory)
+void fillChange(util::ElementChange& rChange, configuration::NodeChangeInformation const& aInfo, rtl::Reference< configuration::Tree > const& aBaseTree, Factory& rFactory)
{
- fillChange(rChange,aInfo,aBaseTree,aBaseTree.getRootNode(),rFactory);
+ fillChange(rChange,aInfo,aBaseTree,aBaseTree->getRootNode(),rFactory);
}
/// fill a change info from a NodeChangeInfo
-void fillChange(util::ElementChange& rChange, NodeChangeInformation const& aInfo, Tree const& aBaseTree, NodeRef const& aBaseNode, Factory& rFactory)
+void fillChange(util::ElementChange& rChange, configuration::NodeChangeInformation const& aInfo, rtl::Reference< configuration::Tree > const& aBaseTree, configuration::NodeRef const& aBaseNode, Factory& rFactory)
{
- RelativePath aRelativePath;
+ configuration::RelativePath aRelativePath;
if (!resolveChangeLocation(aRelativePath, aInfo.location, aBaseTree, aBaseNode))
OSL_ENSURE(false, "WARNING: Change is not part of the given Tree");
@@ -258,7 +245,7 @@ void fillChange(util::ElementChange& rChange, NodeChangeInformation const& aInfo
}
// ---------------------------------------------------------------------------------------------------
/// fill a change info from a NodeChangeInfo (base,path and uno objects are assumed to be resolved already)
-void fillChangeFromResolved(util::ElementChange& rChange, NodeChangeInformation const& aInfo)
+void fillChangeFromResolved(util::ElementChange& rChange, configuration::NodeChangeInformation const& aInfo)
{
rChange.Accessor <<= aInfo.location.getAccessor().toString();
rChange.Element = aInfo.change.unoData.newValue;
@@ -266,9 +253,9 @@ void fillChangeFromResolved(util::ElementChange& rChange, NodeChangeInformation
}
// ---------------------------------------------------------------------------------------------------
/// fill a event from a NodeChangeInfo (uno objects are assumed to be resolved already)
-bool fillEventDataFromResolved(container::ContainerEvent& rEvent, NodeChangeInformation const& aInfo)
+bool fillEventDataFromResolved(container::ContainerEvent& rEvent, configuration::NodeChangeInformation const& aInfo)
{
- rEvent.Accessor <<= aInfo.location.getAccessor().getLocalName().getName().toString();
+ rEvent.Accessor <<= aInfo.location.getAccessor().getLocalName().getName();
rEvent.Element = aInfo.change.unoData.newValue;
rEvent.ReplacedElement = aInfo.change.unoData.oldValue;
@@ -276,12 +263,12 @@ bool fillEventDataFromResolved(container::ContainerEvent& rEvent, NodeChangeInfo
}
// ---------------------------------------------------------------------------------------------------
/// fill a event from a NodeChangeInfo(uno objects are assumed to be resolved already)
-bool fillEventDataFromResolved(beans::PropertyChangeEvent& rEvent, NodeChangeInformation const& aInfo, bool bMore)
+bool fillEventDataFromResolved(beans::PropertyChangeEvent& rEvent, configuration::NodeChangeInformation const& aInfo, bool bMore)
{
if (!aInfo.isValueChange())
return false;
- rEvent.PropertyName = aInfo.location.getAccessor().getLocalName().getName().toString();
+ rEvent.PropertyName = aInfo.location.getAccessor().getLocalName().getName();
rEvent.NewValue = aInfo.change.unoData.newValue;
rEvent.OldValue = aInfo.change.unoData.oldValue;
diff --git a/configmgr/source/api2/translatechanges.hxx b/configmgr/source/api2/translatechanges.hxx
index 2f1613639b..0ebb22aa50 100644
--- a/configmgr/source/api2/translatechanges.hxx
+++ b/configmgr/source/api2/translatechanges.hxx
@@ -36,6 +36,7 @@
#include <com/sun/star/beans/XPropertiesChangeListener.hpp>
#include <com/sun/star/container/XContainerListener.hpp>
#include <com/sun/star/util/XChangesListener.hpp>
+#include "rtl/ref.hxx"
namespace configmgr
{
@@ -57,7 +58,6 @@ namespace configmgr
//class NodeChange;
//class NodeChanges;
class Tree;
- class TreeRef;
class NodeRef;
class NodeID;
class RelativePath;
@@ -75,15 +75,15 @@ namespace configmgr
// resolve the relative path from a given base node to the changed node
bool resolveChangeLocation( configuration::RelativePath& aPath,
configuration::NodeChangeLocation const& aChange,
- configuration::Tree const& aBaseTree,
+ rtl::Reference< configuration::Tree > const& aBaseTree,
configuration::NodeRef const& aBaseNode);
// change path and base settings to start from the given base tree (root)
bool rebaseChange( configuration::NodeChangeLocation& aChange,
- configuration::TreeRef const& _aBaseTreeRef);
+ rtl::Reference< configuration::Tree > const& _aBaseTreeRef);
// change path and base settings to start from the given base node
bool rebaseChange( configuration::NodeChangeLocation& aChange,
- configuration::TreeRef const& _aBaseTreeRef,
+ rtl::Reference< configuration::Tree > const& _aBaseTreeRef,
configuration::NodeRef const& aBaseNode);
// resolve non-uno elements to Uno Objects
bool resolveUnoObjects(UnoChange& aUnoChange,
@@ -98,12 +98,12 @@ namespace configmgr
/// fill a change info from a NodeChangeInfo
void fillChange(util::ElementChange& rChange,
configuration::NodeChangeInformation const& aInfo,
- configuration::Tree const& aBaseTree,
+ rtl::Reference< configuration::Tree > const& aBaseTree,
Factory& rFactory);
/// fill a change info from a NodeChangeInfo
void fillChange(util::ElementChange& rChange,
configuration::NodeChangeInformation const& aInfo,
- configuration::Tree const& aBaseTree,
+ rtl::Reference< configuration::Tree > const& aBaseTree,
configuration::NodeRef const& aBaseNode,
Factory& rFactory);
/// fill a change info from a NodeChangeInfo (base,path and uno objects are assumed to be resolved already)
diff --git a/configmgr/source/api2/treeiterators.cxx b/configmgr/source/api2/treeiterators.cxx
index e1d8559d5f..bb26557b41 100644
--- a/configmgr/source/api2/treeiterators.cxx
+++ b/configmgr/source/api2/treeiterators.cxx
@@ -46,23 +46,20 @@ namespace configmgr
// .......................................................................
namespace configapi
{
- using configuration::Name;
- using node::Attributes;
-
// ===================================================================
// = CollectNodeNames
// ===================================================================
// -------------------------------------------------------------------
- CollectPropertyInfo::Result CollectNodeNames::handle(configuration::Tree const& aTree, configuration::NodeRef const& aNode)
+ CollectPropertyInfo::Result CollectNodeNames::handle(rtl::Reference< configuration::Tree > const& aTree, configuration::NodeRef const& aNode)
{
- m_aList.push_back(aTree.getName(aNode).toString());
+ m_aList.push_back(aTree->getSimpleNodeName(aNode.getOffset()));
return CONTINUE;
}
// -------------------------------------------------------------------
- CollectPropertyInfo::Result CollectNodeNames::handle(configuration::Tree const& aTree, configuration::ValueRef const& aNode)
+ CollectPropertyInfo::Result CollectNodeNames::handle(rtl::Reference< configuration::Tree > const&, configuration::ValueRef const& aNode)
{
- m_aList.push_back(aTree.getName(aNode).toString());
+ m_aList.push_back(aNode.m_sNodeName);
return CONTINUE;
}
@@ -70,24 +67,24 @@ namespace configmgr
// = CollectPropertyInfo
// ===================================================================
// -------------------------------------------------------------------
- CollectNodeNames::Result CollectPropertyInfo::handle(configuration::Tree const& aTree, configuration::NodeRef const& aNode)
+ CollectNodeNames::Result CollectPropertyInfo::handle(rtl::Reference< configuration::Tree > const& aTree, configuration::NodeRef const& aNode)
{
- Name aName = aTree.getName(aNode);
- Attributes aAttributes = aTree.getAttributes(aNode);
+ rtl::OUString aName = aTree->getSimpleNodeName(aNode.getOffset());
+ node::Attributes aAttributes = aTree->getAttributes(aNode);
uno::Type aApiType = getUnoInterfaceType();
- m_aList.push_back( helperMakeProperty(aName,aAttributes,aApiType,aTree.hasNodeDefault(aNode)) );
+ m_aList.push_back( helperMakeProperty(aName,aAttributes,aApiType,aTree->hasNodeDefault(aNode)) );
return CONTINUE;
}
// -------------------------------------------------------------------
- CollectNodeNames::Result CollectPropertyInfo::handle(configuration::Tree const& aTree, configuration::ValueRef const& aNode)
+ CollectNodeNames::Result CollectPropertyInfo::handle(rtl::Reference< configuration::Tree > const& aTree, configuration::ValueRef const& aNode)
{
- Name aName = aTree.getName(aNode);
- Attributes aAttributes = aTree.getAttributes(aNode);
- uno::Type aApiType = aTree.getUnoType(aNode);
+ rtl::OUString aName = aNode.m_sNodeName;
+ node::Attributes aAttributes = aTree->getAttributes(aNode);
+ uno::Type aApiType = aTree->getUnoType(aNode);
- m_aList.push_back( helperMakeProperty(aName,aAttributes,aApiType,aTree.hasNodeDefault(aNode)) );
+ m_aList.push_back( helperMakeProperty(aName,aAttributes,aApiType,aTree->hasNodeDefault(aNode)) );
return CONTINUE;
}
// .......................................................................
diff --git a/configmgr/source/api2/treeiterators.hxx b/configmgr/source/api2/treeiterators.hxx
index 51623f5cf0..2656882ae9 100644
--- a/configmgr/source/api2/treeiterators.hxx
+++ b/configmgr/source/api2/treeiterators.hxx
@@ -31,7 +31,7 @@
#ifndef CONFIGMGR_TREEITERATORS_HXX_
#define CONFIGMGR_TREEITERATORS_HXX_
-#include "noderef.hxx"
+#include "tree.hxx"
#include <com/sun/star/beans/Property.hpp>
#include <rtl/ustring.hxx>
@@ -44,8 +44,6 @@
namespace configmgr
{
// .......................................................................
- using rtl::OUString;
-
namespace configapi
{
// ===================================================================
@@ -53,19 +51,16 @@ namespace configmgr
// ===================================================================
class CollectNodeNames : public configuration::NodeVisitor
{
- public:
- typedef std::vector<OUString> NameList;
-
protected:
- NameList m_aList;
+ std::vector<rtl::OUString> m_aList;
public:
CollectNodeNames() { }
- virtual Result handle(configuration::Tree const& aTree, configuration::NodeRef const& aNode); // NodeVisitor
- virtual Result handle(configuration::Tree const& aTree, configuration::ValueRef const& aNode); // NodeVisitor
+ virtual Result handle(rtl::Reference< configuration::Tree > const& aTree, configuration::NodeRef const& aNode); // NodeVisitor
+ virtual Result handle(rtl::Reference< configuration::Tree > const& aTree, configuration::ValueRef const& aNode); // NodeVisitor
- NameList const& list() const { return m_aList; }
+ std::vector<rtl::OUString> const& list() const { return m_aList; }
};
// ===================================================================
@@ -73,20 +68,16 @@ namespace configmgr
// ===================================================================
class CollectPropertyInfo : public configuration::NodeVisitor
{
- public:
- typedef com::sun::star::beans::Property Property;
- typedef std::vector<Property> PropertyList;
-
protected:
- PropertyList m_aList;
+ std::vector<com::sun::star::beans::Property> m_aList;
public:
CollectPropertyInfo() { }
- virtual Result handle(configuration::Tree const& aTree, configuration::NodeRef const& aNode); // NodeVisitor
- virtual Result handle(configuration::Tree const& aTree, configuration::ValueRef const& aNode); // NodeVisitor
+ virtual Result handle(rtl::Reference< configuration::Tree > const& aTree, configuration::NodeRef const& aNode); // NodeVisitor
+ virtual Result handle(rtl::Reference< configuration::Tree > const& aTree, configuration::ValueRef const& aNode); // NodeVisitor
- PropertyList const& list() const { return m_aList; }
+ std::vector<com::sun::star::beans::Property> const& list() const { return m_aList; }
};
}
// .......................................................................
diff --git a/configmgr/source/api2/updateimpl.cxx b/configmgr/source/api2/updateimpl.cxx
index c3950cd651..301a9f77c1 100644
--- a/configmgr/source/api2/updateimpl.cxx
+++ b/configmgr/source/api2/updateimpl.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: updateimpl.cxx,v $
- * $Revision: 1.15.14.1 $
+ * $Revision: 1.15.20.8 $
*
* This file is part of OpenOffice.org.
*
@@ -55,29 +55,6 @@ namespace configmgr
namespace util = css::util;
namespace container = css::container;
- using uno::Reference;
- using uno::Any;
- using uno::Sequence;
- using uno::Exception;
- using uno::RuntimeException;
- using lang::NoSupportException;
- using lang::IllegalArgumentException;
- using lang::WrappedTargetException;
- using container::NoSuchElementException;
- using container::ElementExistException;
-
- using configuration::NodeRef;
- using configuration::NodeChange;
- using configuration::Tree;
- using configuration::ElementRef;
- using configuration::ElementTree;
- using configuration::Tree;
- using configuration::Name;
- using configuration::AbsolutePath;
- using configuration::RelativePath;
- using configuration::validateChildName;
- using configuration::validateElementName;
-
// Interface methods
//-----------------------------------------------------------------------------------
@@ -87,45 +64,45 @@ namespace configmgr
// XNameReplace
//-----------------------------------------------------------------------------------
-void implReplaceByName(NodeGroupAccess& rNode, const OUString& sName, const Any& rElement )
- throw(IllegalArgumentException, NoSuchElementException, WrappedTargetException, RuntimeException)
+void implReplaceByName(NodeGroupAccess& rNode, const rtl::OUString& sName, const uno::Any& rElement )
+ throw(lang::IllegalArgumentException, container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
{
try
{
- GuardedGroupUpdateAccess lock( rNode );
+ GuardedNodeUpdate<NodeGroupAccess> lock( rNode );
- Tree const aTree( lock.getTree() );
- NodeRef const aNode( lock.getNode() );
+ rtl::Reference< configuration::Tree > const aTree( lock.getTree() );
+ configuration::NodeRef const aNode( lock.getNode() );
- Name aChildName = validateChildName(sName,aTree,aNode);
+ rtl::OUString aChildName = configuration::validateChildName(sName,aTree,aNode);
- ValueRef aChildValue( aTree.getChildValue(aNode, aChildName) );
+ configuration::ValueRef aChildValue( aTree->getChildValue(aNode, aChildName) );
if (!aChildValue.isValid())
{
- if (aTree.hasChildNode(aNode, aChildName))
+ if (aTree->hasChildNode(aNode, aChildName))
{
- OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Configuration - Cannot set Value. Node '") );
+ rtl::OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Configuration - Cannot set Value. Node '") );
sMessage += sName;
- sMessage += OUString( RTL_CONSTASCII_USTRINGPARAM("' is not a simple value.") );
+ sMessage += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("' is not a simple value.") );
- Reference<uno::XInterface> xContext( rNode.getUnoInstance() );
- throw IllegalArgumentException( sMessage, xContext, 2 );
+ uno::Reference<uno::XInterface> xContext( rNode.getUnoInstance() );
+ throw lang::IllegalArgumentException( sMessage, xContext, 2 );
}
else
{
OSL_ENSURE(!configuration::hasChildOrElement(aTree,aNode,aChildName),"ERROR: Configuration: Existing child node not found by implementation");
- OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Configuration - Cannot set Value. Value '") );
+ rtl::OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Configuration - Cannot set Value. Value '") );
sMessage += sName;
- sMessage += OUString( RTL_CONSTASCII_USTRINGPARAM("' not found in ") );
- sMessage += aTree.getAbsolutePath(aNode).toString();
+ sMessage += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("' not found in ") );
+ sMessage += aTree->getAbsolutePath(aNode).toString();
- Reference<uno::XInterface> xContext( rNode.getUnoInstance() );
- throw NoSuchElementException( sMessage, xContext );
+ uno::Reference<uno::XInterface> xContext( rNode.getUnoInstance() );
+ throw container::NoSuchElementException( sMessage, xContext );
}
}
- NodeChange aChange = lock.getNodeUpdater().validateSetValue(aChildValue, rElement);
+ configuration::NodeChange aChange = lock.getNodeUpdater().validateSetValue(aChildValue, rElement);
if (aChange.test().isChange())
{
@@ -134,7 +111,7 @@ void implReplaceByName(NodeGroupAccess& rNode, const OUString& sName, const Any&
aSender.queryConstraints(aChange);
- aTree.integrate(aChange, aNode, true);
+ aTree->integrate(aChange, aNode, true);
lock.clearForBroadcast();
aSender.notifyListeners(aChange);
@@ -143,9 +120,9 @@ void implReplaceByName(NodeGroupAccess& rNode, const OUString& sName, const Any&
catch (configuration::InvalidName& ex)
{
ExceptionMapper e(ex);
- OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Configuration - Cannot set Value: ") );
- Reference<uno::XInterface> xContext( rNode.getUnoInstance() );
- throw NoSuchElementException( e.message(), xContext );
+ rtl::OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Configuration - Cannot set Value: ") );
+ uno::Reference<uno::XInterface> xContext( rNode.getUnoInstance() );
+ throw container::NoSuchElementException( e.message(), xContext );
}
catch (configuration::TypeMismatch& ex)
{
@@ -167,50 +144,50 @@ void implReplaceByName(NodeGroupAccess& rNode, const OUString& sName, const Any&
}
catch (css::beans::PropertyVetoException& ex)
{
- OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Configuration - Cannot set Value. Change was Vetoed: ") );
- throw WrappedTargetException( sMessage += ex.Message, rNode.getUnoInstance(), uno::makeAny(ex) );
+ rtl::OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Configuration - Cannot set Value. Change was Vetoed: ") );
+ throw lang::WrappedTargetException( sMessage += ex.Message, rNode.getUnoInstance(), uno::makeAny(ex) );
}
}
//-----------------------------------------------------------------------------------
-void implReplaceByName(NodeTreeSetAccess& rNode, const OUString& sName, const Any& rElement )
- throw(IllegalArgumentException, NoSuchElementException, WrappedTargetException, RuntimeException)
+void implReplaceByName(NodeTreeSetAccess& rNode, const rtl::OUString& sName, const uno::Any& rElement )
+ throw(lang::IllegalArgumentException, container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
{
try
{
- GuardedTreeSetUpdateAccess lock( rNode );
+ GuardedNodeUpdate<NodeTreeSetAccess> lock( rNode );
- Tree const aTree( lock.getTree() );
- NodeRef const aNode( lock.getNode() );
+ rtl::Reference< configuration::Tree > const aTree( lock.getTree() );
+ configuration::NodeRef const aNode( lock.getNode() );
- Name aChildName = validateElementName(sName,aTree,aNode);
+ rtl::OUString aChildName = configuration::validateElementName(sName,aTree,aNode);
- ElementRef aElement( aTree.getElement(aNode,aChildName) );
+ rtl::Reference< configuration::ElementTree > aElement( aTree->getElement(aNode,aChildName) );
- if (!aElement.isValid())
+ if (!aElement.is())
{
OSL_ENSURE(!configuration::hasChildOrElement(aTree,aNode,aChildName),"ERROR: Configuration: Existing Set element not found by implementation");
- OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Configuration - Cannot replace Set Element. Element '") );
+ rtl::OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Configuration - Cannot replace Set Element. Element '") );
sMessage += sName;
- sMessage += OUString( RTL_CONSTASCII_USTRINGPARAM("' not found in Set ") );
- sMessage += aTree.getAbsolutePath(aNode).toString();
+ sMessage += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("' not found in Set ") );
+ sMessage += aTree->getAbsolutePath(aNode).toString();
- Reference<uno::XInterface> xContext( rNode.getUnoInstance() );
- throw NoSuchElementException( sMessage, xContext );
+ uno::Reference<uno::XInterface> xContext( rNode.getUnoInstance() );
+ throw container::NoSuchElementException( sMessage, xContext );
}
- ElementTree aElementTree = configapi::extractElementTree(rNode.getFactory(), rElement, rNode.getElementInfo());
- if (!aElementTree.isValid())
+ rtl::Reference< configuration::ElementTree > aElementTree = configapi::extractElementTree(rNode.getFactory(), rElement, rNode.getElementInfo());
+ if (!aElementTree.is())
{
- OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Configuration - Cannot replace Set Element: ") );
- sMessage += OUString( RTL_CONSTASCII_USTRINGPARAM("Replacing object was not created from this set's template") );
+ rtl::OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Configuration - Cannot replace Set Element: ") );
+ sMessage += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Replacing object was not created from this set's template") );
- Reference<uno::XInterface> xContext( rNode.getUnoInstance() );
- throw IllegalArgumentException( sMessage, xContext, 2 );
+ uno::Reference<uno::XInterface> xContext( rNode.getUnoInstance() );
+ throw lang::IllegalArgumentException( sMessage, xContext, 2 );
}
- NodeChange aChange = lock.getNodeUpdater().validateReplaceElement( aElement, aElementTree );
+ configuration::NodeChange aChange = lock.getNodeUpdater().validateReplaceElement( aElement, aElementTree );
if (aChange.test().isChange())
{
@@ -218,7 +195,7 @@ void implReplaceByName(NodeTreeSetAccess& rNode, const OUString& sName, const An
//aSender.queryConstraints(aChange); - N/A: no external constraints on set children possible
- aTree.integrate(aChange, aNode, true);
+ aTree->integrate(aChange, aNode, true);
attachSetElement(rNode, aElementTree);
lock.clearForBroadcast();
@@ -228,9 +205,9 @@ void implReplaceByName(NodeTreeSetAccess& rNode, const OUString& sName, const An
catch (configuration::InvalidName& ex)
{
ExceptionMapper e(ex);
- OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Configuration - Cannot replace Set Element: ") );
- Reference<uno::XInterface> xContext( rNode.getUnoInstance() );
- throw NoSuchElementException( e.message(), xContext );
+ rtl::OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Configuration - Cannot replace Set Element: ") );
+ uno::Reference<uno::XInterface> xContext( rNode.getUnoInstance() );
+ throw container::NoSuchElementException( e.message(), xContext );
}
catch (configuration::TypeMismatch& ex)
{
@@ -247,34 +224,34 @@ void implReplaceByName(NodeTreeSetAccess& rNode, const OUString& sName, const An
}
//-----------------------------------------------------------------------------------
-void implReplaceByName(NodeValueSetAccess& rNode, const OUString& sName, const Any& rElement )
- throw(IllegalArgumentException, NoSuchElementException, WrappedTargetException, RuntimeException)
+void implReplaceByName(NodeValueSetAccess& rNode, const rtl::OUString& sName, const uno::Any& rElement )
+ throw(lang::IllegalArgumentException, container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
{
try
{
- GuardedValueSetUpdateAccess lock( rNode );
+ GuardedNodeUpdate<NodeValueSetAccess> lock( rNode );
- Tree const aTree( lock.getTree() );
- NodeRef const aNode( lock.getNode() );
+ rtl::Reference< configuration::Tree > const aTree( lock.getTree() );
+ configuration::NodeRef const aNode( lock.getNode() );
- Name aChildName = validateElementName(sName,aTree,aNode);
+ rtl::OUString aChildName = configuration::validateElementName(sName,aTree,aNode);
- ElementRef aElement( aTree.getElement(aNode,aChildName) );
+ rtl::Reference< configuration::ElementTree > aElement( aTree->getElement(aNode,aChildName) );
- if (!aElement.isValid())
+ if (!aElement.is())
{
OSL_ENSURE(!configuration::hasChildOrElement(aTree,aNode,aChildName),"ERROR: Configuration: Existing Set element not found by implementation");
- OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Configuration - Cannot replace Set Element. Element '") );
+ rtl::OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Configuration - Cannot replace Set Element. Element '") );
sMessage += sName;
- sMessage += OUString( RTL_CONSTASCII_USTRINGPARAM("' not found in Set ") );
- sMessage += aTree.getAbsolutePath(aNode).toString();
+ sMessage += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("' not found in Set ") );
+ sMessage += aTree->getAbsolutePath(aNode).toString();
- Reference<uno::XInterface> xContext( rNode.getUnoInstance() );
- throw NoSuchElementException( sMessage, xContext );
+ uno::Reference<uno::XInterface> xContext( rNode.getUnoInstance() );
+ throw container::NoSuchElementException( sMessage, xContext );
}
- NodeChange aChange = lock.getNodeUpdater().validateReplaceElement( aElement, rElement );
+ configuration::NodeChange aChange = lock.getNodeUpdater().validateReplaceElement( aElement, rElement );
if (aChange.test().isChange())
{
@@ -282,7 +259,7 @@ void implReplaceByName(NodeValueSetAccess& rNode, const OUString& sName, const A
//aSender.queryConstraints(aChange); - N/A: no external constraints on set children possible
- aTree.integrate(aChange, aNode, true);
+ aTree->integrate(aChange, aNode, true);
lock.clearForBroadcast();
aSender.notifyListeners(aChange);
@@ -291,9 +268,9 @@ void implReplaceByName(NodeValueSetAccess& rNode, const OUString& sName, const A
catch (configuration::InvalidName& ex)
{
ExceptionMapper e(ex);
- OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Configuration - Cannot replace Set Element: ") );
- Reference<uno::XInterface> xContext( rNode.getUnoInstance() );
- throw NoSuchElementException( e.message(), xContext );
+ rtl::OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Configuration - Cannot replace Set Element: ") );
+ uno::Reference<uno::XInterface> xContext( rNode.getUnoInstance() );
+ throw container::NoSuchElementException( e.message(), xContext );
}
catch (configuration::TypeMismatch& ex)
{
@@ -317,41 +294,41 @@ void implReplaceByName(NodeValueSetAccess& rNode, const OUString& sName, const A
// XNameContainer
//-----------------------------------------------------------------------------------
-void implInsertByName(NodeTreeSetAccess& rNode, const OUString& sName, const Any& rElement)
- throw(IllegalArgumentException, ElementExistException, WrappedTargetException, RuntimeException)
+void implInsertByName(NodeTreeSetAccess& rNode, const rtl::OUString& sName, const uno::Any& rElement)
+ throw(lang::IllegalArgumentException, container::ElementExistException, lang::WrappedTargetException, uno::RuntimeException)
{
try
{
- GuardedTreeSetUpdateAccess lock( rNode );
+ GuardedNodeUpdate<NodeTreeSetAccess> lock( rNode );
- Tree const aTree( lock.getTree() );
- NodeRef const aNode( lock.getNode() );
+ rtl::Reference< configuration::Tree > const aTree( lock.getTree() );
+ configuration::NodeRef const aNode( lock.getNode() );
- Name aChildName = validateElementName(sName,aTree,aNode);
+ rtl::OUString aChildName = configuration::validateElementName(sName,aTree,aNode);
- if( aTree.hasElement(aNode,aChildName) )
+ if( aTree->hasElement(aNode,aChildName) )
{
- OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Configuration - Cannot insert into Set. Element '") );
+ rtl::OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Configuration - Cannot insert into Set. Element '") );
sMessage += sName;
- sMessage += OUString( RTL_CONSTASCII_USTRINGPARAM("' is already present in Set ") );
- sMessage += aTree.getAbsolutePath(aNode).toString();
+ sMessage += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("' is already present in Set ") );
+ sMessage += aTree->getAbsolutePath(aNode).toString();
- Reference<uno::XInterface> xContext( rNode.getUnoInstance() );
- throw ElementExistException( sMessage, xContext );
+ uno::Reference<uno::XInterface> xContext( rNode.getUnoInstance() );
+ throw container::ElementExistException( sMessage, xContext );
}
OSL_ENSURE(!configuration::hasChildOrElement(aTree,aNode,aChildName),"ERROR: Configuration: Existing Set element not found by implementation");
- ElementTree aElementTree = configapi::extractElementTree(rNode.getFactory(), rElement, rNode.getElementInfo());
- if (!aElementTree.isValid())
+ rtl::Reference< configuration::ElementTree > aElementTree = configapi::extractElementTree(rNode.getFactory(), rElement, rNode.getElementInfo());
+ if (!aElementTree.is())
{
- OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Configuration - Cannot insert into Set: ") );
- sMessage += OUString( RTL_CONSTASCII_USTRINGPARAM("Inserted object was not created from this set's template") );
+ rtl::OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Configuration - Cannot insert into Set: ") );
+ sMessage += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Inserted object was not created from this set's template") );
- Reference<uno::XInterface> xContext( rNode.getUnoInstance() );
- throw IllegalArgumentException( sMessage, xContext, 2 );
+ uno::Reference<uno::XInterface> xContext( rNode.getUnoInstance() );
+ throw lang::IllegalArgumentException( sMessage, xContext, 2 );
}
- NodeChange aChange = lock.getNodeUpdater().validateInsertElement(aChildName, aElementTree);
+ configuration::NodeChange aChange = lock.getNodeUpdater().validateInsertElement(aChildName, aElementTree);
aChange.test(); // make sure old values are set up correctly
OSL_ENSURE(aChange.isChange(), "ERROR: Adding a node validated as empty change");
@@ -360,7 +337,7 @@ void implInsertByName(NodeTreeSetAccess& rNode, const OUString& sName, const Any
//aSender.queryConstraints(); - N/A: no external constraints on set children possible
- aTree.integrate(aChange, aNode, true);
+ aTree->integrate(aChange, aNode, true);
attachSetElement(rNode, aElementTree);
lock.clearForBroadcast();
@@ -389,31 +366,31 @@ void implInsertByName(NodeTreeSetAccess& rNode, const OUString& sName, const Any
//-----------------------------------------------------------------------------------
-void implInsertByName(NodeValueSetAccess& rNode, const OUString& sName, const Any& rElement)
- throw(IllegalArgumentException, ElementExistException, WrappedTargetException, RuntimeException)
+void implInsertByName(NodeValueSetAccess& rNode, const rtl::OUString& sName, const uno::Any& rElement)
+ throw(lang::IllegalArgumentException, container::ElementExistException, lang::WrappedTargetException, uno::RuntimeException)
{
try
{
- GuardedValueSetUpdateAccess lock( rNode );
+ GuardedNodeUpdate<NodeValueSetAccess> lock( rNode );
- Tree const aTree( lock.getTree() );
- NodeRef const aNode( lock.getNode() );
+ rtl::Reference< configuration::Tree > const aTree( lock.getTree() );
+ configuration::NodeRef const aNode( lock.getNode() );
- Name aChildName = validateElementName(sName,aTree,aNode);
+ rtl::OUString aChildName = configuration::validateElementName(sName,aTree,aNode);
- if( aTree.hasElement(aNode,aChildName) )
+ if( aTree->hasElement(aNode,aChildName) )
{
- OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Configuration - Cannot insert into Set. Element '") );
+ rtl::OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Configuration - Cannot insert into Set. Element '") );
sMessage += sName;
- sMessage += OUString( RTL_CONSTASCII_USTRINGPARAM("' is already present in Set ") );
- sMessage += aTree.getAbsolutePath(aNode).toString();
+ sMessage += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("' is already present in Set ") );
+ sMessage += aTree->getAbsolutePath(aNode).toString();
- Reference<uno::XInterface> xContext( rNode.getUnoInstance() );
- throw ElementExistException( sMessage, xContext );
+ uno::Reference<uno::XInterface> xContext( rNode.getUnoInstance() );
+ throw container::ElementExistException( sMessage, xContext );
}
OSL_ENSURE(!configuration::hasChildOrElement(aTree,aNode,aChildName),"ERROR: Configuration: Existing Set element not found by implementation");
- NodeChange aChange = lock.getNodeUpdater().validateInsertElement(aChildName, rElement);
+ configuration::NodeChange aChange = lock.getNodeUpdater().validateInsertElement(aChildName, rElement);
aChange.test(); // make sure old values are set up correctly
OSL_ENSURE(aChange.isChange(), "ERROR: Adding a node validated as empty change");
@@ -422,7 +399,7 @@ void implInsertByName(NodeValueSetAccess& rNode, const OUString& sName, const An
//aSender.queryConstraints(); - N/A: no external constraints on set children possible
- aTree.integrate(aChange, aNode, true);
+ aTree->integrate(aChange, aNode, true);
lock.clearForBroadcast();
aSender.notifyListeners(aChange);
@@ -455,34 +432,34 @@ void implInsertByName(NodeValueSetAccess& rNode, const OUString& sName, const An
}
//-----------------------------------------------------------------------------------
-void implRemoveByName(NodeTreeSetAccess& rNode, const OUString& sName )
- throw(css::container::NoSuchElementException, WrappedTargetException, RuntimeException)
+void implRemoveByName(NodeTreeSetAccess& rNode, const rtl::OUString& sName )
+ throw(css::container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
{
try
{
- GuardedTreeSetUpdateAccess lock( rNode );
+ GuardedNodeUpdate<NodeTreeSetAccess> lock( rNode );
- Tree const aTree( lock.getTree() );
- NodeRef const aNode( lock.getNode() );
+ rtl::Reference< configuration::Tree > const aTree( lock.getTree() );
+ configuration::NodeRef const aNode( lock.getNode() );
- Name aChildName = validateElementName(sName,aTree,aNode);
+ rtl::OUString aChildName = configuration::validateElementName(sName,aTree,aNode);
- ElementRef aElement( aTree.getElement(aNode,aChildName) );
+ rtl::Reference< configuration::ElementTree > aElement( aTree->getElement(aNode,aChildName) );
- if (!aElement.isValid())
+ if (!aElement.is())
{
OSL_ENSURE(!configuration::hasChildOrElement(aTree,aNode,aChildName),"ERROR: Configuration: Existing Set element not found by implementation");
- OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Configuration - Cannot remove Set Element. Element '") );
+ rtl::OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Configuration - Cannot remove Set Element. Element '") );
sMessage += sName;
- sMessage += OUString( RTL_CONSTASCII_USTRINGPARAM("' not found in Set ") );
- sMessage += aTree.getAbsolutePath(aNode).toString();
+ sMessage += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("' not found in Set ") );
+ sMessage += aTree->getAbsolutePath(aNode).toString();
- Reference<uno::XInterface> xContext( rNode.getUnoInstance() );
- throw NoSuchElementException( sMessage, xContext );
+ uno::Reference<uno::XInterface> xContext( rNode.getUnoInstance() );
+ throw container::NoSuchElementException( sMessage, xContext );
}
- NodeChange aChange = lock.getNodeUpdater().validateRemoveElement(aElement);
+ configuration::NodeChange aChange = lock.getNodeUpdater().validateRemoveElement(aElement);
aChange.test(); // make sure old values are set up correctly
OSL_ENSURE(aChange.isChange(), "ERROR: Removing a node validated as empty change");
@@ -491,7 +468,7 @@ void implRemoveByName(NodeTreeSetAccess& rNode, const OUString& sName )
//aSender.queryConstraints(); - N/A: no external constraints on set children possible
- aTree.integrate(aChange, aNode, true);
+ aTree->integrate(aChange, aNode, true);
detachSetElement(rNode.getFactory(), aElement);
lock.clearForBroadcast();
@@ -500,9 +477,9 @@ void implRemoveByName(NodeTreeSetAccess& rNode, const OUString& sName )
catch (configuration::InvalidName& ex)
{
ExceptionMapper e(ex);
- OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Configuration - Cannot remove Set Element: ") );
- Reference<uno::XInterface> xContext( rNode.getUnoInstance() );
- throw NoSuchElementException( sMessage += e.message(), xContext );
+ rtl::OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Configuration - Cannot remove Set Element: ") );
+ uno::Reference<uno::XInterface> xContext( rNode.getUnoInstance() );
+ throw container::NoSuchElementException( sMessage += e.message(), xContext );
}
catch (configuration::Exception& ex)
{
@@ -513,33 +490,33 @@ void implRemoveByName(NodeTreeSetAccess& rNode, const OUString& sName )
}
//-----------------------------------------------------------------------------------
-void implRemoveByName(NodeValueSetAccess& rNode, const OUString& sName )
- throw(css::container::NoSuchElementException, WrappedTargetException, RuntimeException)
+void implRemoveByName(NodeValueSetAccess& rNode, const rtl::OUString& sName )
+ throw(css::container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
{
try
{
- GuardedValueSetUpdateAccess lock( rNode );
+ GuardedNodeUpdate<NodeValueSetAccess> lock( rNode );
- Tree const aTree( lock.getTree() );
- NodeRef const aNode( lock.getNode() );
+ rtl::Reference< configuration::Tree > const aTree( lock.getTree() );
+ configuration::NodeRef const aNode( lock.getNode() );
- Name aChildName = validateElementName(sName,aTree,aNode);
+ rtl::OUString aChildName = configuration::validateElementName(sName,aTree,aNode);
- ElementRef aElement = aTree.getElement(aNode,aChildName);
- if (!aElement.isValid())
+ rtl::Reference< configuration::ElementTree > aElement = aTree->getElement(aNode,aChildName);
+ if (!aElement.is())
{
OSL_ENSURE(!configuration::hasChildOrElement(aTree,aNode,aChildName),"ERROR: Configuration: Existing Set element not found by implementation");
- OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Configuration - Cannot remove Set Element. Element '") );
+ rtl::OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Configuration - Cannot remove Set Element. Element '") );
sMessage += sName;
- sMessage += OUString( RTL_CONSTASCII_USTRINGPARAM("' not found in Set ") );
- sMessage += aTree.getAbsolutePath(aNode).toString();
+ sMessage += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("' not found in Set ") );
+ sMessage += aTree->getAbsolutePath(aNode).toString();
- Reference<uno::XInterface> xContext( rNode.getUnoInstance() );
- throw NoSuchElementException( sMessage, xContext );
+ uno::Reference<uno::XInterface> xContext( rNode.getUnoInstance() );
+ throw container::NoSuchElementException( sMessage, xContext );
}
- NodeChange aChange = lock.getNodeUpdater().validateRemoveElement(aElement);
+ configuration::NodeChange aChange = lock.getNodeUpdater().validateRemoveElement(aElement);
aChange.test(); // make sure old values are set up correctly
OSL_ENSURE(aChange.isChange(), "ERROR: Removing a node validated as empty change");
@@ -548,7 +525,7 @@ void implRemoveByName(NodeValueSetAccess& rNode, const OUString& sName )
//aSender.queryConstraints(); - N/A: no external constraints on set children possible
- aTree.integrate(aChange, aNode, true);
+ aTree->integrate(aChange, aNode, true);
lock.clearForBroadcast();
aSender.notifyListeners(aChange);
@@ -556,9 +533,9 @@ void implRemoveByName(NodeValueSetAccess& rNode, const OUString& sName )
catch (configuration::InvalidName& ex)
{
ExceptionMapper e(ex);
- OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Configuration - Cannot remove Set Element: ") );
- Reference<uno::XInterface> xContext( rNode.getUnoInstance() );
- throw NoSuchElementException( sMessage += e.message(), xContext );
+ rtl::OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Configuration - Cannot remove Set Element: ") );
+ uno::Reference<uno::XInterface> xContext( rNode.getUnoInstance() );
+ throw container::NoSuchElementException( sMessage += e.message(), xContext );
}
catch (configuration::Exception& ex)
{
@@ -578,14 +555,14 @@ void implSetToDefaultAsProperty(NodeSetAccess& rNode)
{
try
{
- GuardedSetUpdateAccess lock( rNode );
+ GuardedNodeUpdate<NodeSetAccess> lock( rNode );
- Tree const aTree( lock.getTree() );
- NodeRef const aNode( lock.getNode() );
+ rtl::Reference< configuration::Tree > const aTree( lock.getTree() );
+ configuration::NodeRef const aNode( lock.getNode() );
configuration::SetDefaulter aDefaulter = lock.getNodeDefaulter();
- NodeChange aChange = aDefaulter.validateSetToDefaultState();
+ configuration::NodeChange aChange = aDefaulter.validateSetToDefaultState();
const bool bLocal = true;
@@ -595,7 +572,7 @@ void implSetToDefaultAsProperty(NodeSetAccess& rNode)
aSender.queryConstraints(aChange);
- aTree.integrate(aChange, aNode, bLocal);
+ aTree->integrate(aChange, aNode, bLocal);
lock.clearForBroadcast();
aSender.notifyListeners(aChange);
@@ -604,8 +581,8 @@ void implSetToDefaultAsProperty(NodeSetAccess& rNode)
catch (configuration::ConstraintViolation & ex)
{
ExceptionMapper e(ex);
- OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Configuration - Cannot restore Default: ") );
- Reference<uno::XInterface> xContext( rNode.getUnoInstance() );
+ rtl::OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Configuration - Cannot restore Default: ") );
+ uno::Reference<uno::XInterface> xContext( rNode.getUnoInstance() );
throw lang::WrappedTargetException( sMessage += e.message(), xContext, uno::Any());
}
@@ -619,8 +596,8 @@ void implSetToDefaultAsProperty(NodeSetAccess& rNode)
catch (uno::RuntimeException& ) { throw;}
catch (uno::Exception& e)
{
- OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Configuration - Cannot restore Default: ") );
- Reference<uno::XInterface> xContext( rNode.getUnoInstance() );
+ rtl::OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Configuration - Cannot restore Default: ") );
+ uno::Reference<uno::XInterface> xContext( rNode.getUnoInstance() );
throw lang::WrappedTargetException( sMessage += e.Message, xContext, uno::makeAny(e));
}
@@ -629,17 +606,17 @@ void implSetToDefaultAsProperty(NodeSetAccess& rNode)
// XSingleServiceFactory
//-----------------------------------------------------------------------------------
-Reference< uno::XInterface > implCreateElement(NodeTreeSetAccess& rNode )
- throw(Exception, RuntimeException)
+uno::Reference< uno::XInterface > implCreateElement(NodeTreeSetAccess& rNode )
+ throw(uno::Exception, uno::RuntimeException)
{
- Reference< uno::XInterface > xRet;
+ uno::Reference< uno::XInterface > xRet;
try
{
GuardedNodeData<NodeSetAccess> lock( rNode ); // no provider lock needed ? => if template lock is separate - OK
- ElementTree aNewElement( rNode.getElementFactory().instantiateTemplate(rNode.getElementInfo().getTemplate()) );
+ rtl::Reference< configuration::ElementTree > aNewElement( rNode.getElementFactory().instantiateTemplate(rNode.getElementInfo()) );
- Any aAny = configapi::makeElement( rNode.getFactory(), aNewElement );
+ uno::Any aAny = configapi::makeElement( rNode.getFactory(), aNewElement );
if (!(aAny >>= xRet)) // no parent available
{
OSL_ASSERT(!xRet.is()); // make sure we return NULL
@@ -657,8 +634,8 @@ Reference< uno::XInterface > implCreateElement(NodeTreeSetAccess& rNode )
}
//-----------------------------------------------------------------------------------
-Reference< uno::XInterface > implCreateElement(NodeTreeSetAccess& rNode, const Sequence< Any >& aArguments )
- throw(Exception, RuntimeException)
+uno::Reference< uno::XInterface > implCreateElement(NodeTreeSetAccess& rNode, const uno::Sequence< uno::Any >& aArguments )
+ throw(uno::Exception, uno::RuntimeException)
{
{ (void)aArguments; }
OSL_ENSURE(aArguments.getLength() == 0, "ConfigurationContainer: createInstance: Arguments not supported - ignoring ...");
diff --git a/configmgr/source/api2/updateimpl.hxx b/configmgr/source/api2/updateimpl.hxx
index 9465ee1482..77b510f424 100644
--- a/configmgr/source/api2/updateimpl.hxx
+++ b/configmgr/source/api2/updateimpl.hxx
@@ -39,7 +39,6 @@ namespace configmgr
{
namespace css = ::com::sun::star;
namespace uno = ::com::sun::star::uno;
- using rtl::OUString;
/* implementations of the interfaces supported by a (parent) node
within the configuration tree.
@@ -54,27 +53,27 @@ namespace configmgr
// XNameReplace
//---------------------------------------------------------------------
- void implReplaceByName(NodeGroupAccess& rNode, const OUString& rName, const uno::Any& rElement )
+ void implReplaceByName(NodeGroupAccess& rNode, const rtl::OUString& rName, const uno::Any& rElement )
throw(css::lang::IllegalArgumentException, css::container::NoSuchElementException, css::lang::WrappedTargetException, uno::RuntimeException);
- void implReplaceByName(NodeTreeSetAccess& rNode, const OUString& rName, const uno::Any& rElement )
+ void implReplaceByName(NodeTreeSetAccess& rNode, const rtl::OUString& rName, const uno::Any& rElement )
throw(css::lang::IllegalArgumentException, css::container::NoSuchElementException, css::lang::WrappedTargetException, uno::RuntimeException);
- void implReplaceByName(NodeValueSetAccess& rNode, const OUString& rName, const uno::Any& rElement )
+ void implReplaceByName(NodeValueSetAccess& rNode, const rtl::OUString& rName, const uno::Any& rElement )
throw(css::lang::IllegalArgumentException, css::container::NoSuchElementException, css::lang::WrappedTargetException, uno::RuntimeException);
// XNameContainer
//---------------------------------------------------------------------
- void implInsertByName(NodeTreeSetAccess& rNode, const OUString& rName, const uno::Any& rElement)
+ void implInsertByName(NodeTreeSetAccess& rNode, const rtl::OUString& rName, const uno::Any& rElement)
throw(css::lang::IllegalArgumentException, css::container::ElementExistException, css::lang::WrappedTargetException, uno::RuntimeException);
- void implInsertByName(NodeValueSetAccess& rNode, const OUString& rName, const uno::Any& rElement)
+ void implInsertByName(NodeValueSetAccess& rNode, const rtl::OUString& rName, const uno::Any& rElement)
throw(css::lang::IllegalArgumentException, css::container::ElementExistException, css::lang::WrappedTargetException, uno::RuntimeException);
- void implRemoveByName(NodeTreeSetAccess& rNode, const OUString& rName )
+ void implRemoveByName(NodeTreeSetAccess& rNode, const rtl::OUString& rName )
throw(css::container::NoSuchElementException, css::lang::WrappedTargetException, uno::RuntimeException);
- void implRemoveByName(NodeValueSetAccess& rNode, const OUString& rName )
+ void implRemoveByName(NodeValueSetAccess& rNode, const rtl::OUString& rName )
throw(css::container::NoSuchElementException, css::lang::WrappedTargetException, uno::RuntimeException);
// XPropertyWithState - updating operation only
diff --git a/configmgr/source/backend/backendaccess.cxx b/configmgr/source/backend/backendaccess.cxx
index c503177d4c..c84a4d7e5e 100644
--- a/configmgr/source/backend/backendaccess.cxx
+++ b/configmgr/source/backend/backendaccess.cxx
@@ -73,12 +73,11 @@
#define OU2A(rtlOUString) (::rtl::OUStringToOString((rtlOUString), RTL_TEXTENCODING_ASCII_US).getStr())
#define RTL_LOGFILE_OU2A(rtlOUString) OU2A(rtlOUString)
-#define OUSTR(txt) OUString( RTL_CONSTASCII_USTRINGPARAM(txt) )
+#define OUSTR(txt) rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(txt) )
namespace configmgr { namespace backend {
//------------------------------------------------------------------------------
namespace task = com::sun::star::task;
- typedef uno::Reference< backenduno::XUpdatableLayer > LayerDataRemover;
inline
uno::Reference<lang::XMultiServiceFactory> BackendAccess::getServiceFactory() const
@@ -96,7 +95,7 @@ BackendAccess::BackendAccess(
{
OSL_ENSURE(mContext.is(), "BackendAccess: Context is missing");
if (!mContext.is())
- throw lang::NullPointerException(OUString::createFromAscii("BackendAccess: NULL Context passed"), NULL);
+ throw lang::NullPointerException(rtl::OUString::createFromAscii("BackendAccess: NULL Context passed"), NULL);
if (!xBackend.is())
throw lang::NullPointerException(OUSTR("Configuration: Trying to create backend access without backend"),NULL);
if (!uno::Reference<backenduno::XSchemaSupplier>::query(xBackend).is())
@@ -119,15 +118,13 @@ BackendAccess::~BackendAccess() {}
//------------------------------------------------------------------------------
namespace
{
- using localehelper::Locale;
- using localehelper::LocaleSequence;
//------------------------------------------------------------------------------
static inline
- bool findLocale(LocaleSequence const & seq, Locale const & loc)
+ bool findLocale(std::vector< com::sun::star::lang::Locale > const & seq, com::sun::star::lang::Locale const & loc)
{
- LocaleSequence::const_iterator first = seq.begin();
- LocaleSequence::const_iterator last = seq.end();
+ std::vector< com::sun::star::lang::Locale >::const_iterator first = seq.begin();
+ std::vector< com::sun::star::lang::Locale >::const_iterator last = seq.end();
for ( ; first != last; ++first)
if (localehelper::equalLocale(*first, loc))
return true;
@@ -136,14 +133,14 @@ namespace
//------------------------------------------------------------------------------
static inline
- void addLocale( Locale const & aLocale, LocaleSequence & inoutLocales)
+ void addLocale( com::sun::star::lang::Locale const & aLocale, std::vector< com::sun::star::lang::Locale > & inoutLocales)
{
if (!findLocale(inoutLocales,aLocale))
inoutLocales.push_back(aLocale);
}
//------------------------------------------------------------------------------
- static OUString toString(uno::Sequence< OUString > const & seq, sal_Unicode separator = ',')
+ static rtl::OUString toString(uno::Sequence< rtl::OUString > const & seq, sal_Unicode separator = ',')
{
rtl::OUStringBuffer buf;
@@ -161,13 +158,13 @@ namespace
//------------------------------------------------------------------------------
static
- uno::Sequence< OUString > intersect(uno::Sequence< OUString > const & seq1, uno::Sequence< OUString > const & seq2)
+ uno::Sequence< rtl::OUString > intersect(uno::Sequence< rtl::OUString > const & seq1, uno::Sequence< rtl::OUString > const & seq2)
{
sal_Int32 const len1 = seq1.getLength();
- uno::Sequence< OUString > aResult(len1);
+ uno::Sequence< rtl::OUString > aResult(len1);
- OUString const * const beg2 = seq2.getConstArray();
- OUString const * const end2 = beg2 + seq2.getLength();
+ rtl::OUString const * const beg2 = seq2.getConstArray();
+ rtl::OUString const * const end2 = beg2 + seq2.getLength();
sal_Int32 ix = 0;
for (sal_Int32 i1 = 0; i1 < len1; ++i1)
@@ -212,17 +209,17 @@ uno::Sequence< rtl::OUString >
return aResult;
}
//------------------------------------------------------------------------------
-static OUString getLayerURL(const uno::Reference<backenduno::XLayer> & aLayer);
+static rtl::OUString getLayerURL(const uno::Reference<backenduno::XLayer> & aLayer);
void BackendAccess::merge(
MergedComponentData& aData,
const uno::Reference<backenduno::XLayer> * pLayers,
sal_Int32 aNumLayers,
- localehelper::Locale const & aRequestedLocale,
- localehelper::LocaleSequence & inoutMergedLocales,
+ com::sun::star::lang::Locale const & aRequestedLocale,
+ std::vector< com::sun::star::lang::Locale > & inoutMergedLocales,
ITemplateDataProvider *aTemplateProvider,
sal_Int32 * pLayersMerged)
- CFG_UNO_THROW_ALL()
+ SAL_THROW((com::sun::star::uno::Exception))
{
LayerMergeHandler * pMerger = new LayerMergeHandler(mContext, aData, aTemplateProvider );
uno::Reference<backenduno::XLayerHandler> xLayerMerger(pMerger);
@@ -232,7 +229,7 @@ void BackendAccess::merge(
RTL_LOGFILE_CONTEXT_AUTHOR(aLog, "configmgr::backend::BackendAccess", "jb99855", "configmgr: BackendAccess::merge()");
RTL_LOGFILE_CONTEXT_TRACE1(aLog, "merging %d layers", int(aNumLayers) );
- OUString const & aLanguage = aRequestedLocale.Language;
+ rtl::OUString const & aLanguage = aRequestedLocale.Language;
bool const needAllLanguages = localehelper::isAnyLanguage(aLanguage);
if (aLanguage.getLength() && !needAllLanguages)
@@ -280,8 +277,8 @@ void BackendAccess::merge(
for (sal_Int32 j = 0; j < aSubLayerIds.getLength(); ++j)
{
- OUString const & aLocaleIso = aSubLayerIds[j];
- Locale aLocale = localehelper::makeLocale(aLocaleIso);
+ rtl::OUString const & aLocaleIso = aSubLayerIds[j];
+ com::sun::star::lang::Locale aLocale = localehelper::makeLocale(aLocaleIso);
// requesting de-CH, we accept de-CH and de, but not de-DE
const localehelper::MatchQuality kMatchAccept = localehelper::MATCH_LANGUAGE_PLAIN;
@@ -306,22 +303,22 @@ void BackendAccess::merge(
//------------------------------------------------------------------------------
bool BackendAccess::readDefaultData( MergedComponentData & aComponentData,
- OUString const & aComponent,
+ rtl::OUString const & aComponent,
RequestOptions const & aOptions,
bool bIncludeTemplates,
const uno::Reference<backenduno::XLayer> * pLayers,
sal_Int32 nNumLayers,
ITemplateDataProvider *aTemplateProvider,
sal_Int32 * pLayersMerged)
- CFG_UNO_THROW_ALL()
+ SAL_THROW((com::sun::star::uno::Exception))
{
RTL_LOGFILE_CONTEXT_AUTHOR(aLog1, "configmgr::backend::BackendAccess", "jb99855", "configmgr: BackendAccess::readDefaultData()");
Logger logger(mContext);
- const Logger::Level detail = LogLevel::FINER;
+ const sal_Int32 detail = LogLevel::FINER;
bool const bLogDetail = logger.isLogging(detail);
- OUString const aSchemaVersion = this->getSchemaVersion(aComponent);
+ rtl::OUString const aSchemaVersion = this->getSchemaVersion(aComponent);
if (logger.isLogging(LogLevel::FINE))
{
@@ -332,8 +329,8 @@ bool BackendAccess::readDefaultData( MergedComponentData & aComponentData,
logger.fine( aMsg.makeStringAndClear(), "readDefaultData()","configmgr::Backend");
}
- localehelper::Locale const aRequestedLocale = localehelper::makeLocale(aOptions.getLocale());
- localehelper::LocaleSequence aKnownLocales;
+ com::sun::star::lang::Locale const aRequestedLocale = localehelper::makeLocale(aOptions.getLocale());
+ std::vector< com::sun::star::lang::Locale > aKnownLocales;
if (bLogDetail) logger.log(detail, "... attempt to read from binary cache", "readDefaultData()","configmgr::Backend");
bool bCacheHit = mBinaryCache.readComponentData(aComponentData, getServiceFactory(),
@@ -384,7 +381,7 @@ bool BackendAccess::readDefaultData( MergedComponentData & aComponentData,
}
//------------------------------------------------------------------------------
-static OUString getLayerURL(const uno::Reference<backenduno::XLayer> & aLayer)
+static rtl::OUString getLayerURL(const uno::Reference<backenduno::XLayer> & aLayer)
{
try
{
@@ -393,7 +390,7 @@ static OUString getLayerURL(const uno::Reference<backenduno::XLayer> & aLayer)
if (xLayerProps.is())
{
uno::Any aPropVal = xLayerProps->getPropertyValue( OUSTR("URL") );
- OUString aResult;
+ rtl::OUString aResult;
if (aPropVal >>= aResult)
return aResult;
}
@@ -405,11 +402,11 @@ static OUString getLayerURL(const uno::Reference<backenduno::XLayer> & aLayer)
}
// TODO: use better fallback, e.g. ServiceName
const char * const aFallback = aLayer.is() ? "<Unknown Layer Type>" : "<NULL Layer>";
- return OUString::createFromAscii(aFallback);
+ return rtl::OUString::createFromAscii(aFallback);
}
//------------------------------------------------------------------------------
static inline
-OUString getLayerIdentifier(const uno::Reference<backenduno::XLayer> & aLayer)
+rtl::OUString getLayerIdentifier(const uno::Reference<backenduno::XLayer> & aLayer)
{
return getLayerURL(aLayer);
}
@@ -419,7 +416,7 @@ static void removeLayerData(uno::Reference< backenduno::XLayer > const & xLayer)
{
OSL_ASSERT(xLayer.is());
- LayerDataRemover xLayerRemover(xLayer,uno::UNO_QUERY);
+ uno::Reference< backenduno::XUpdatableLayer > xLayerRemover(xLayer,uno::UNO_QUERY);
if (xLayerRemover.is())
try
{
@@ -494,21 +491,19 @@ private:
bool BackendAccess::approveRecovery(const uno::Any & aMergeException,
const uno::Reference<backenduno::XLayer> & aBrokenLayer,
bool bUserLayerData)
- CFG_UNO_THROW_ALL()
+ SAL_THROW((com::sun::star::uno::Exception))
{
- using namespace apihelper;
- typedef SimpleInteractionRequest::Continuation Choice;
- Choice const k_supported_choices = CONTINUATION_APPROVE | CONTINUATION_DISAPPROVE;
+ sal_uInt32 const k_supported_choices = apihelper::CONTINUATION_APPROVE | apihelper::CONTINUATION_DISAPPROVE;
- Choice chosen = CONTINUATION_UNKNOWN;
+ sal_uInt32 chosen = apihelper::CONTINUATION_UNKNOWN;
- ConfigurationInteractionHandler handler;
+ apihelper::ConfigurationInteractionHandler handler;
try {
uno::Reference< task::XInteractionHandler > h(handler.get());
if (h.is()) {
handler.setRecursive(new RecursiveHandler(h));
- rtl::Reference< SimpleInteractionRequest > req(
- new SimpleInteractionRequest(
+ rtl::Reference< apihelper::SimpleInteractionRequest > req(
+ new apihelper::SimpleInteractionRequest(
uno::makeAny(
backenduno::MergeRecoveryRequest(
rtl::OUString(
@@ -518,7 +513,7 @@ bool BackendAccess::approveRecovery(const uno::Any & aMergeException,
aBrokenLayer, aMergeException,
getLayerIdentifier(aBrokenLayer),
(bUserLayerData
- && (LayerDataRemover::query(aBrokenLayer).is()
+ && (uno::Reference< backenduno::XUpdatableLayer >::query(aBrokenLayer).is()
|| FileHelper::fileExists(
getLayerURL(aBrokenLayer)))))),
k_supported_choices));
@@ -531,9 +526,9 @@ bool BackendAccess::approveRecovery(const uno::Any & aMergeException,
switch (chosen)
{
- case CONTINUATION_APPROVE: return true;
- case CONTINUATION_DISAPPROVE: return false;
- case CONTINUATION_UNKNOWN: break;
+ case apihelper::CONTINUATION_APPROVE: return true;
+ case apihelper::CONTINUATION_DISAPPROVE: return false;
+ case apihelper::CONTINUATION_UNKNOWN: break;
default: OSL_ENSURE(false,"Unsolicited continuation chosen"); break;
}
@@ -542,12 +537,12 @@ bool BackendAccess::approveRecovery(const uno::Any & aMergeException,
}
//------------------------------------------------------------------------------
-ComponentResult BackendAccess::getNodeData(const ComponentRequest& aRequest,
+ResultHolder< ComponentInstance > BackendAccess::getNodeData(const ComponentRequest& aRequest,
ITemplateDataProvider *_aTemplateProvider,
INodeDataListener *aListener)
- CFG_UNO_THROW_ALL()
+ SAL_THROW((com::sun::star::uno::Exception))
{
- rtl::OUString const component = aRequest.getComponentName().toString() ;
+ rtl::OUString const component = aRequest.getComponentName();
ITemplateDataProvider * const aTemplateProvider = _aTemplateProvider ? _aTemplateProvider : this;
RTL_LOGFILE_CONTEXT_AUTHOR(aLog, "configmgr::backend::BackendAccess", "jb99855", "configmgr: BackendAccess::getNodeData()");
@@ -587,7 +582,7 @@ ComponentResult BackendAccess::getNodeData(const ComponentRequest& aRequest,
//Merge User layer (with all locales)
logger.finer("... merging user layer", "getNodeData()","configmgr::Backend");
- localehelper::LocaleSequence aLocales;
+ std::vector< com::sun::star::lang::Locale > aLocales;
merge(aComponentData,
layers.getConstArray()+nNumDefaultLayers, nNumUserLayers,
localehelper::getAnyLocale(), aLocales, aTemplateProvider );
@@ -607,7 +602,7 @@ ComponentResult BackendAccess::getNodeData(const ComponentRequest& aRequest,
{
mNotifier->addListener(aListener, aRequest);
}
- return ComponentResult(retCode) ;
+ return ResultHolder< ComponentInstance >(retCode) ;
}
catch (com::sun::star::container::NoSuchElementException &) { throw; }
catch (com::sun::star::uno::RuntimeException &) { throw; }
@@ -648,11 +643,11 @@ ComponentResult BackendAccess::getNodeData(const ComponentRequest& aRequest,
//------------------------------------------------------------------------------
void BackendAccess::updateNodeData(const UpdateRequest& aUpdate)
- CFG_UNO_THROW_ALL()
+ SAL_THROW((com::sun::star::uno::Exception))
{
rtl::OUString entity = aUpdate.getOptions().getEntity() ;
rtl::OUString component =
- aUpdate.getUpdateRoot().getModuleName().toString() ;
+ aUpdate.getUpdateRoot().getModuleName();
uno::Reference<backenduno::XUpdateHandler> handler ;
RTL_LOGFILE_CONTEXT_AUTHOR(aLog, "configmgr::backend::BackendAccess", "jb99855", "configmgr: BackendAccess::updateNodeData()");
@@ -664,15 +659,15 @@ void BackendAccess::updateNodeData(const UpdateRequest& aUpdate)
else { handler = mBackend->getUpdateHandler(component, entity) ; }
UpdateDispatcher dispatcher(handler, aUpdate.getOptions().getLocale()) ;
- dispatcher.dispatchUpdate(aUpdate.getUpdateRoot().location(),
+ dispatcher.dispatchUpdate(aUpdate.getUpdateRoot(),
*aUpdate.getUpdateData()) ;
}
//------------------------------------------------------------------------------
-NodeResult BackendAccess::getDefaultData(const NodeRequest& aRequest)
- CFG_UNO_THROW_ALL()
+ResultHolder< NodeInstance > BackendAccess::getDefaultData(const NodeRequest& aRequest)
+ SAL_THROW((com::sun::star::uno::Exception))
{
- rtl::OUString const component = aRequest.getPath().getModuleName().toString() ;
+ rtl::OUString const component = aRequest.getPath().getModuleName();
RTL_LOGFILE_CONTEXT_AUTHOR(aLog, "configmgr::backend::BackendAccess", "jb99855", "configmgr: BackendAccess::getDefaultData()");
RTL_LOGFILE_CONTEXT_TRACE1(aLog, "request path: %s", RTL_LOGFILE_OU2A(aRequest.getPath().toString()) );
@@ -694,19 +689,19 @@ NodeResult BackendAccess::getDefaultData(const NodeRequest& aRequest)
sMessage.append(component);
sMessage.appendAscii("\" contains no default data. ");
- OUString const sMsg = sMessage.makeStringAndClear();
+ rtl::OUString const sMsg = sMessage.makeStringAndClear();
Logger(mContext).finer(sMsg,"getDefaultData()","configmgr::BackendAccess");
throw com::sun::star::container::NoSuchElementException(sMsg,mBackend);
}
std::auto_ptr<ISubtree> aResultTree = aComponentData.extractSchemaTree();
- AbsolutePath aPath = aRequest.getPath();
+ configuration::AbsolutePath aPath = aRequest.getPath();
if( aPath.begin() != aPath.end())
{
- for(AbsolutePath::Iterator it=aPath.begin()+1,endIt=aPath.end();it!=endIt; ++it)
+ for(std::vector<configuration::Path::Component>::const_reverse_iterator it=aPath.begin()+1,endIt=aPath.end();it!=endIt; ++it)
{
- std::auto_ptr<INode> aChild=aResultTree->removeChild(it->getName().toString());
+ std::auto_ptr<INode> aChild=aResultTree->removeChild(it->getName());
if(aChild.get()== NULL)
{
rtl::OUStringBuffer sMessage;
@@ -714,7 +709,7 @@ NodeResult BackendAccess::getDefaultData(const NodeRequest& aRequest)
sMessage.append(aPath.toString());
sMessage.appendAscii("\" does not exist in the default data. ");
- OUString const sMsg = sMessage.makeStringAndClear();
+ rtl::OUString const sMsg = sMessage.makeStringAndClear();
Logger(mContext).finest(sMsg,"getDefaultData()","configmgr::BackendAccess");
throw com::sun::star::container::NoSuchElementException(sMsg,mBackend);
}
@@ -722,9 +717,9 @@ NodeResult BackendAccess::getDefaultData(const NodeRequest& aRequest)
ISubtree *pChildAsSubtree = aChild->asISubtree();
if(pChildAsSubtree == NULL)
{
- OUString sMsg = OUString::createFromAscii("BackendAccess::getDefaultData - Node Expected, Found Property: ").concat(it->getName().toString());
+ rtl::OUString sMsg = rtl::OUString::createFromAscii("BackendAccess::getDefaultData - Node Expected, Found Property: ").concat(it->getName());
Logger(mContext).finer(sMsg,"getDefaultData()","configmgr::BackendAccess");
- throw MalformedDataException(sMsg, mBackend, uno::Any());
+ throw backenduno::MalformedDataException(sMsg, mBackend, uno::Any());
}
aResultTree.reset(pChildAsSubtree);
aChild.release();
@@ -732,14 +727,14 @@ NodeResult BackendAccess::getDefaultData(const NodeRequest& aRequest)
}
NodeInstance retCode(aResultTree, aRequest.getPath()) ;
- return NodeResult(retCode) ;
+ return ResultHolder< NodeInstance >(retCode) ;
}
//------------------------------------------------------------------------------
-TemplateResult BackendAccess::getTemplateData(const TemplateRequest& aRequest)
- CFG_UNO_THROW_ALL()
+ResultHolder< TemplateInstance > BackendAccess::getTemplateData(const TemplateRequest& aRequest)
+ SAL_THROW((com::sun::star::uno::Exception))
{
- rtl::OUString component = aRequest.getComponentName().toString();
+ rtl::OUString component = aRequest.getComponentName();
RTL_LOGFILE_CONTEXT_AUTHOR(aLog, "configmgr::backend::BackendAccess", "jb99855", "configmgr: BackendAccess::getTemplateData()");
RTL_LOGFILE_CONTEXT_TRACE2(aLog, "requested template: %s/%s",
@@ -765,18 +760,18 @@ TemplateResult BackendAccess::getTemplateData(const TemplateRequest& aRequest)
else
{
backenduno::TemplateIdentifier templateId ;
- templateId.Name = aRequest.getTemplateName().toString() ;
- templateId.Component = aRequest.getComponentName().toString() ;
+ templateId.Name = aRequest.getTemplateName();
+ templateId.Component = aRequest.getComponentName();
aResultData = aComponentData.extractTemplateNode(templateId.Name);
}
TemplateInstance retCode(aResultData,aRequest.getTemplateName(), aRequest.getComponentName()) ;
- return TemplateResult(retCode) ;
+ return ResultHolder< TemplateInstance >(retCode) ;
}
//------------------------------------------------------------------------------
-uno::Reference< backenduno::XSchema > BackendAccess::getSchema(const OUString& aComponent)
+uno::Reference< backenduno::XSchema > BackendAccess::getSchema(const rtl::OUString& aComponent)
{
uno::Reference< backenduno::XSchemaSupplier > xSchemaBackend(mBackend, uno::UNO_QUERY_THROW);
OSL_ASSERT(xSchemaBackend.is());
@@ -789,7 +784,7 @@ uno::Reference< backenduno::XSchema > BackendAccess::getSchema(const OUString& a
sMessage.append(aComponent);
sMessage.appendAscii("\" is unknown. [No schema available]");
- OUString const sMsg = sMessage.makeStringAndClear();
+ rtl::OUString const sMsg = sMessage.makeStringAndClear();
Logger(mContext).warning(sMsg,"getSchema()","configmgr::BackendAccess");
throw com::sun::star::container::NoSuchElementException(sMsg,xSchemaBackend);
}
@@ -798,17 +793,17 @@ uno::Reference< backenduno::XSchema > BackendAccess::getSchema(const OUString& a
}
//------------------------------------------------------------------------------
-OUString BackendAccess::getSchemaVersion(const OUString& aComponent)
+rtl::OUString BackendAccess::getSchemaVersion(const rtl::OUString& aComponent)
{
uno::Reference< backenduno::XVersionedSchemaSupplier > xSchemaBackend(mBackend, uno::UNO_QUERY);
if (xSchemaBackend.is())
return xSchemaBackend->getSchemaVersion(aComponent);
else
- return OUString();
+ return rtl::OUString();
}
//------------------------------------------------------------------------------
-uno::Sequence< uno::Reference<backenduno::XLayer> > BackendAccess::getLayers(const OUString& aComponent,const RequestOptions& aOptions)
+uno::Sequence< uno::Reference<backenduno::XLayer> > BackendAccess::getLayers(const rtl::OUString& aComponent,const RequestOptions& aOptions)
{
rtl::OUString aEntity = aOptions.getEntity() ;
@@ -825,7 +820,7 @@ uno::Sequence< uno::Reference<backenduno::XLayer> > BackendAccess::getLayers(con
//------------------------------------------------------------------------------
void BackendAccess::removeRequestListener(INodeDataListener *aListener,
const ComponentRequest& aRequest)
- CFG_NOTHROW()
+ SAL_THROW(())
{
OSL_PRECOND(aListener, "ERROR: trying to remove a NULL listener");
diff --git a/configmgr/source/backend/backendaccess.hxx b/configmgr/source/backend/backendaccess.hxx
index acdefb8fac..2a53cb7a0f 100644
--- a/configmgr/source/backend/backendaccess.hxx
+++ b/configmgr/source/backend/backendaccess.hxx
@@ -71,50 +71,49 @@ class BackendAccess : public IMergedDataProvider
~BackendAccess(void) ;
// IMergedDataProvider
- virtual ComponentResult getNodeData(const ComponentRequest& aRequest,
+ virtual ResultHolder< ComponentInstance > getNodeData(const ComponentRequest& aRequest,
ITemplateDataProvider* aTemplateProvider,
INodeDataListener *aListener = NULL)
- CFG_UNO_THROW_ALL() ;
+ SAL_THROW((com::sun::star::uno::Exception)) ;
virtual void removeRequestListener(INodeDataListener *aListener,
const ComponentRequest& aRequest)
- CFG_NOTHROW();
+ SAL_THROW(());
virtual void updateNodeData(const UpdateRequest& aUpdate)
- CFG_UNO_THROW_ALL() ;
- virtual NodeResult getDefaultData(const NodeRequest& aRequest)
- CFG_UNO_THROW_ALL() ;
- virtual TemplateResult getTemplateData(const TemplateRequest& aRequest)
- CFG_UNO_THROW_ALL() ;
- virtual bool isStrippingDefaults(void) CFG_NOTHROW() { return false ; }
+ SAL_THROW((com::sun::star::uno::Exception)) ;
+ virtual ResultHolder< NodeInstance > getDefaultData(const NodeRequest& aRequest)
+ SAL_THROW((com::sun::star::uno::Exception)) ;
+ virtual ResultHolder< TemplateInstance > getTemplateData(const TemplateRequest& aRequest)
+ SAL_THROW((com::sun::star::uno::Exception)) ;
private :
/**
Retrieves the schema of a component.
*/
- uno::Reference< backenduno::XSchema > getSchema(const OUString& aComponent) ;
+ uno::Reference< backenduno::XSchema > getSchema(const rtl::OUString& aComponent) ;
/**
Retrieves the schema version of a component.
*/
- OUString getSchemaVersion(const OUString& aComponent) ;
+ rtl::OUString getSchemaVersion(const rtl::OUString& aComponent) ;
/**
Retrieves the layers for a request.
*/
- uno::Sequence< uno::Reference<backenduno::XLayer> > getLayers(const OUString& aComponent,const RequestOptions& aOptions) ;
+ uno::Sequence< uno::Reference<backenduno::XLayer> > getLayers(const rtl::OUString& aComponent,const RequestOptions& aOptions) ;
/**
Reads merged default data with a given number of layers.
*/
bool readDefaultData( MergedComponentData & aComponentData,
- OUString const & aComponent,
+ rtl::OUString const & aComponent,
RequestOptions const & aOptions,
bool bIncludeTemplates,
const uno::Reference<backenduno::XLayer> * pLayers,
sal_Int32 nNumLayers,
ITemplateDataProvider *aTemplateProvider,
sal_Int32 * pLayersMerged = 0)
- CFG_UNO_THROW_ALL();
+ SAL_THROW((com::sun::star::uno::Exception));
/**
Merges layers onto component data.
*/
@@ -122,11 +121,11 @@ class BackendAccess : public IMergedDataProvider
MergedComponentData& aData,
const uno::Reference<backenduno::XLayer> * pLayers,
sal_Int32 aNumLayers,
- localehelper::Locale const & aRequestedLocale,
- localehelper::LocaleSequence & inoutMergedLocales,
+ com::sun::star::lang::Locale const & aRequestedLocale,
+ std::vector< com::sun::star::lang::Locale > & inoutMergedLocales,
ITemplateDataProvider *aTemplateProvider,
sal_Int32 * pLayersMerged = 0)
- CFG_UNO_THROW_ALL();
+ SAL_THROW((com::sun::star::uno::Exception));
private :
/**
Decides if merging should be retried after an exception.
@@ -138,7 +137,7 @@ class BackendAccess : public IMergedDataProvider
const uno::Any & aMergeException,
const uno::Reference<backenduno::XLayer> & aBrokenLayer,
bool bUserLayerData)
- CFG_UNO_THROW_ALL();
+ SAL_THROW((com::sun::star::uno::Exception));
private :
/** Get the factory used for service invocation */
diff --git a/configmgr/source/backend/backendfactory.cxx b/configmgr/source/backend/backendfactory.cxx
index f9ef286a5e..eda39e38ef 100644
--- a/configmgr/source/backend/backendfactory.cxx
+++ b/configmgr/source/backend/backendfactory.cxx
@@ -67,7 +67,7 @@ const sal_Char k_DefaultBackendServiceAndImplName[] = K_DefaultBackendSe
const sal_Char k_GenericBackendServiceAndImplName[] = "com.sun.star.configuration.backend.Backend" ;
// -------------------------------------------------------------------------
-static AsciiServiceName const k_BackendServiceNames [] =
+static sal_Char const * const k_BackendServiceNames [] =
{
k_DefaultBackendServiceAndImplName,
k_GenericBackendServiceAndImplName,
@@ -109,7 +109,7 @@ const ServiceRegistrationInfo * getDefaultBackendServiceInfo()
// -------------------------------------------------------------------------
uno::Reference<uno::XInterface> SAL_CALL
- getDefaultBackendSingleton( CreationContext const& xContext )
+ getDefaultBackendSingleton( com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > const& xContext )
{
OSL_ENSURE( xContext.is(), "ERROR: NULL context has no singletons" );
@@ -146,12 +146,8 @@ uno::Reference<uno::XInterface> SAL_CALL
// -------------------------------------------------------------------------
// -------------------------------------------------------------------------
-typedef BackendFactory::CreationContext CreationContext;
-typedef uno::Sequence< uno::Any > UnoInitArgs;
-// -------------------------------------------------------------------------
-
static
-UnoInitArgs createInitArgs(ContextReader const & _aContext)
+uno::Sequence< uno::Any > createInitArgs(ContextReader const & _aContext)
{
OSL_ASSERT(_aContext.hasBootstrapContext());
uno::Sequence< uno::Any > aResult( 1 );
@@ -162,50 +158,47 @@ UnoInitArgs createInitArgs(ContextReader const & _aContext)
static
inline
-uno::Reference< uno::XInterface > createService(ContextReader const & _aCtx, UnoInitArgs const & _aInitArgs, OUString const & _aSvc)
+uno::Reference< uno::XInterface > createService(ContextReader const & _aCtx, uno::Sequence< uno::Any > const & _aInitArgs, rtl::OUString const & _aSvc)
{
uno::Reference< lang::XMultiComponentFactory > xFactory = _aCtx.getServiceManager();
OSL_ENSURE(xFactory.is(),"ERROR: ComponentContext has no service manager\n");
- if (!xFactory.is()) throw uno::RuntimeException( OUString::createFromAscii("ERROR: ComponentContext has no service manager\n"), NULL );
+ if (!xFactory.is()) throw uno::RuntimeException( rtl::OUString::createFromAscii("ERROR: ComponentContext has no service manager\n"), NULL );
return xFactory->createInstanceWithArgumentsAndContext( _aSvc, _aInitArgs, _aCtx.getBaseContext());
}
// -------------------------------------------------------------------------
-typedef uno::Reference< backenduno::XMultiLayerStratum > UnoSingleBackend;
-typedef uno::Reference< backenduno::XBackend > UnoBackend;
-
static
-UnoBackend wrapSingleBackend(ContextReader const & _aSettings, UnoInitArgs const & _aInitArgs, UnoSingleBackend const & _xWrappedBackend)
+uno::Reference< backenduno::XBackend > wrapSingleBackend(ContextReader const & _aSettings, uno::Sequence< uno::Any > const & _aInitArgs, uno::Reference< backenduno::XMultiLayerStratum > const & _xWrappedBackend)
{
OSL_ASSERT(_aSettings.hasUnoBackendWrapper() || _aSettings.hasBootstrapContext());
- OUString aWrapperSvc = _aSettings.hasUnoBackendWrapper() ?
+ rtl::OUString aWrapperSvc = _aSettings.hasUnoBackendWrapper() ?
_aSettings.getUnoBackendWrapper() :
- OUString::createFromAscii(k_DefaultBackendWrapper);
+ rtl::OUString::createFromAscii(k_DefaultBackendWrapper);
OSL_ENSURE (aWrapperSvc.getLength(), "ERROR: No wrapper service for wrapped configuration");
OSL_ENSURE (_xWrappedBackend.is(), "ERROR: No backend to wrap for wrapped configuration");
sal_Int32 const nBaseArgsCount = _aInitArgs.getLength();
- UnoInitArgs aExtendedArgs( _aInitArgs );
+ uno::Sequence< uno::Any > aExtendedArgs( _aInitArgs );
aExtendedArgs.realloc( nBaseArgsCount + 1 );
aExtendedArgs[nBaseArgsCount] <<= _xWrappedBackend;
- return UnoBackend::query( createService(_aSettings,aExtendedArgs,aWrapperSvc) );
+ return uno::Reference< backenduno::XBackend >::query( createService(_aSettings,aExtendedArgs,aWrapperSvc) );
}
// -------------------------------------------------------------------------
static
-UnoBackend createOfflineBackend(ContextReader const & _aSettings, UnoInitArgs const & _aInitArgs)
+uno::Reference< backenduno::XBackend > createOfflineBackend(ContextReader const & _aSettings, uno::Sequence< uno::Any > const & _aInitArgs)
{
OSL_ASSERT(_aSettings.hasUnoBackendWrapper() || _aSettings.hasBootstrapContext());
- UnoBackend xResult;
+ uno::Reference< backenduno::XBackend > xResult;
if ( _aSettings.hasUnoBackendWrapper() )
{
- OUString const aWrapperSvc = _aSettings.getUnoBackendWrapper();
+ rtl::OUString const aWrapperSvc = _aSettings.getUnoBackendWrapper();
- xResult = UnoBackend::query( createService(_aSettings,_aInitArgs,aWrapperSvc) );
+ xResult = uno::Reference< backenduno::XBackend >::query( createService(_aSettings,_aInitArgs,aWrapperSvc) );
}
return xResult;
@@ -213,13 +206,13 @@ UnoBackend createOfflineBackend(ContextReader const & _aSettings, UnoInitArgs co
// -------------------------------------------------------------------------
static
-uno::Reference< uno::XInterface > createRealBackend(ContextReader const & _aSettings, UnoInitArgs const & _aInitArgs)
+uno::Reference< uno::XInterface > createRealBackend(ContextReader const & _aSettings, uno::Sequence< uno::Any > const & _aInitArgs)
{
OSL_ASSERT(_aSettings.hasUnoBackendService() || _aSettings.hasBootstrapContext());
- OUString const aBackendServiceName = _aSettings.hasUnoBackendService() ?
+ rtl::OUString const aBackendServiceName = _aSettings.hasUnoBackendService() ?
_aSettings.getUnoBackendService() :
- OUString::createFromAscii(k_DefaultBackendService);
+ rtl::OUString::createFromAscii(k_DefaultBackendService);
uno::Reference< uno::XInterface > xResult =
createService(_aSettings,_aInitArgs,aBackendServiceName);
@@ -229,18 +222,18 @@ uno::Reference< uno::XInterface > createRealBackend(ContextReader const & _aSett
// -------------------------------------------------------------------------
static
-UnoBackend createOnlineBackend(ContextReader const & _aSettings, UnoInitArgs const & _aInitArgs)
+uno::Reference< backenduno::XBackend > createOnlineBackend(ContextReader const & _aSettings, uno::Sequence< uno::Any > const & _aInitArgs)
{
OSL_ENSURE( _aSettings.isUnoBackend(), "ERROR - BackendFactory: For legacy backends use createSessionBackend()");
- UnoBackend xResult;
+ uno::Reference< backenduno::XBackend > xResult;
uno::Reference< uno::XInterface > xRealBackend = createRealBackend(_aSettings,_aInitArgs);
if (_aSettings.hasUnoBackendWrapper())
{
// try wrapping a single backend
- UnoSingleBackend xSingleRealBackend( xRealBackend, uno::UNO_QUERY);
+ uno::Reference< backenduno::XMultiLayerStratum > xSingleRealBackend( xRealBackend, uno::UNO_QUERY);
if (xSingleRealBackend.is())
xResult = wrapSingleBackend(_aSettings,_aInitArgs,xSingleRealBackend);
@@ -255,7 +248,7 @@ UnoBackend createOnlineBackend(ContextReader const & _aSettings, UnoInitArgs con
if (!xResult.is())
{
// try the default wrapper if we only have a single backend
- UnoSingleBackend xSingleRealBackend( xRealBackend, uno::UNO_QUERY);
+ uno::Reference< backenduno::XMultiLayerStratum > xSingleRealBackend( xRealBackend, uno::UNO_QUERY);
if (xSingleRealBackend.is())
xResult = wrapSingleBackend(_aSettings,_aInitArgs,xSingleRealBackend);
@@ -268,16 +261,16 @@ UnoBackend createOnlineBackend(ContextReader const & _aSettings, UnoInitArgs con
}
// -------------------------------------------------------------------------
-static UnoBackend createUnoBackend(CreationContext const& _xCtx)
+static uno::Reference< backenduno::XBackend > createUnoBackend(com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > const& _xCtx)
{
ContextReader aSettings(_xCtx);
OSL_ENSURE( aSettings.isUnoBackend(), "ERROR - BackendFactory: Legacy backends are not supported any more");
- UnoInitArgs aArguments = createInitArgs(aSettings);
+ uno::Sequence< uno::Any > aArguments = createInitArgs(aSettings);
sal_Bool bOffline = aSettings.hasOfflineSetting() ? aSettings.getOfflineSetting() : !aSettings.hasUnoBackendService();
- UnoBackend xResult;
+ uno::Reference< backenduno::XBackend > xResult;
if (!bOffline)
xResult = createOnlineBackend (aSettings,aArguments);
@@ -294,9 +287,9 @@ static UnoBackend createUnoBackend(CreationContext const& _xCtx)
// -------------------------------------------------------------------------
-uno::Reference<uno::XInterface> SAL_CALL instantiateDefaultBackend( CreationContext const& xTargetContext )
+uno::Reference<uno::XInterface> SAL_CALL instantiateDefaultBackend( com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > const& xTargetContext )
{
- CreationContext xContext = UnoContextTunnel::recoverContext(xTargetContext);
+ com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > xContext = UnoContextTunnel::recoverContext(xTargetContext);
try
{
@@ -309,9 +302,9 @@ uno::Reference<uno::XInterface> SAL_CALL instantiateDefaultBackend( CreationCont
}
// -------------------------------------------------------------------------
-UnoBackend BackendFactory::getUnoBackend()
+uno::Reference< backenduno::XBackend > BackendFactory::getUnoBackend()
{
- return UnoBackend::query( getDefaultBackendSingleton(m_xCtx) );
+ return uno::Reference< backenduno::XBackend >::query( getDefaultBackendSingleton(m_xCtx) );
}
// -------------------------------------------------------------------------
@@ -319,7 +312,7 @@ rtl::Reference<IMergedDataProvider> BackendFactory::createBackend()
{
rtl::Reference< IMergedDataProvider > xBackend;
- UnoBackend xBackendService = this->getUnoBackend();
+ uno::Reference< backenduno::XBackend > xBackendService = this->getUnoBackend();
if (xBackendService.is())
xBackend = new BackendAccess(xBackendService, m_xCtx);
@@ -328,7 +321,7 @@ rtl::Reference<IMergedDataProvider> BackendFactory::createBackend()
}
// -------------------------------------------------------------------------
-BackendFactory BackendFactory::instance(CreationContext const & _xCtx)
+BackendFactory BackendFactory::instance(com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > const & _xCtx)
{
return BackendFactory(_xCtx);
}
diff --git a/configmgr/source/backend/backendnotifier.cxx b/configmgr/source/backend/backendnotifier.cxx
index be4199c10a..2deb007382 100644
--- a/configmgr/source/backend/backendnotifier.cxx
+++ b/configmgr/source/backend/backendnotifier.cxx
@@ -65,7 +65,7 @@ void SAL_CALL BackendChangeNotifier::componentDataChanged(const backenduno::Comp
throw (::com::sun::star::uno::RuntimeException)
{
rtl::OUString aComponentName = _aEvent.Component;
- ListenerList::iterator aIter = m_aListeners.find(aComponentName);
+ std::map<rtl::OUString, ComponentNotifier>::iterator aIter = m_aListeners.find(aComponentName);
if(aIter != m_aListeners.end())
{
aIter->second.notifyListeners(aComponentName);
@@ -83,17 +83,17 @@ throw (uno::RuntimeException)
m_aListeners.clear();
}
// -----------------------------------------------------------------------------
-void BackendChangeNotifier::addListener(INodeDataListener * _xListener, const ComponentRequest& _aRequest) CFG_NOTHROW()
+void BackendChangeNotifier::addListener(INodeDataListener * _xListener, const ComponentRequest& _aRequest) SAL_THROW(())
{
osl::MutexGuard aListGuard(m_aMutex);
OSL_PRECOND(_xListener, "ERROR: trying to register a NULL listener");
ComponentListener aComponentListener(_xListener, _aRequest.getOptions());
- const rtl::OUString aComponentName = _aRequest.getComponentName().toString() ;
+ const rtl::OUString aComponentName = _aRequest.getComponentName();
//Check if we have a Listener registered for that Component
- ListenerList::iterator aIter;
+ std::map<rtl::OUString, ComponentNotifier>::iterator aIter;
aIter = m_aListeners.find(aComponentName);
if (aIter == m_aListeners.end())
{
@@ -117,15 +117,15 @@ void BackendChangeNotifier::addListener(INodeDataListener * _xListener, const C
}
// ---------------------------------------------------------------------------
-void BackendChangeNotifier::removeListener(INodeDataListener * _xListener, const ComponentRequest& _aRequest) CFG_NOTHROW()
+void BackendChangeNotifier::removeListener(INodeDataListener * _xListener, const ComponentRequest& _aRequest) SAL_THROW(())
{
osl::MutexGuard aListGuard(m_aMutex);
OSL_PRECOND(!m_aListeners.empty(),
"BackendChangeNotifier:Cannot Remove Listener, no Listeners Registered");
OSL_PRECOND(_xListener, "ERROR: trying to remove a NULL listener");
- ListenerList::iterator aIter;
- rtl::OUString aComponentName = _aRequest.getComponentName().toString() ;
+ std::map<rtl::OUString, ComponentNotifier>::iterator aIter;
+ rtl::OUString aComponentName = _aRequest.getComponentName();
aIter = m_aListeners.find(aComponentName);
if (aIter == m_aListeners.end())
@@ -185,9 +185,7 @@ void ComponentNotifier::notifyListeners(const rtl::OUString& _aComponent)
for( std::list<ComponentListener>::iterator aIter = m_aListenerList.begin();
aIter != m_aListenerList.end(); aIter++)
{
- ComponentRequest aRequest( configuration::makeName
- (_aComponent,configuration::Name::NoValidate()),
- (*aIter).m_aOptions );
+ ComponentRequest aRequest(_aComponent, (*aIter).m_aOptions);
(*aIter).m_aListener->dataChanged(aRequest);
}
diff --git a/configmgr/source/backend/backendnotifier.hxx b/configmgr/source/backend/backendnotifier.hxx
index 62eb6737f2..9ab179832c 100644
--- a/configmgr/source/backend/backendnotifier.hxx
+++ b/configmgr/source/backend/backendnotifier.hxx
@@ -56,7 +56,7 @@ namespace configmgr
namespace lang = ::com::sun::star::lang;
namespace backenduno = ::com::sun::star::configuration::backend;
// ---------------------------------------------------------------------------
- typedef struct ComponentListener
+ struct ComponentListener
{
explicit
ComponentListener(INodeDataListener * _xListener, RequestOptions _aOptions):
@@ -72,7 +72,7 @@ namespace configmgr
}
INodeDataListener * m_aListener;
RequestOptions m_aOptions;
- } aComponentListener;
+ };
/** Class used to store ComponentListener(listener and options)
*/
@@ -88,10 +88,9 @@ namespace configmgr
std::list<ComponentListener> m_aListenerList;
};
// ---------------------------------------------------------------------------
- typedef ::cppu::WeakImplHelper1<backenduno::XBackendChangesListener> BackendListener_Base;
/** Interface providing a multicasting service for changes in the backend
*/
- class BackendChangeNotifier :public BackendListener_Base
+ class BackendChangeNotifier :public cppu::WeakImplHelper1<backenduno::XBackendChangesListener>
{
public:
BackendChangeNotifier(const uno::Reference<backenduno::XBackend>& _xBackend);
@@ -104,13 +103,12 @@ namespace configmgr
throw (uno::RuntimeException);
// notification support.
/// register a listener for observing changes to the cached data
- void addListener(INodeDataListener * _xListener, const ComponentRequest& _aRequest) CFG_NOTHROW();
+ void addListener(INodeDataListener * _xListener, const ComponentRequest& _aRequest) SAL_THROW(());
/// unregister a listener previously registered
- void removeListener(INodeDataListener * _xListener, const ComponentRequest& _aRequest) CFG_NOTHROW();
+ void removeListener(INodeDataListener * _xListener, const ComponentRequest& _aRequest) SAL_THROW(());
private:
- typedef std::map<rtl::OUString, ComponentNotifier> ListenerList;
osl::Mutex m_aMutex;
- ListenerList m_aListeners;
+ std::map<rtl::OUString, ComponentNotifier> m_aListeners;
/** Backend being accessed */
uno::Reference<backenduno::XBackendChangesNotifier> m_aBackend ;
diff --git a/configmgr/source/backend/backendstratalistener.hxx b/configmgr/source/backend/backendstratalistener.hxx
index 0cf74ec35a..72a4b9cc34 100644
--- a/configmgr/source/backend/backendstratalistener.hxx
+++ b/configmgr/source/backend/backendstratalistener.hxx
@@ -54,9 +54,7 @@ namespace configmgr
namespace backenduno = ::com::sun::star::configuration::backend;
// --------------------------------------------------------------------------
- typedef ::cppu::WeakImplHelper1<backenduno::XBackendChangesListener> BackendStrataListener_Base;
-
- class BackendStrataListener: public BackendStrataListener_Base
+ class BackendStrataListener: public cppu::WeakImplHelper1<backenduno::XBackendChangesListener>
{
public:
BackendStrataListener(const MultiStratumBackend& aBackend);
diff --git a/configmgr/source/backend/basicimporthandler.cxx b/configmgr/source/backend/basicimporthandler.cxx
index f5f6f9e419..2cbf3cc41b 100644
--- a/configmgr/source/backend/basicimporthandler.cxx
+++ b/configmgr/source/backend/basicimporthandler.cxx
@@ -44,7 +44,7 @@ namespace configmgr
// -----------------------------------------------------------------------------
BasicImportHandler::BasicImportHandler(
- Backend const & xBackend,OUString const & aEntity, const sal_Bool& bNotify)
+ uno::Reference< backenduno::XBackend > const & xBackend,rtl::OUString const & aEntity, const sal_Bool& bNotify)
: m_bSendNotification(bNotify)
, m_xBackend(xBackend)
, m_aComponentName()
@@ -61,15 +61,15 @@ BasicImportHandler::~BasicImportHandler()
void SAL_CALL
BasicImportHandler::startLayer( )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
{
- m_aComponentName = OUString();
+ m_aComponentName = rtl::OUString();
}
// -----------------------------------------------------------------------------
void SAL_CALL
BasicImportHandler::endLayer( )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
{
if ( m_bSendNotification)
{
@@ -87,11 +87,11 @@ void SAL_CALL
OSL_ENSURE(false, "ImportMergeHandler: target backend does not support notifications");
}
}
- m_aComponentName = OUString();
+ m_aComponentName = rtl::OUString();
}
// -----------------------------------------------------------------------------
-bool BasicImportHandler::startComponent( const OUString& aName )
+bool BasicImportHandler::startComponent( const rtl::OUString& aName )
{
if (hasComponent()) return false;
@@ -102,9 +102,9 @@ bool BasicImportHandler::startComponent( const OUString& aName )
void BasicImportHandler::raiseMalformedDataException(sal_Char const * pMsg)
{
- OUString sMsg = OUString::createFromAscii(pMsg);
+ rtl::OUString sMsg = rtl::OUString::createFromAscii(pMsg);
- throw MalformedDataException(sMsg, *this, uno::Any());
+ throw backenduno::MalformedDataException(sMsg, *this, uno::Any());
}
// -----------------------------------------------------------------------------
diff --git a/configmgr/source/backend/basicimporthandler.hxx b/configmgr/source/backend/basicimporthandler.hxx
index b64777f9d4..b62eb0bf3f 100644
--- a/configmgr/source/backend/basicimporthandler.hxx
+++ b/configmgr/source/backend/basicimporthandler.hxx
@@ -43,53 +43,48 @@ namespace configmgr
namespace backend
{
// -----------------------------------------------------------------------------
- using rtl::OUString;
namespace uno = ::com::sun::star::uno;
namespace lang = ::com::sun::star::lang;
namespace backenduno = ::com::sun::star::configuration::backend;
- using backenduno::MalformedDataException;
- using backenduno::TemplateIdentifier;
// -----------------------------------------------------------------------------
class BasicImportHandler : public cppu::WeakImplHelper1< backenduno::XLayerHandler >
{
public:
- typedef uno::Reference< backenduno::XBackend > Backend;
-
explicit
BasicImportHandler(){}
- BasicImportHandler(Backend const & xBackend,OUString const & aEntity = OUString(), const sal_Bool& bNofity= sal_False);
+ BasicImportHandler(uno::Reference< backenduno::XBackend > const & xBackend,rtl::OUString const & aEntity = rtl::OUString(), const sal_Bool& bNofity= sal_False);
~BasicImportHandler();
// XLayerHandler subset - call these implementations from your derived class implementations
protected:
virtual void SAL_CALL
startLayer( )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
virtual void SAL_CALL
endLayer( )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
protected:
bool hasComponent() const { return m_aComponentName.getLength() != 0; }
bool hasEntity() const { return m_aEntity.getLength() != 0; }
- OUString getComponent() const { return m_aComponentName; }
- OUString getEntity() const { return m_aEntity; }
- Backend getBackend() const { return m_xBackend; }
+ rtl::OUString getComponent() const { return m_aComponentName; }
+ rtl::OUString getEntity() const { return m_aEntity; }
+ uno::Reference< backenduno::XBackend > getBackend() const { return m_xBackend; }
- bool startComponent( const OUString& aName );
+ bool startComponent( const rtl::OUString& aName );
void raiseMalformedDataException(sal_Char const * pMsg);
/** If True, notification should be send to backend
*/
sal_Bool m_bSendNotification;
private:
- Backend const m_xBackend;
- OUString m_aComponentName;
- OUString const m_aEntity;
+ uno::Reference< backenduno::XBackend > const m_xBackend;
+ rtl::OUString m_aComponentName;
+ rtl::OUString const m_aEntity;
};
// -----------------------------------------------------------------------------
diff --git a/configmgr/source/backend/basicupdatemerger.cxx b/configmgr/source/backend/basicupdatemerger.cxx
index 4d68fb75f2..205a062651 100644
--- a/configmgr/source/backend/basicupdatemerger.cxx
+++ b/configmgr/source/backend/basicupdatemerger.cxx
@@ -52,7 +52,7 @@ namespace configmgr
{
// -----------------------------------------------------------------------------
-BasicUpdateMerger::BasicUpdateMerger( LayerSource const & _xSourceLayer )
+BasicUpdateMerger::BasicUpdateMerger( uno::Reference< backenduno::XLayer > const & _xSourceLayer )
: m_xSourceLayer(_xSourceLayer)
, m_xResultHandler()
, m_nNesting(0)
@@ -66,18 +66,18 @@ BasicUpdateMerger::~BasicUpdateMerger()
}
// -----------------------------------------------------------------------------
-void SAL_CALL BasicUpdateMerger::readData( ResultHandler const & _xResultHandler )
- throw ( MalformedDataException, lang::NullPointerException,
+void SAL_CALL BasicUpdateMerger::readData( uno::Reference< backenduno::XLayerHandler > const & _xResultHandler )
+ throw ( backenduno::MalformedDataException, lang::NullPointerException,
lang::WrappedTargetException, uno::RuntimeException)
{
if (!_xResultHandler.is())
{
- OUString sMsg( RTL_CONSTASCII_USTRINGPARAM("UpdateMerger: Error - NULL output handler unexpected") );
+ rtl::OUString sMsg( RTL_CONSTASCII_USTRINGPARAM("UpdateMerger: Error - NULL output handler unexpected") );
throw lang::NullPointerException(sMsg,*this);
}
if (!m_xSourceLayer.is())
{
- OUString sMsg( RTL_CONSTASCII_USTRINGPARAM("UpdateMerger: Error - No source layer set") );
+ rtl::OUString sMsg( RTL_CONSTASCII_USTRINGPARAM("UpdateMerger: Error - No source layer set") );
throw lang::NullPointerException(sMsg,*this);
}
@@ -97,7 +97,7 @@ void SAL_CALL BasicUpdateMerger::readData( ResultHandler const & _xResultHandler
// -----------------------------------------------------------------------------
void SAL_CALL BasicUpdateMerger::startLayer( )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
{
if (m_nNesting)
raiseMalformedDataException("UpdateMerger: Cannot start layer - layer already in progress");
@@ -109,7 +109,7 @@ void SAL_CALL BasicUpdateMerger::startLayer( )
// -----------------------------------------------------------------------------
void SAL_CALL BasicUpdateMerger::endLayer( )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
{
if (m_nNesting > 0)
raiseMalformedDataException("UpdateMerger: Cannot end layer - data handling still in progress");
@@ -120,8 +120,8 @@ void SAL_CALL BasicUpdateMerger::endLayer( )
}
// -----------------------------------------------------------------------------
-void SAL_CALL BasicUpdateMerger::overrideNode( const OUString& aName, sal_Int16 aAttributes, sal_Bool bClear )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
+void SAL_CALL BasicUpdateMerger::overrideNode( const rtl::OUString& aName, sal_Int16 aAttributes, sal_Bool bClear )
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
{
if (!isSkipping())
m_xResultHandler->overrideNode(aName, aAttributes, bClear);
@@ -130,8 +130,8 @@ void SAL_CALL BasicUpdateMerger::overrideNode( const OUString& aName, sal_Int16
}
// -----------------------------------------------------------------------------
-void SAL_CALL BasicUpdateMerger::addOrReplaceNode( const OUString& aName, sal_Int16 aAttributes )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
+void SAL_CALL BasicUpdateMerger::addOrReplaceNode( const rtl::OUString& aName, sal_Int16 aAttributes )
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
{
if (!isSkipping())
m_xResultHandler->addOrReplaceNode(aName, aAttributes);
@@ -140,8 +140,8 @@ void SAL_CALL BasicUpdateMerger::addOrReplaceNode( const OUString& aName, sal_In
}
// -----------------------------------------------------------------------------
-void SAL_CALL BasicUpdateMerger::addOrReplaceNodeFromTemplate( const OUString& aName, const TemplateIdentifier& aTemplate, sal_Int16 aAttributes )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
+void SAL_CALL BasicUpdateMerger::addOrReplaceNodeFromTemplate( const rtl::OUString& aName, const backenduno::TemplateIdentifier& aTemplate, sal_Int16 aAttributes )
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
{
if (!isSkipping())
m_xResultHandler->addOrReplaceNodeFromTemplate(aName, aTemplate, aAttributes);
@@ -151,7 +151,7 @@ void SAL_CALL BasicUpdateMerger::addOrReplaceNodeFromTemplate( const OUString& a
// -----------------------------------------------------------------------------
void SAL_CALL BasicUpdateMerger::endNode( )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
{
if (!isSkipping())
m_xResultHandler->endNode();
@@ -160,26 +160,26 @@ void SAL_CALL BasicUpdateMerger::endNode( )
}
// -----------------------------------------------------------------------------
-void SAL_CALL BasicUpdateMerger::dropNode( const OUString& aName )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
+void SAL_CALL BasicUpdateMerger::dropNode( const rtl::OUString& aName )
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
{
if (!isSkipping())
m_xResultHandler->dropNode(aName);
}
// -----------------------------------------------------------------------------
-void SAL_CALL BasicUpdateMerger::overrideProperty( const OUString& aName, sal_Int16 aAttributes, const uno::Type& aType, sal_Bool bClear )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
+void SAL_CALL BasicUpdateMerger::overrideProperty( const rtl::OUString& aName, sal_Int16 aAttributes, const uno::Type& aType, sal_Bool bClear )
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
{
if (!isSkipping())
m_xResultHandler->overrideProperty(aName, aAttributes, aType, bClear);
- pushLevel( OUString() ); // do not match context path to property names
+ pushLevel( rtl::OUString() ); // do not match context path to property names
}
// -----------------------------------------------------------------------------
void SAL_CALL BasicUpdateMerger::endProperty( )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
{
if (!isSkipping())
m_xResultHandler->endProperty();
@@ -189,31 +189,31 @@ void SAL_CALL BasicUpdateMerger::endProperty( )
// -----------------------------------------------------------------------------
void SAL_CALL BasicUpdateMerger::setPropertyValue( const uno::Any& aValue )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
{
if (!isSkipping())
m_xResultHandler->setPropertyValue(aValue);
}
// -----------------------------------------------------------------------------
-void SAL_CALL BasicUpdateMerger::setPropertyValueForLocale( const uno::Any& aValue, const OUString & aLocale )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
+void SAL_CALL BasicUpdateMerger::setPropertyValueForLocale( const uno::Any& aValue, const rtl::OUString & aLocale )
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
{
if (!isSkipping())
m_xResultHandler->setPropertyValueForLocale(aValue,aLocale);
}
// -----------------------------------------------------------------------------
-void SAL_CALL BasicUpdateMerger::addProperty( const OUString& aName, sal_Int16 aAttributes, const uno::Type& aType )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
+void SAL_CALL BasicUpdateMerger::addProperty( const rtl::OUString& aName, sal_Int16 aAttributes, const uno::Type& aType )
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
{
if (!isSkipping())
m_xResultHandler->addProperty(aName, aAttributes, aType);
}
// -----------------------------------------------------------------------------
-void SAL_CALL BasicUpdateMerger::addPropertyWithValue( const OUString& aName, sal_Int16 aAttributes, const uno::Any& aValue )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
+void SAL_CALL BasicUpdateMerger::addPropertyWithValue( const rtl::OUString& aName, sal_Int16 aAttributes, const uno::Any& aValue )
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
{
if (!isSkipping())
m_xResultHandler->addPropertyWithValue(aName, aAttributes, aValue);
@@ -222,9 +222,9 @@ void SAL_CALL BasicUpdateMerger::addPropertyWithValue( const OUString& aName, sa
void BasicUpdateMerger::raiseMalformedDataException(sal_Char const * pMsg)
{
- OUString sMsg = OUString::createFromAscii(pMsg);
+ rtl::OUString sMsg = rtl::OUString::createFromAscii(pMsg);
- throw MalformedDataException(sMsg, *this, uno::Any());
+ throw backenduno::MalformedDataException(sMsg, *this, uno::Any());
}
// -----------------------------------------------------------------------------
@@ -239,7 +239,7 @@ void BasicUpdateMerger::startSkipping()
// -----------------------------------------------------------------------------
-void BasicUpdateMerger::pushLevel(OUString const & _aContext)
+void BasicUpdateMerger::pushLevel(rtl::OUString const & _aContext)
{
if (m_nNesting > 0)
{
@@ -291,7 +291,7 @@ void BasicUpdateMerger::popLevel()
}
// -----------------------------------------------------------------------------
-void BasicUpdateMerger::findContext(ContextPath const & _aContext)
+void BasicUpdateMerger::findContext(std::vector<rtl::OUString> const & _aContext)
{
// make the context a *reverse* copy of the context path
OSL_PRECOND( ! isHandling(), "BasicUpdateMerger: starting context search while still handling data");
@@ -315,7 +315,7 @@ void BasicUpdateMerger::leaveContext()
void BasicUpdateMerger::flushContext()
{
- ContextPath::size_type nNesting = m_aSearchPath.size();
+ std::vector<rtl::OUString>::size_type nNesting = m_aSearchPath.size();
while (!m_aSearchPath.empty())
{
diff --git a/configmgr/source/backend/basicupdatemerger.hxx b/configmgr/source/backend/basicupdatemerger.hxx
index f3ac1ffd7a..e4c233f6e1 100644
--- a/configmgr/source/backend/basicupdatemerger.hxx
+++ b/configmgr/source/backend/basicupdatemerger.hxx
@@ -47,83 +47,77 @@ namespace configmgr
namespace backend
{
// -----------------------------------------------------------------------------
- using rtl::OUString;
namespace uno = ::com::sun::star::uno;
namespace lang = ::com::sun::star::lang;
namespace backenduno = ::com::sun::star::configuration::backend;
- using backenduno::MalformedDataException;
- using backenduno::TemplateIdentifier;
// -----------------------------------------------------------------------------
class BasicUpdateMerger : public cppu::WeakImplHelper2< backenduno::XLayerHandler, backenduno::XLayer >
{
public:
- typedef uno::Reference< backenduno::XLayerHandler > ResultHandler;
- typedef uno::Reference< backenduno::XLayer > LayerSource;
-
explicit
- BasicUpdateMerger(LayerSource const & _xSourceLayer);
+ BasicUpdateMerger(uno::Reference< backenduno::XLayer > const & _xSourceLayer);
~BasicUpdateMerger();
// XLayerHandler
protected:
virtual void SAL_CALL
startLayer( )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
virtual void SAL_CALL
endLayer( )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
virtual void SAL_CALL
- overrideNode( const OUString& aName, sal_Int16 aAttributes, sal_Bool bClear )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
+ overrideNode( const rtl::OUString& aName, sal_Int16 aAttributes, sal_Bool bClear )
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
virtual void SAL_CALL
- addOrReplaceNode( const OUString& aName, sal_Int16 aAttributes )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
+ addOrReplaceNode( const rtl::OUString& aName, sal_Int16 aAttributes )
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
virtual void SAL_CALL
- addOrReplaceNodeFromTemplate( const OUString& aName, const TemplateIdentifier& aTemplate, sal_Int16 aAttributes )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
+ addOrReplaceNodeFromTemplate( const rtl::OUString& aName, const backenduno::TemplateIdentifier& aTemplate, sal_Int16 aAttributes )
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
virtual void SAL_CALL
endNode( )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
virtual void SAL_CALL
- dropNode( const OUString& aName )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
+ dropNode( const rtl::OUString& aName )
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
virtual void SAL_CALL
- overrideProperty( const OUString& aName, sal_Int16 aAttributes, const uno::Type& aType, sal_Bool bClear )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
+ overrideProperty( const rtl::OUString& aName, sal_Int16 aAttributes, const uno::Type& aType, sal_Bool bClear )
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
virtual void SAL_CALL
endProperty( )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
virtual void SAL_CALL
setPropertyValue( const uno::Any& aValue )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
virtual void SAL_CALL
- setPropertyValueForLocale( const uno::Any& aValue, const OUString & aLocale )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
+ setPropertyValueForLocale( const uno::Any& aValue, const rtl::OUString & aLocale )
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
virtual void SAL_CALL
- addProperty( const OUString& aName, sal_Int16 aAttributes, const uno::Type& aType )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
+ addProperty( const rtl::OUString& aName, sal_Int16 aAttributes, const uno::Type& aType )
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
virtual void SAL_CALL
- addPropertyWithValue( const OUString& aName, sal_Int16 aAttributes, const uno::Any& aValue )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
+ addPropertyWithValue( const rtl::OUString& aName, sal_Int16 aAttributes, const uno::Any& aValue )
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
// XLayer
protected:
virtual void SAL_CALL
readData( const uno::Reference< backenduno::XLayerHandler >& aHandler )
- throw (MalformedDataException, lang::NullPointerException, lang::WrappedTargetException, uno::RuntimeException);
+ throw (backenduno::MalformedDataException, lang::NullPointerException, lang::WrappedTargetException, uno::RuntimeException);
// new overrideable
private:
@@ -135,22 +129,21 @@ namespace configmgr
bool isSkipping() const { return m_bSkipping; }
void startSkipping();
- typedef std::vector<OUString> ContextPath;
- void findContext(ContextPath const & _aContext);
+ void findContext(std::vector<rtl::OUString> const & _aContext);
void leaveContext();
- ResultHandler getResultWriter() const { return m_xResultHandler; };
+ uno::Reference< backenduno::XLayerHandler > getResultWriter() const { return m_xResultHandler; };
void raiseMalformedDataException(sal_Char const * pMsg);
private:
- void pushLevel(OUString const & _aLevel);
+ void pushLevel(rtl::OUString const & _aLevel);
void popLevel();
void flushContext();
private:
- LayerSource m_xSourceLayer;
- ResultHandler m_xResultHandler;
- ContextPath m_aSearchPath;
+ uno::Reference< backenduno::XLayer > m_xSourceLayer;
+ uno::Reference< backenduno::XLayerHandler > m_xResultHandler;
+ std::vector<rtl::OUString> m_aSearchPath;
sal_Int16 m_nNesting;
bool m_bSkipping;
diff --git a/configmgr/source/backend/binarycache.cxx b/configmgr/source/backend/binarycache.cxx
index f0f0b44899..005e418a0b 100644
--- a/configmgr/source/backend/binarycache.cxx
+++ b/configmgr/source/backend/binarycache.cxx
@@ -55,25 +55,19 @@ namespace configmgr
// -----------------------------------------------------------------------------
namespace backend
{
-
- using ::rtl::OUString;
-
- const OUString aSettingName(
+ const rtl::OUString aSettingName(
RTL_CONSTASCII_USTRINGPARAM( CONTEXT_ITEM_PREFIX_ "CacheUrl"));
// ---------------------------------------------------------------------------------------
- static inline bool isValidFileURL (OUString const& _sFileURL)
+ static inline bool isValidFileURL (rtl::OUString const& _sFileURL)
{
- using osl::File;
-
- OUString sSystemPath;
- return _sFileURL.getLength() && (File::E_None == File::getSystemPathFromFileURL(_sFileURL, sSystemPath));
+ rtl::OUString sSystemPath;
+ return _sFileURL.getLength() && (osl::File::E_None == osl::File::getSystemPathFromFileURL(_sFileURL, sSystemPath));
}
// -----------------------------------------------------------------------------
// ---------------------------------------------------------------------------------------
static
bool implEnsureAbsoluteURL(rtl::OUString & _rsURL) // also strips embedded dots etc.
{
- using osl::File;
if (!_rsURL.getLength())
return false;
@@ -88,7 +82,7 @@ namespace configmgr
OSL_VERIFY(tools::getProcessWorkingDir(&sBasePath));
rtl::OUString sAbsolute;
- if ( File::E_None == File::getAbsoluteFileURL(sBasePath, _rsURL, sAbsolute))
+ if ( osl::File::E_None == osl::File::getAbsoluteFileURL(sBasePath, _rsURL, sAbsolute))
{
_rsURL = sAbsolute;
return isValidFileURL(_rsURL);
@@ -104,7 +98,7 @@ namespace configmgr
static const sal_Unicode kPathSeparator = '/' ;
static const char kBinarySuffix[] = ".dat" ;
- OUString BinaryCache::getCacheFileURL(const OUString& aComponent) const
+ rtl::OUString BinaryCache::getCacheFileURL(const rtl::OUString& aComponent) const
{
rtl::OUStringBuffer retCode (mBaseURL);
retCode.append(kPathSeparator) ;
@@ -112,7 +106,7 @@ namespace configmgr
retCode.append(aComponent) ;
retCode.appendAscii(RTL_CONSTASCII_STRINGPARAM(kBinarySuffix));
- OUString aResult = retCode.makeStringAndClear() ;
+ rtl::OUString aResult = retCode.makeStringAndClear() ;
if (isValidFileURL(aResult))
{
@@ -121,7 +115,7 @@ namespace configmgr
else
{
OSL_ENSURE(false, "Component File URL is invalid");
- return OUString();
+ return rtl::OUString();
}
}
// -----------------------------------------------------------------------------
@@ -134,7 +128,7 @@ namespace configmgr
//initialise the base URL
ContextReader aReader(xContext);
- OUString sCacheUrl;
+ rtl::OUString sCacheUrl;
if (!aReader.isAdminService())
{
mbCacheEnabled = (aReader.getBestContext()->getValueByName(aSettingName) >>= sCacheUrl)
@@ -162,7 +156,7 @@ namespace configmgr
}
// -----------------------------------------------------------------------------
- void BinaryCache::setOwnerEntity(const OUString & aOwnerEntity)
+ void BinaryCache::setOwnerEntity(const rtl::OUString & aOwnerEntity)
{
OSL_PRECOND(mOwnerEntity.getLength() == 0, "Owner entity of cache already set");
mOwnerEntity = aOwnerEntity;
@@ -186,12 +180,12 @@ namespace configmgr
}
// -----------------------------------------------------------------------------
bool BinaryCache::readComponentData(MergedComponentData & aComponentData,
- MultiServiceFactory const & aFactory,
- OUString const & aComponent,
- OUString const & aSchemaVersion,
- OUString const & aEntity,
- localehelper::Locale const & aRequestedLocale,
- localehelper::LocaleSequence & outKnownLocales,
+ uno::Reference< lang::XMultiServiceFactory > const & aFactory,
+ rtl::OUString const & aComponent,
+ rtl::OUString const & aSchemaVersion,
+ rtl::OUString const & aEntity,
+ com::sun::star::lang::Locale const & aRequestedLocale,
+ std::vector< com::sun::star::lang::Locale > & outKnownLocales,
const uno::Reference<backenduno::XLayer> * pLayers,
sal_Int32 nNumLayers,
bool bIncludeTemplates)
@@ -221,11 +215,11 @@ namespace configmgr
// -----------------------------------------------------------------------------
bool BinaryCache::writeComponentData(MergedComponentData const & aComponentData,
- MultiServiceFactory const & aFactory,
- OUString const & aComponent,
- OUString const & aSchemaVersion,
- OUString const & aEntity,
- localehelper::LocaleSequence const & aKnownLocales,
+ uno::Reference< lang::XMultiServiceFactory > const & aFactory,
+ rtl::OUString const & aComponent,
+ rtl::OUString const & aSchemaVersion,
+ rtl::OUString const & aEntity,
+ std::vector< com::sun::star::lang::Locale > const & aKnownLocales,
const uno::Reference<backenduno::XLayer> * pLayers,
sal_Int32 nNumLayers)
{
diff --git a/configmgr/source/backend/binarycache.hxx b/configmgr/source/backend/binarycache.hxx
index 47cfe1a64d..f4506a12b1 100644
--- a/configmgr/source/backend/binarycache.hxx
+++ b/configmgr/source/backend/binarycache.hxx
@@ -50,7 +50,6 @@ namespace configmgr
// -----------------------------------------------------------------------------
class MergedComponentData;
- typedef uno::Reference< lang::XMultiServiceFactory > MultiServiceFactory;
// -----------------------------------------------------------------------------
class BinaryCache
@@ -67,22 +66,22 @@ namespace configmgr
rtl::OUString getCacheFileURL(rtl::OUString const & aComponent) const;
bool readComponentData(MergedComponentData & aComponentData,
- MultiServiceFactory const & aFactory,
+ uno::Reference< lang::XMultiServiceFactory > const & aFactory,
rtl::OUString const & aComponent,
rtl::OUString const & aSchemaVersion,
rtl::OUString const & aEntity,
- localehelper::Locale const & aRequestedLocale,
- localehelper::LocaleSequence & outKnownLocales,
+ com::sun::star::lang::Locale const & aRequestedLocale,
+ std::vector< com::sun::star::lang::Locale > & outKnownLocales,
const uno::Reference<backenduno::XLayer> * pLayers,
sal_Int32 nNumLayers,
bool bIncludeTemplates = true);
bool writeComponentData(MergedComponentData const & aComponentData,
- MultiServiceFactory const & aFactory,
+ uno::Reference< lang::XMultiServiceFactory > const & aFactory,
rtl::OUString const & aComponent,
rtl::OUString const & aSchemaVersion,
rtl::OUString const & aEntity,
- localehelper::LocaleSequence const & aKnownLocales,
+ std::vector< com::sun::star::lang::Locale > const & aKnownLocales,
const uno::Reference<backenduno::XLayer> * pLayers,
sal_Int32 nNumLayers);
private:
diff --git a/configmgr/source/backend/binaryreader.cxx b/configmgr/source/backend/binaryreader.cxx
index 8661c723fb..c6e21db004 100644
--- a/configmgr/source/backend/binaryreader.cxx
+++ b/configmgr/source/backend/binaryreader.cxx
@@ -63,8 +63,6 @@ namespace configmgr
// -----------------------------------------------------------------------------
namespace backend
{
- using ::rtl::OUString;
- using namespace ::osl;
namespace uno = com::sun::star::uno;
namespace io = com::sun::star::io;
@@ -190,7 +188,7 @@ namespace configmgr
}
static void raiseBufferError()
{
- OUString sMsg = OUString::createFromAscii("Cannot allocate Buffer: Too large");
+ rtl::OUString sMsg = rtl::OUString::createFromAscii("Cannot allocate Buffer: Too large");
throw io:: BufferSizeExceededException(sMsg, NULL);
}
// -------------------------------------------------------------------------
@@ -223,7 +221,7 @@ namespace configmgr
if (nRead != nLength)
{
rtl_freeMemory (pBuffer);
- OUString sMsg = OUString::createFromAscii("BinaryCache - Could not read entire size of file: ");
+ rtl::OUString sMsg = rtl::OUString::createFromAscii("BinaryCache - Could not read entire size of file: ");
throw io::UnexpectedEOFException(sMsg.concat(rFileUrl),NULL);
}
m_pBuffer = pBuffer;
@@ -243,7 +241,7 @@ namespace configmgr
{
if (!m_pBuffer)
{
- OUString sMsg = OUString::createFromAscii("BinaryCache - Stream is not open. No data available for reading.");
+ rtl::OUString sMsg = rtl::OUString::createFromAscii("BinaryCache - Stream is not open. No data available for reading.");
throw io::NotConnectedException(sMsg,*this);
}
OSL_ASSERT(m_nLength >= m_nOffset);
@@ -255,7 +253,7 @@ namespace configmgr
{
if (nRequest < 0)
{
- OUString sMsg = OUString::createFromAscii("BinaryCache - Invalid read request - negative byte count requested.");
+ rtl::OUString sMsg = rtl::OUString::createFromAscii("BinaryCache - Invalid read request - negative byte count requested.");
throw io::BufferSizeExceededException(sMsg,*this);
}
sal_uInt32 const uRequest = sal_uInt32(nRequest);
@@ -269,7 +267,7 @@ namespace configmgr
sal_uInt32 const nAvail = checkAvail ();
if (nRequest > nAvail)
{
- OUString sMsg = OUString::createFromAscii("BinaryCache - Invalid file format - read past end-of-file.");
+ rtl::OUString sMsg = rtl::OUString::createFromAscii("BinaryCache - Invalid file format - read past end-of-file.");
throw io::UnexpectedEOFException(sMsg,*this);
}
sal_uInt8 const * pData = m_pBuffer + m_nOffset;
@@ -491,9 +489,8 @@ namespace configmgr
(sal_uInt32(pData[2]) << 8) |
(sal_uInt32(pData[3]) << 0) );
- using binary::STR_ASCII_MASK;
- bool bIsAscii = (nLength & STR_ASCII_MASK) == STR_ASCII_MASK;
- nLength &=~STR_ASCII_MASK;
+ bool bIsAscii = (nLength & binary::STR_ASCII_MASK) == binary::STR_ASCII_MASK;
+ nLength &=~binary::STR_ASCII_MASK;
rtl::OUString result;
if (nLength != 0)
@@ -617,7 +614,7 @@ namespace configmgr
// --------------------------------------------------------------------------
- void BinaryReader::read (Binary &_aValue)
+ void BinaryReader::read (uno::Sequence< sal_Int8 > &_aValue)
SAL_THROW( (io::IOException, uno::RuntimeException) )
{
readSequence(*this, _aValue);
@@ -625,7 +622,7 @@ namespace configmgr
// --------------------------------------------------------------------------
- void BinaryReader::read (StringList &_aValue)
+ void BinaryReader::read (uno::Sequence< rtl::OUString > &_aValue)
SAL_THROW( (io::IOException, uno::RuntimeException) )
{
readSequence(*this, _aValue);
@@ -633,8 +630,7 @@ namespace configmgr
// --------------------------------------------------------------------------
- typedef BinaryReader::Binary Binary;
- Binary const * const for_binary = 0;
+ uno::Sequence< sal_Int8 > const * const for_binary = 0;
#define CASE_READ_SEQUENCE(TYPE_CLASS, DATA_TYPE) \
case TYPE_CLASS: \
@@ -668,7 +664,7 @@ namespace configmgr
case uno::TypeClass_SEQUENCE:
if (_aElementType == ::getCppuType(for_binary))
{
- Binary aData;
+ uno::Sequence< sal_Int8 > aData;
readSequence(_rReader, aData);
_aValue <<= aData;
break;
diff --git a/configmgr/source/backend/binaryreader.hxx b/configmgr/source/backend/binaryreader.hxx
index 36d50fc18f..1b7a4de4a9 100644
--- a/configmgr/source/backend/binaryreader.hxx
+++ b/configmgr/source/backend/binaryreader.hxx
@@ -47,8 +47,6 @@ namespace configmgr
namespace io = css::io;
namespace uno = css::uno;
namespace lang = css::lang;
-
- typedef uno::Reference<lang::XMultiServiceFactory> MultiServiceFactory;
// -----------------------------------------------------------------------------
class BinaryReader
{
@@ -66,9 +64,6 @@ namespace configmgr
public:
bool open() SAL_THROW( (io::IOException, uno::RuntimeException) );
- typedef uno::Sequence< sal_Int8 > Binary;
- typedef uno::Sequence< rtl::OUString > StringList;
-
void read(sal_Bool &_nValue) SAL_THROW( (io::IOException, uno::RuntimeException) );
void read(sal_Int8 &_nValue) SAL_THROW( (io::IOException, uno::RuntimeException) );
void read(sal_Int16 &_nValue) SAL_THROW( (io::IOException, uno::RuntimeException) );
@@ -76,8 +71,8 @@ namespace configmgr
void read(sal_Int64 &_nValue) SAL_THROW( (io::IOException, uno::RuntimeException) );
void read(double &_nValue) SAL_THROW( (io::IOException, uno::RuntimeException) );
void read(rtl::OUString& _aStr) SAL_THROW( (io::IOException, uno::RuntimeException) );
- void read(Binary &_aValue) SAL_THROW( (io::IOException, uno::RuntimeException) );
- void read(StringList &_aValue) SAL_THROW( (io::IOException, uno::RuntimeException) );
+ void read(uno::Sequence< sal_Int8 > &_aValue) SAL_THROW( (io::IOException, uno::RuntimeException) );
+ void read(uno::Sequence< rtl::OUString > &_aValue) SAL_THROW( (io::IOException, uno::RuntimeException) );
private:
inline uno::Reference<io::XDataInputStream> getDataInputStream();
diff --git a/configmgr/source/backend/binaryreadhandler.cxx b/configmgr/source/backend/binaryreadhandler.cxx
index a1216d2f6d..eefca28952 100644
--- a/configmgr/source/backend/binaryreadhandler.cxx
+++ b/configmgr/source/backend/binaryreadhandler.cxx
@@ -46,7 +46,6 @@
namespace configmgr
{
- using namespace binary;
// -----------------------------------------------------------------------------
namespace backend
{
@@ -58,7 +57,7 @@ namespace configmgr
// -----------------------------------------------------------------------------
BinaryReadHandler::BinaryReadHandler(rtl::OUString const & _aFileURL,
rtl::OUString const & _aComponentName,
- MultiServiceFactory const & )
+ uno::Reference<lang::XMultiServiceFactory> const & )
: m_BinaryReader(_aFileURL)
, m_aNodeFactory()
, m_aComponentName(_aComponentName)
@@ -71,15 +70,15 @@ namespace configmgr
// -----------------------------------------------------------------------------
static inline
- bool isRequestingNoLocale(localehelper::Locale const & aRequestedLocale)
+ bool isRequestingNoLocale(com::sun::star::lang::Locale const & aRequestedLocale)
{
- OUString const & aLanguage = aRequestedLocale.Language;
+ rtl::OUString const & aLanguage = aRequestedLocale.Language;
return aLanguage.getLength() == 0 || localehelper::isDefaultLanguage(aLanguage);
}
// -----------------------------------------------------------------------------
static
- bool supportsLocale(uno::Sequence< OUString > const & aStoredLocales, OUString const & aRequestedLocale)
+ bool supportsLocale(uno::Sequence< rtl::OUString > const & aStoredLocales, rtl::OUString const & aRequestedLocale)
{
for (sal_Int32 ix=0; ix<aStoredLocales.getLength(); ++ix)
if (aStoredLocales[ix].equalsIgnoreAsciiCase(aRequestedLocale))
@@ -90,7 +89,7 @@ namespace configmgr
// -----------------------------------------------------------------------------
static
- bool supportsAll(uno::Sequence< OUString > const & aStoredLocales, uno::Sequence< OUString > const & aRequestedLocales)
+ bool supportsAll(uno::Sequence< rtl::OUString > const & aStoredLocales, uno::Sequence< rtl::OUString > const & aRequestedLocales)
{
for (sal_Int32 jx=0; jx<aRequestedLocales.getLength(); ++jx)
if (!supportsLocale(aStoredLocales,aRequestedLocales[jx]))
@@ -102,9 +101,9 @@ namespace configmgr
bool BinaryReadHandler::verifyFileHeader( const uno::Reference<backenduno::XLayer> * pLayers,
sal_Int32 nNumLayers,
- const OUString& _aSchemaVersion,
- localehelper::Locale const & aRequestedLocale,
- localehelper::LocaleSequence & outKnownLocales)
+ const rtl::OUString& _aSchemaVersion,
+ com::sun::star::lang::Locale const & aRequestedLocale,
+ std::vector< com::sun::star::lang::Locale > & outKnownLocales)
{
try
{
@@ -112,7 +111,7 @@ namespace configmgr
sal_Int16 nMagic, nVersion;
m_BinaryReader.read(nMagic);
m_BinaryReader.read(nVersion);
- if (nMagic !=CFG_BINARY_MAGIC || nVersion != CFG_BINARY_VERSION )
+ if (nMagic !=binary::CFG_BINARY_MAGIC || nVersion != binary::CFG_BINARY_VERSION )
return false;
rtl::OUString aSchemaVersion;
@@ -133,7 +132,7 @@ namespace configmgr
else if (!localehelper::designatesAllLocales(aRequestedLocale))
{
// one particular locale requested
- OUString const aIsoLocale = localehelper::makeIsoLocale(aRequestedLocale);
+ rtl::OUString const aIsoLocale = localehelper::makeIsoLocale(aRequestedLocale);
if (!supportsLocale(aKnownLocales,aIsoLocale))
{
// a locale we didn't load previously
@@ -205,19 +204,19 @@ namespace configmgr
return true;
}
// -----------------------------------------------------------------------------
- NodeType::Type BinaryReadHandler::readNodeType()
+ binary::NodeType::Type BinaryReadHandler::readNodeType()
SAL_THROW( (io::IOException, uno::RuntimeException) )
{
- NodeType::Type eType = NodeType::invalid;
+ binary::NodeType::Type eType = binary::NodeType::invalid;
sal_Int8 nValue;
m_BinaryReader.read(nValue);
sal_uInt8 const nRightValue( nValue );
- if ( (nRightValue & NodeType::nodetype_mask) == nRightValue )
- eType = NodeType::Type(nRightValue);
+ if ( (nRightValue & binary::NodeType::nodetype_mask) == nRightValue )
+ eType = binary::NodeType::Type(nRightValue);
- if (eType == NodeType::invalid)
+ if (eType == binary::NodeType::invalid)
{
OSL_ENSURE(false, "unknown or unhandled node type");
throw io::WrongFormatException();
@@ -227,32 +226,32 @@ namespace configmgr
}
// -----------------------------------------------------------------------------
- ValueFlags::Type BinaryReadHandler::readValueFlags(bool& bSeq, bool& bHasValue, bool& bHasDefault )
+ binary::ValueFlags::Type BinaryReadHandler::readValueFlags(bool& bSeq, bool& bHasValue, bool& bHasDefault )
SAL_THROW( (io::IOException, uno::RuntimeException) )
{
sal_Int8 nValue;
m_BinaryReader.read(nValue);
sal_uInt8 const nRightValue( nValue );
- ValueFlags::Type eType = ValueFlags::Type(nRightValue & ValueFlags::basictype_mask);
- if ( eType >= ValueFlags::val_invalid)
+ binary::ValueFlags::Type eType = binary::ValueFlags::Type(nRightValue & binary::ValueFlags::basictype_mask);
+ if ( eType >= binary::ValueFlags::val_invalid)
{
OSL_ENSURE(false, "unknown or unhandled value type");
throw io::WrongFormatException();
}
- if (nRightValue & ValueFlags::seq)
+ if (nRightValue & binary::ValueFlags::seq)
bSeq = true;
else
bSeq = false;
- if (nRightValue & ValueFlags::first_value_NULL)
+ if (nRightValue & binary::ValueFlags::first_value_NULL)
bHasValue = false;
else
bHasValue = true;
- if (nRightValue & ValueFlags::second_value_NULL)
+ if (nRightValue & binary::ValueFlags::second_value_NULL)
bHasDefault = false;
else
bHasDefault = true;
@@ -321,7 +320,7 @@ namespace configmgr
}
// -----------------------------------------------------------------------------
- uno::Type convertValueTypeToType(ValueFlags::Type eBasicValueType, bool bSeq)
+ uno::Type convertValueTypeToType(binary::ValueFlags::Type eBasicValueType, bool bSeq)
{
uno::Type aType;
@@ -331,28 +330,28 @@ namespace configmgr
{
// --------------- Simple types ---------------
- case ValueFlags::val_boolean:
+ case binary::ValueFlags::val_boolean:
aType = SimpleTypeHelper::getBooleanType();
break;
- case ValueFlags::val_int16:
+ case binary::ValueFlags::val_int16:
aType = SimpleTypeHelper::getShortType();
break;
- case ValueFlags::val_int32:
+ case binary::ValueFlags::val_int32:
aType = SimpleTypeHelper::getIntType();
break;
- case ValueFlags::val_int64:
+ case binary::ValueFlags::val_int64:
aType = SimpleTypeHelper::getLongType();
break;
- case ValueFlags::val_double:
+ case binary::ValueFlags::val_double:
aType = SimpleTypeHelper::getDoubleType();
break;
- case ValueFlags::val_string:
+ case binary::ValueFlags::val_string:
aType = SimpleTypeHelper::getStringType();
break;
- case ValueFlags::val_binary:
+ case binary::ValueFlags::val_binary:
aType = SimpleTypeHelper::getBinaryType();
break;
- case ValueFlags::val_any:
+ case binary::ValueFlags::val_any:
aType = SimpleTypeHelper::getAnyType();
break;
default:
@@ -365,26 +364,26 @@ namespace configmgr
// ------------ Sequences ------------
switch(eBasicValueType)
{
- case ValueFlags::val_boolean:
+ case binary::ValueFlags::val_boolean:
aType = ::getCppuType(static_cast<uno::Sequence<sal_Bool> const*>(0));
break;
- case ValueFlags::val_int16:
+ case binary::ValueFlags::val_int16:
aType = ::getCppuType(static_cast<uno::Sequence<sal_Int16> const*>(0));
break;
- case ValueFlags::val_int32:
+ case binary::ValueFlags::val_int32:
aType = ::getCppuType(static_cast<uno::Sequence<sal_Int32> const*>(0));
break;
- case ValueFlags::val_int64:
+ case binary::ValueFlags::val_int64:
aType = ::getCppuType(static_cast<uno::Sequence<sal_Int64> const*>(0));
break;
- case ValueFlags::val_double:
+ case binary::ValueFlags::val_double:
aType = ::getCppuType(static_cast<uno::Sequence<double> const*>(0));
break;
- case ValueFlags::val_string:
+ case binary::ValueFlags::val_string:
aType = ::getCppuType(static_cast<uno::Sequence<rtl::OUString> const*>(0));
break;
- case ValueFlags::val_binary:
- aType = ::getCppuType(static_cast<uno::Sequence<BinaryReader::Binary> const*>(0));
+ case binary::ValueFlags::val_binary:
+ aType = ::getCppuType(static_cast<uno::Sequence< uno::Sequence< sal_Int8 > > const*>(0));
break;
default:
OSL_ENSURE(false,"Invalid sequence value type");
@@ -404,7 +403,7 @@ namespace configmgr
bool bHasValue = false;
bool bHasDefault = false;
- ValueFlags::Type eBasicType = readValueFlags(bSeq, bHasValue, bHasDefault);
+ binary::ValueFlags::Type eBasicType = readValueFlags(bSeq, bHasValue, bHasDefault);
readAttributes(_aAttributes);
readName(_aName);
@@ -412,12 +411,12 @@ namespace configmgr
{
switch(eBasicType)
{
- case ValueFlags::val_any:
+ case binary::ValueFlags::val_any:
{
OSL_ENSURE(false,"Node of type Any cannot have value");
throw io::WrongFormatException();
}
- case ValueFlags::val_string:
+ case binary::ValueFlags::val_string:
{
rtl::OUString aStr;
if (bHasValue)
@@ -426,7 +425,7 @@ namespace configmgr
readAsAny(m_BinaryReader, _aDefaultValue, _aType, aStr);
break;
}
- case ValueFlags::val_boolean:
+ case binary::ValueFlags::val_boolean:
{
sal_Bool nValue;
if (bHasValue)
@@ -435,7 +434,7 @@ namespace configmgr
readAsAny(m_BinaryReader,_aDefaultValue, _aType, nValue);
break;
}
- case ValueFlags::val_int16:
+ case binary::ValueFlags::val_int16:
{
sal_Int16 nValue;
if (bHasValue)
@@ -444,7 +443,7 @@ namespace configmgr
readAsAny(m_BinaryReader,_aDefaultValue, _aType, nValue);
break;
}
- case ValueFlags::val_int32:
+ case binary::ValueFlags::val_int32:
{
sal_Int32 nValue;
if (bHasValue)
@@ -453,7 +452,7 @@ namespace configmgr
readAsAny(m_BinaryReader,_aDefaultValue, _aType, nValue);
break;
}
- case ValueFlags::val_int64:
+ case binary::ValueFlags::val_int64:
{
sal_Int64 nValue;
if (bHasValue)
@@ -462,7 +461,7 @@ namespace configmgr
readAsAny(m_BinaryReader,_aDefaultValue, _aType, nValue);
break;
}
- case ValueFlags::val_double:
+ case binary::ValueFlags::val_double:
{
double nValue;
if (bHasValue)
@@ -471,9 +470,9 @@ namespace configmgr
readAsAny(m_BinaryReader, _aDefaultValue, _aType, nValue);
break;
}
- case ValueFlags::val_binary:
+ case binary::ValueFlags::val_binary:
{
- BinaryReader::Binary aValue;
+ uno::Sequence< sal_Int8 > aValue;
if (bHasValue)
readAsAny(m_BinaryReader,_aValue, _aType, aValue);
if (bHasDefault)
@@ -508,9 +507,9 @@ namespace configmgr
std::auto_ptr<ISubtree> BinaryReadHandler::readComponentTree()
SAL_THROW( (io::IOException, uno::RuntimeException) )
{
- NodeType::Type eType = this->readNodeType();
+ binary::NodeType::Type eType = this->readNodeType();
- if (eType != NodeType::component)
+ if (eType != binary::NodeType::component)
{
// TODO: search for component tree
OSL_ENSURE(false, "binary Cache: unexpected tree type for component data");
@@ -523,9 +522,9 @@ namespace configmgr
std::auto_ptr<ISubtree> BinaryReadHandler::readTemplatesTree()
SAL_THROW( (io::IOException, uno::RuntimeException) )
{
- NodeType::Type eType = this->readNodeType();
+ binary::NodeType::Type eType = this->readNodeType();
- if (eType != NodeType::templates)
+ if (eType != binary::NodeType::templates)
{
// TODO: search for templates tree
OSL_ENSURE(false, "binary Cache: unexpected tree type for template data");
@@ -545,23 +544,23 @@ namespace configmgr
node::Attributes aAttributes;
const bool not_extensible = false;
- NodeType::Type eType = this->readNodeType();
+ binary::NodeType::Type eType = this->readNodeType();
switch (eType)
{
- case NodeType::groupnode:
+ case binary::NodeType::groupnode:
{
this->readGroup(aName, aAttributes);
pTree = m_aNodeFactory.createGroup(aName,not_extensible,aAttributes);
break;
}
- case NodeType::setnode:
+ case binary::NodeType::setnode:
{
backenduno::TemplateIdentifier aTemplate;
this->readSet(aName, aAttributes,aTemplate.Name, aTemplate.Component);
pTree = m_aNodeFactory.createSet(aName,aTemplate,not_extensible,aAttributes);
break;
}
- case NodeType::nodata:
+ case binary::NodeType::nodata:
break;
default:
@@ -576,7 +575,7 @@ namespace configmgr
//read terminating stop node
eType = this->readNodeType();
- OSL_ENSURE(NodeType::stop == eType, "Missing stop node to mark end of tree");
+ OSL_ENSURE(binary::NodeType::stop == eType, "Missing stop node to mark end of tree");
}
return pTree;
}
@@ -585,9 +584,9 @@ namespace configmgr
// -----------------------------------------------------------------------------
bool BinaryReadHandler::validateHeader( const uno::Reference<backenduno::XLayer> * pLayers,
sal_Int32 nNumLayers,
- const OUString& _aSchemaVersion,
- localehelper::Locale const & aRequestedLocale,
- localehelper::LocaleSequence & outKnownLocales)
+ const rtl::OUString& _aSchemaVersion,
+ com::sun::star::lang::Locale const & aRequestedLocale,
+ std::vector< com::sun::star::lang::Locale > & outKnownLocales)
SAL_THROW( (io::IOException, uno::RuntimeException) )
{
@@ -599,13 +598,13 @@ namespace configmgr
return false;
//Check if layers are uptodate
- std::vector <OUString> timeStamps(nNumLayers);
+ std::vector <rtl::OUString> timeStamps(nNumLayers);
for (sal_Int32 i = 0 ; i < nNumLayers ; ++ i)
{
uno::Reference<util::XTimeStamped> xTimeStamp = uno::Reference<util::XTimeStamped>(pLayers[i], uno::UNO_QUERY);
if (xTimeStamp.is())
{
- OUString aTimeStamp = xTimeStamp->getTimestamp();
+ rtl::OUString aTimeStamp = xTimeStamp->getTimestamp();
timeStamps[i] = aTimeStamp;
}
}
@@ -615,15 +614,15 @@ namespace configmgr
// -----------------------------------------------------------------------------
void BinaryReadHandler::readChildren(ISubtree & rTree )
{
- OSL_ASSERT(!NodeType::stop); // loop stops at stop node
- while (NodeType::Type eType = this->readNodeType())
+ OSL_ASSERT(!binary::NodeType::stop); // loop stops at stop node
+ while (binary::NodeType::Type eType = this->readNodeType())
{
rtl::OUString aName;
node::Attributes aAttributes;
const bool not_extensible = false;
switch (eType)
{
- case NodeType::groupnode:
+ case binary::NodeType::groupnode:
{
this->readGroup(aName, aAttributes);
@@ -638,7 +637,7 @@ namespace configmgr
rTree.addChild(base_ptr(pNewNode));
break;
}
- case NodeType::setnode:
+ case binary::NodeType::setnode:
{
backenduno::TemplateIdentifier aTemplate;
this->readSet(aName, aAttributes,aTemplate.Name, aTemplate.Component);
@@ -654,7 +653,7 @@ namespace configmgr
rTree.addChild(base_ptr(pNewSetNode));
break;
}
- case NodeType::valuenode:
+ case binary::NodeType::valuenode:
{
uno::Any aValue;
uno::Any aDefaultValue;
diff --git a/configmgr/source/backend/binaryreadhandler.hxx b/configmgr/source/backend/binaryreadhandler.hxx
index 3cdfcc90b8..7a7e75a607 100644
--- a/configmgr/source/backend/binaryreadhandler.hxx
+++ b/configmgr/source/backend/binaryreadhandler.hxx
@@ -70,14 +70,14 @@ namespace configmgr
rtl::OUString m_aComponentName;
public:
- BinaryReadHandler(rtl::OUString const & _aFileURL, rtl::OUString const & _aComponentName, MultiServiceFactory const & _aFactory);
+ BinaryReadHandler(rtl::OUString const & _aFileURL, rtl::OUString const & _aComponentName, uno::Reference<lang::XMultiServiceFactory> const & _aFactory);
~BinaryReadHandler();
bool validateHeader( const uno::Reference<backenduno::XLayer> * pLayers,
sal_Int32 nNumLayers,
- const OUString& _aSchemaVersion,
- localehelper::Locale const & aRequestedLocale,
- localehelper::LocaleSequence & outKnownLocales)
+ const rtl::OUString& _aSchemaVersion,
+ com::sun::star::lang::Locale const & aRequestedLocale,
+ std::vector< com::sun::star::lang::Locale > & outKnownLocales)
SAL_THROW( (io::IOException, uno::RuntimeException) );
std::auto_ptr<ISubtree> readComponentTree()
@@ -96,9 +96,9 @@ namespace configmgr
private:
bool verifyFileHeader( const uno::Reference<backenduno::XLayer> * pLayers,
sal_Int32 nNumLayers,
- const OUString& _aSchemaVersion,
- localehelper::Locale const & aRequestedLocale,
- localehelper::LocaleSequence & outKnownLocales);
+ const rtl::OUString& _aSchemaVersion,
+ com::sun::star::lang::Locale const & aRequestedLocale,
+ std::vector< com::sun::star::lang::Locale > & outKnownLocales);
bool isUptodate(const std::vector<rtl::OUString> & _timeStamps)
SAL_THROW( (io::IOException, uno::RuntimeException) );
diff --git a/configmgr/source/backend/binarytype.hxx b/configmgr/source/backend/binarytype.hxx
index 9ccb526723..11e187a719 100644
--- a/configmgr/source/backend/binarytype.hxx
+++ b/configmgr/source/backend/binarytype.hxx
@@ -37,7 +37,6 @@ namespace configmgr
valuetype_mask = 0x1F,
pairstate_mask = first_value_NULL | second_value_NULL
};
- typedef sal_uInt8 Field;
}
namespace NodeType
@@ -56,7 +55,6 @@ namespace configmgr
nodetype_mask = 0xE0
};
- typedef sal_uInt8 Field;
}
}
}
diff --git a/configmgr/source/backend/binarywritehandler.cxx b/configmgr/source/backend/binarywritehandler.cxx
index 9ce37f4ccb..bb168cb8a4 100644
--- a/configmgr/source/backend/binarywritehandler.cxx
+++ b/configmgr/source/backend/binarywritehandler.cxx
@@ -43,16 +43,14 @@ namespace configmgr
namespace backend
{
- using ::rtl::OUString;
namespace css = com::sun::star;
namespace util = css::util ;
- using namespace binary;
// -----------------------------------------------------------------------------
BinaryWriteHandler::BinaryWriteHandler( rtl::OUString const & _aFileURL,
rtl::OUString const & _aComponentName,
- MultiServiceFactory const & _aFactory)
+ uno::Reference<lang::XMultiServiceFactory> const & _aFactory)
: m_BinaryWriter(_aFileURL,_aFactory)
, m_aComponentName(_aComponentName)
{
@@ -60,45 +58,45 @@ namespace configmgr
}
// -----------------------------------------------------------------------------
static
- ValueFlags::Type convertTypeToValueType(uno::Type const& _aType)
+ binary::ValueFlags::Type convertTypeToValueType(uno::Type const& _aType)
{
- ValueFlags::Type eType = ValueFlags::val_invalid;
+ binary::ValueFlags::Type eType = binary::ValueFlags::val_invalid;
uno::TypeClass const aClass = _aType.getTypeClass();
switch(aClass)
{
case uno::TypeClass_ANY:
- eType = ValueFlags::val_any;
+ eType = binary::ValueFlags::val_any;
break;
case uno::TypeClass_BOOLEAN:
- eType = ValueFlags::val_boolean;
+ eType = binary::ValueFlags::val_boolean;
break;
case uno::TypeClass_SHORT:
- eType = ValueFlags::val_int16;
+ eType = binary::ValueFlags::val_int16;
break;
case uno::TypeClass_LONG:
- eType = ValueFlags::val_int32;
+ eType = binary::ValueFlags::val_int32;
break;
case uno::TypeClass_HYPER:
- eType = ValueFlags::val_int64;
+ eType = binary::ValueFlags::val_int64;
break;
case uno::TypeClass_DOUBLE:
- eType = ValueFlags::val_double;
+ eType = binary::ValueFlags::val_double;
break;
case uno::TypeClass_STRING:
- eType = ValueFlags::val_string;
+ eType = binary::ValueFlags::val_string;
break;
case uno::TypeClass_SEQUENCE:
if (_aType == SimpleTypeHelper::getBinaryType())
{
- eType = ValueFlags::val_binary;
+ eType = binary::ValueFlags::val_binary;
}
else
{
uno::Type aType = configmgr::getSequenceElementType(_aType);
eType = convertTypeToValueType(aType);
- OSL_ENSURE(!(eType & ValueFlags::seq), "Binary Writer - Invalid value type: Multiple nesting of sequences");
- eType = ValueFlags::Type( eType | ValueFlags::seq );
+ OSL_ENSURE(!(eType & binary::ValueFlags::seq), "Binary Writer - Invalid value type: Multiple nesting of sequences");
+ eType = binary::ValueFlags::Type( eType | binary::ValueFlags::seq );
}
break;
default:
@@ -177,7 +175,7 @@ namespace configmgr
CASE_WRITE_SEQUENCE( uno::TypeClass_DOUBLE, double );
- CASE_WRITE_SEQUENCE( uno::TypeClass_STRING, OUString );
+ CASE_WRITE_SEQUENCE( uno::TypeClass_STRING, rtl::OUString );
CASE_WRITE_SEQUENCE( uno::TypeClass_SEQUENCE, uno::Sequence<sal_Int8> );
@@ -235,7 +233,7 @@ namespace configmgr
}
case uno::TypeClass_STRING:
{
- OUString aStr;
+ rtl::OUString aStr;
writeFromAny(_rWriter, _aValue, aStr);
break;
}
@@ -271,12 +269,12 @@ namespace configmgr
// -----------------------------------------------------------------------------
void BinaryWriteHandler::writeFileHeader( rtl::OUString const & _aSchemaVersion,
- const uno::Sequence<OUString> & aKnownLocales,
- const uno::Sequence<OUString> & aDataLocales )
+ const uno::Sequence<rtl::OUString> & aKnownLocales,
+ const uno::Sequence<rtl::OUString> & aDataLocales )
SAL_THROW( (io::IOException, uno::RuntimeException) )
{
- m_BinaryWriter.write(CFG_BINARY_MAGIC);
- m_BinaryWriter.write(CFG_BINARY_VERSION);
+ m_BinaryWriter.write(binary::CFG_BINARY_MAGIC);
+ m_BinaryWriter.write(binary::CFG_BINARY_VERSION);
m_BinaryWriter.write(_aSchemaVersion);
writeSequence(m_BinaryWriter,aKnownLocales);
writeSequence(m_BinaryWriter,aDataLocales);
@@ -315,14 +313,14 @@ namespace configmgr
{
uno::Reference<util::XTimeStamped> xTimeStamp = uno::Reference<util::XTimeStamped>(pLayers[i], uno::UNO_QUERY);
- OUString aTimeStamp = xTimeStamp.is() ? xTimeStamp->getTimestamp() : OUString();
+ rtl::OUString aTimeStamp = xTimeStamp.is() ? xTimeStamp->getTimestamp() : rtl::OUString();
m_BinaryWriter.write(aTimeStamp);
}
}
// -----------------------------------------------------------------------------
- void BinaryWriteHandler::writeNodeType(NodeType::Type _eType)
+ void BinaryWriteHandler::writeNodeType(binary::NodeType::Type _eType)
SAL_THROW( (io::IOException, uno::RuntimeException) )
{
sal_Int8 nValue = static_cast< sal_Int8 >( _eType );
@@ -362,14 +360,14 @@ namespace configmgr
SAL_THROW( (io::IOException, uno::RuntimeException) )
{
//write value flags
- ValueFlags::Type eType = convertTypeToValueType(_aType);
+ binary::ValueFlags::Type eType = convertTypeToValueType(_aType);
sal_Int8 nValueType = sal_Int8(eType);
bool hasUserValue = _aUserValue.hasValue();
bool hasDefault = _aDefaultValue.hasValue();
- if (!hasUserValue) nValueType |= ValueFlags::first_value_NULL;
- if (!hasDefault) nValueType |= ValueFlags::second_value_NULL;
+ if (!hasUserValue) nValueType |= binary::ValueFlags::first_value_NULL;
+ if (!hasDefault) nValueType |= binary::ValueFlags::second_value_NULL;
m_BinaryWriter.write(nValueType);
writeAttributes(_aAttributes );
@@ -399,7 +397,7 @@ namespace configmgr
void BinaryWriteHandler::writeComponentTree(const ISubtree * _pComponentTree)
SAL_THROW( (io::IOException, uno::RuntimeException) )
{
- this->writeNodeType(NodeType::component);
+ this->writeNodeType(binary::NodeType::component);
if (_pComponentTree)
{
this->writeTree(*_pComponentTree);
@@ -407,7 +405,7 @@ namespace configmgr
}
else
{
- this->writeNodeType(NodeType::nodata);
+ this->writeNodeType(binary::NodeType::nodata);
}
}
// -----------------------------------------------------------------------------
@@ -415,7 +413,7 @@ namespace configmgr
void BinaryWriteHandler::writeTemplatesTree(const ISubtree * _pTemplatesTree)
SAL_THROW( (io::IOException, uno::RuntimeException) )
{
- this->writeNodeType(NodeType::templates);
+ this->writeNodeType(binary::NodeType::templates);
if (_pTemplatesTree)
{
this->writeTree(*_pTemplatesTree);
@@ -423,7 +421,7 @@ namespace configmgr
}
else
{
- this->writeNodeType(NodeType::nodata);
+ this->writeNodeType(binary::NodeType::nodata);
}
}
// -----------------------------------------------------------------------------
@@ -433,7 +431,7 @@ namespace configmgr
{
if ( rTree.isSetNode() )
{
- this->writeNodeType(NodeType::setnode);
+ this->writeNodeType(binary::NodeType::setnode);
this->writeSetNode( rTree.getName(),
rTree.getElementTemplateName(),
rTree.getElementTemplateModule(),
@@ -441,7 +439,7 @@ namespace configmgr
}
else
{
- this->writeNodeType(NodeType::groupnode);
+ this->writeNodeType(binary::NodeType::groupnode);
this->writeGroupNode( rTree.getName(), rTree.getAttributes() );
}
@@ -460,7 +458,7 @@ namespace configmgr
void BinaryWriteHandler::handle(const ValueNode & rValue)
{
- this->writeNodeType(NodeType::valuenode);
+ this->writeNodeType(binary::NodeType::valuenode);
this->writeValueNode( rValue.getName(),
rValue.getAttributes(),
@@ -472,8 +470,8 @@ namespace configmgr
bool BinaryWriteHandler::generateHeader(const uno::Reference<backenduno::XLayer> * pLayers,
sal_Int32 nNumLayers,
- const OUString& aEntity,
- const localehelper::LocaleSequence & aKnownLocales )
+ const rtl::OUString& aEntity,
+ const std::vector< com::sun::star::lang::Locale > & aKnownLocales )
SAL_THROW( (io::IOException, uno::RuntimeException) )
{
//Open the writer
diff --git a/configmgr/source/backend/binarywritehandler.hxx b/configmgr/source/backend/binarywritehandler.hxx
index bf9f93cd9c..366b4c78df 100644
--- a/configmgr/source/backend/binarywritehandler.hxx
+++ b/configmgr/source/backend/binarywritehandler.hxx
@@ -56,12 +56,12 @@ namespace configmgr
rtl::OUString m_aComponentName;
public:
- BinaryWriteHandler(rtl::OUString const & _aFileURL, rtl::OUString const & _aComponentName, MultiServiceFactory const & _aFactory);
+ BinaryWriteHandler(rtl::OUString const & _aFileURL, rtl::OUString const & _aComponentName, uno::Reference<lang::XMultiServiceFactory> const & _aFactory);
bool generateHeader( const uno::Reference<backenduno::XLayer> * pLayers,
sal_Int32 nNumLayers,
- const OUString& aEntity,
- const localehelper::LocaleSequence & aKnownLocales )
+ const rtl::OUString& aEntity,
+ const std::vector< com::sun::star::lang::Locale > & aKnownLocales )
SAL_THROW( (io::IOException, uno::RuntimeException) );
void writeComponentTree(const ISubtree * _pComponentTree)
@@ -77,8 +77,8 @@ namespace configmgr
virtual void handle(ValueNode const & aValue);
private:
void writeFileHeader( rtl::OUString const & _aSchemaVersion,
- const uno::Sequence<OUString> & aKnownLocales,
- const uno::Sequence<OUString> & aDataLocales )
+ const uno::Sequence<rtl::OUString> & aKnownLocales,
+ const uno::Sequence<rtl::OUString> & aDataLocales )
SAL_THROW( (io::IOException, uno::RuntimeException) );
void writeLayerInfoList(uno::Reference<backenduno::XLayer> const * pLayers, sal_Int32 nNumlayers)
diff --git a/configmgr/source/backend/binarywriter.cxx b/configmgr/source/backend/binarywriter.cxx
index fba858beb4..fafe25f3f1 100644
--- a/configmgr/source/backend/binarywriter.cxx
+++ b/configmgr/source/backend/binarywriter.cxx
@@ -51,10 +51,6 @@ namespace configmgr
// -----------------------------------------------------------------------------
namespace backend
{
- using namespace ::rtl;
- using namespace ::std;
- using namespace ::com::sun::star;
- using namespace ::com::sun::star::uno;
namespace uno = com::sun::star::uno;
namespace io = com::sun::star::io;
diff --git a/configmgr/source/backend/binarywriter.hxx b/configmgr/source/backend/binarywriter.hxx
index 7f482e40df..58c11b82c9 100644
--- a/configmgr/source/backend/binarywriter.hxx
+++ b/configmgr/source/backend/binarywriter.hxx
@@ -47,8 +47,6 @@ namespace configmgr
namespace io = css::io;
namespace uno = css::uno;
namespace lang = css::lang;
-
- typedef uno::Reference<lang::XMultiServiceFactory> MultiServiceFactory;
// -----------------------------------------------------------------------------
class BinaryWriter
@@ -59,7 +57,7 @@ namespace configmgr
uno::Reference< io::XDataOutputStream > m_xDataOutputStream;
public:
- BinaryWriter(rtl::OUString const& m_aFilename, MultiServiceFactory const& _rxServiceProvider);
+ BinaryWriter(rtl::OUString const& m_aFilename, uno::Reference<lang::XMultiServiceFactory> const& _rxServiceProvider);
~BinaryWriter();
bool open() SAL_THROW( (io::IOException, uno::RuntimeException) );
diff --git a/configmgr/source/backend/componentdatahelper.cxx b/configmgr/source/backend/componentdatahelper.cxx
index f7857d1fc0..0007ac1bb7 100644
--- a/configmgr/source/backend/componentdatahelper.cxx
+++ b/configmgr/source/backend/componentdatahelper.cxx
@@ -46,7 +46,7 @@
#include <com/sun/star/beans/UnknownPropertyException.hpp>
// -----------------------------------------------------------------------------
-#define OUSTR( str ) OUString( RTL_CONSTASCII_USTRINGPARAM(str) )
+#define OUSTR( str ) rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(str) )
// -----------------------------------------------------------------------------
namespace configmgr
{
@@ -58,22 +58,20 @@ namespace configmgr
namespace lang = ::com::sun::star::lang;
namespace beans = ::com::sun::star::beans;
namespace container = ::com::sun::star::container;
-
- using backenduno::MalformedDataException;
// -----------------------------------------------------------------------------
-DataBuilderContext::DataBuilderContext( UnoContext const & xContext )
+DataBuilderContext::DataBuilderContext( uno::Reference< uno::XComponentContext > const & xContext )
: m_aLogger(xContext)
, m_aParentStack()
, m_aActiveComponent()
, m_pContext()
-, m_aExpectedComponentName(OUString())
+, m_aExpectedComponentName(rtl::OUString())
{
}
// -----------------------------------------------------------------------------
-DataBuilderContext::DataBuilderContext( UnoContext const & xContext, uno::XInterface * _pContext, ITemplateDataProvider* aTemplateProvider )
+DataBuilderContext::DataBuilderContext( uno::Reference< uno::XComponentContext > const & xContext, uno::XInterface * _pContext, ITemplateDataProvider* aTemplateProvider )
: m_aLogger(xContext)
, m_aParentStack()
, m_aActiveComponent()
@@ -85,7 +83,7 @@ DataBuilderContext::DataBuilderContext( UnoContext const & xContext, uno::XInter
}
// -----------------------------------------------------------------------------
-DataBuilderContext::DataBuilderContext( UnoContext const & xContext, uno::XInterface * _pContext, const OUString& aExpectedComponentName, ITemplateDataProvider* aTemplateProvider )
+DataBuilderContext::DataBuilderContext( uno::Reference< uno::XComponentContext > const & xContext, uno::XInterface * _pContext, const rtl::OUString& aExpectedComponentName, ITemplateDataProvider* aTemplateProvider )
: m_aLogger(xContext)
, m_aParentStack()
, m_aActiveComponent()
@@ -117,76 +115,76 @@ DataBuilderContext::~DataBuilderContext( )
// -----------------------------------------------------------------------------
void DataBuilderContext::raiseMalformedDataException(sal_Char const * _pText) const
- CFG_UNO_THROW1( configuration::backend::MalformedDataException )
+ SAL_THROW((com::sun::star::configuration::backend::MalformedDataException, com::sun::star::uno::RuntimeException))
{
- OUString const sMessage = makeMessageWithPath(_pText);
+ rtl::OUString const sMessage = makeMessageWithPath(_pText);
m_aLogger.error(sMessage,"parse","configmgr::backend::DataBuilder");
- throw MalformedDataException(sMessage, m_pContext, uno::Any());
+ throw backenduno::MalformedDataException(sMessage, m_pContext, uno::Any());
}
// -----------------------------------------------------------------------------
void DataBuilderContext::raiseIllegalTypeException(sal_Char const * _pText) const
- CFG_UNO_THROW1( configuration::backend::MalformedDataException )
+ SAL_THROW((com::sun::star::configuration::backend::MalformedDataException, com::sun::star::uno::RuntimeException))
{
- OUString const sMessage = makeMessageWithPath(_pText);
+ rtl::OUString const sMessage = makeMessageWithPath(_pText);
beans::IllegalTypeException e(sMessage, m_pContext);
- OUString const sFullMessage = OUSTR("Illegal Type: ").concat(sMessage);
+ rtl::OUString const sFullMessage = OUSTR("Illegal Type: ").concat(sMessage);
m_aLogger.error(sFullMessage,"parse","configmgr::backend::DataBuilder");
- throw MalformedDataException(sFullMessage, m_pContext, uno::makeAny(e));
+ throw backenduno::MalformedDataException(sFullMessage, m_pContext, uno::makeAny(e));
}
// -----------------------------------------------------------------------------
void DataBuilderContext::raiseIllegalArgumentException(sal_Char const * _pText, sal_Int16 _nPos) const
- CFG_UNO_THROW1( configuration::backend::MalformedDataException )
+ SAL_THROW((com::sun::star::configuration::backend::MalformedDataException , com::sun::star::uno::RuntimeException))
{
- OUString const sMessage = makeMessageWithPath(_pText);
+ rtl::OUString const sMessage = makeMessageWithPath(_pText);
lang::IllegalArgumentException e(sMessage, m_pContext, _nPos);
- OUString const sFullMessage = OUSTR("Illegal Argument: ").concat(sMessage);
+ rtl::OUString const sFullMessage = OUSTR("Illegal Argument: ").concat(sMessage);
m_aLogger.error(sFullMessage,"parse","configmgr::backend::DataBuilder");
- throw MalformedDataException(sFullMessage, m_pContext, uno::makeAny(e));
+ throw backenduno::MalformedDataException(sFullMessage, m_pContext, uno::makeAny(e));
}
// -----------------------------------------------------------------------------
-void DataBuilderContext::raiseNoSuchElementException(sal_Char const * _pText, OUString const & _sElement) const
- CFG_UNO_THROW1( configuration::backend::MalformedDataException )
+void DataBuilderContext::raiseNoSuchElementException(sal_Char const * _pText, rtl::OUString const & _sElement) const
+ SAL_THROW((com::sun::star::configuration::backend::MalformedDataException , com::sun::star::uno::RuntimeException))
{
- OUString const sMessage = makeMessageWithName(_pText,_sElement);
+ rtl::OUString const sMessage = makeMessageWithName(_pText,_sElement);
container::NoSuchElementException e(sMessage, m_pContext);
- OUString const sFullMessage = OUSTR("No Such Node: ").concat(sMessage);
+ rtl::OUString const sFullMessage = OUSTR("No Such Node: ").concat(sMessage);
m_aLogger.error(sFullMessage,"parse","configmgr::backend::DataBuilder");
- throw MalformedDataException(sFullMessage, m_pContext, uno::makeAny(e));
+ throw backenduno::MalformedDataException(sFullMessage, m_pContext, uno::makeAny(e));
}
// -----------------------------------------------------------------------------
-void DataBuilderContext::raiseElementExistException(sal_Char const * _pText, OUString const & _sElement) const
- CFG_UNO_THROW1( configuration::backend::MalformedDataException )
+void DataBuilderContext::raiseElementExistException(sal_Char const * _pText, rtl::OUString const & _sElement) const
+ SAL_THROW((com::sun::star::configuration::backend::MalformedDataException , com::sun::star::uno::RuntimeException))
{
- OUString const sMessage = makeMessageWithName(_pText,_sElement);
+ rtl::OUString const sMessage = makeMessageWithName(_pText,_sElement);
container::ElementExistException e(sMessage, m_pContext);
- OUString const sFullMessage = OUSTR("Node Already Exists: ").concat(sMessage);
+ rtl::OUString const sFullMessage = OUSTR("Node Already Exists: ").concat(sMessage);
m_aLogger.error(sFullMessage,"parse","configmgr::backend::DataBuilder");
- throw MalformedDataException(sFullMessage, m_pContext, uno::makeAny(e));
+ throw backenduno::MalformedDataException(sFullMessage, m_pContext, uno::makeAny(e));
}
// -----------------------------------------------------------------------------
-void DataBuilderContext::raisePropertyExistException(sal_Char const * _pText, OUString const & _sElement) const
- CFG_UNO_THROW1( configuration::backend::MalformedDataException )
+void DataBuilderContext::raisePropertyExistException(sal_Char const * _pText, rtl::OUString const & _sElement) const
+ SAL_THROW((com::sun::star::configuration::backend::MalformedDataException , com::sun::star::uno::RuntimeException))
{
- OUString const sMessage = makeMessageWithName(_pText,_sElement);
+ rtl::OUString const sMessage = makeMessageWithName(_pText,_sElement);
beans::PropertyExistException e(sMessage, m_pContext);
- OUString const sFullMessage = OUSTR("No Such Property: ").concat(sMessage);
+ rtl::OUString const sFullMessage = OUSTR("No Such Property: ").concat(sMessage);
m_aLogger.error(sFullMessage,"parse","configmgr::backend::DataBuilder");
- throw MalformedDataException(sFullMessage, m_pContext, uno::makeAny(e));
+ throw backenduno::MalformedDataException(sFullMessage, m_pContext, uno::makeAny(e));
}
// -----------------------------------------------------------------------------
-OUString DataBuilderContext::makeMessageWithPath(sal_Char const * _pText) const
- CFG_UNO_THROW_RTE( )
+rtl::OUString DataBuilderContext::makeMessageWithPath(sal_Char const * _pText) const
+ SAL_THROW((com::sun::star::uno::RuntimeException))
{
rtl::OUStringBuffer sMessage;
sMessage.appendAscii(_pText);
@@ -197,8 +195,8 @@ OUString DataBuilderContext::makeMessageWithPath(sal_Char const * _pText) const
}
// -----------------------------------------------------------------------------
-OUString DataBuilderContext::makeMessageWithName(sal_Char const * _pText, OUString const & _aName) const
- CFG_UNO_THROW_RTE( )
+rtl::OUString DataBuilderContext::makeMessageWithName(sal_Char const * _pText, rtl::OUString const & _aName) const
+ SAL_THROW((com::sun::star::uno::RuntimeException))
{
rtl::OUStringBuffer sMessage;
sMessage.appendAscii(_pText);
@@ -213,7 +211,7 @@ OUString DataBuilderContext::makeMessageWithName(sal_Char const * _pText, OUStri
// -----------------------------------------------------------------------------
const sal_Unicode k_pathsep = '/';
-OUString DataBuilderContext::getNodeParentagePath() const
+rtl::OUString DataBuilderContext::getNodeParentagePath() const
{
rtl::OUStringBuffer path;
@@ -228,7 +226,7 @@ OUString DataBuilderContext::getNodeParentagePath() const
}
// -----------------------------------------------------------------------------
-OUString DataBuilderContext::getNodePath(OUString const & aNodeName) const
+rtl::OUString DataBuilderContext::getNodePath(rtl::OUString const & aNodeName) const
{
rtl::OUStringBuffer path( getNodeParentagePath() );
@@ -248,7 +246,7 @@ bool DataBuilderContext::isDone() const
// -----------------------------------------------------------------------------
ISubtree & DataBuilderContext::implGetCurrentParent() const
- CFG_UNO_THROW1( configuration::backend::MalformedDataException )
+ SAL_THROW((com::sun::star::configuration::backend::MalformedDataException , com::sun::star::uno::RuntimeException))
{
if (m_aParentStack.empty())
raiseMalformedDataException("Invalid Component Data: Operation requires open parent node.");
@@ -260,7 +258,7 @@ ISubtree & DataBuilderContext::implGetCurrentParent() const
// -----------------------------------------------------------------------------
bool DataBuilderContext::isWritable(INode const * pNode) const
- CFG_NOTHROW( )
+ SAL_THROW(())
{
OSL_PRECOND(pNode,"Unexpected NULL node pointer");
return pNode->getAttributes().isWritable();
@@ -269,7 +267,7 @@ bool DataBuilderContext::isWritable(INode const * pNode) const
// -----------------------------------------------------------------------------
bool DataBuilderContext::isRemovable(ISubtree const * pItem) const
- CFG_NOTHROW( )
+ SAL_THROW(())
{
OSL_PRECOND(pItem,"Unexpected NULL item pointer");
return pItem->getAttributes().isRemovable();
@@ -278,7 +276,7 @@ bool DataBuilderContext::isRemovable(ISubtree const * pItem) const
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
-OUString DataBuilderContext::getTemplateComponent( const TemplateIdentifier& aItemType ) const
+rtl::OUString DataBuilderContext::getTemplateComponent( const backenduno::TemplateIdentifier& aItemType ) const
{
if (aItemType.Component.getLength() != 0)
return aItemType.Component;
@@ -288,9 +286,9 @@ OUString DataBuilderContext::getTemplateComponent( const TemplateIdentifier& aIt
}
// -----------------------------------------------------------------------------
-TemplateIdentifier DataBuilderContext::completeComponent( const TemplateIdentifier& aItemType ) const
+backenduno::TemplateIdentifier DataBuilderContext::completeComponent( const backenduno::TemplateIdentifier& aItemType ) const
{
- TemplateIdentifier aComplete(aItemType);
+ backenduno::TemplateIdentifier aComplete(aItemType);
if (aComplete.Component.getLength() == 0)
aComplete.Component = getActiveComponent();
@@ -299,14 +297,14 @@ TemplateIdentifier DataBuilderContext::completeComponent( const TemplateIdentifi
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
-TemplateIdentifier DataBuilderContext::getCurrentItemType() const
- CFG_UNO_THROW1( configuration::backend::MalformedDataException )
+backenduno::TemplateIdentifier DataBuilderContext::getCurrentItemType() const
+ SAL_THROW((com::sun::star::configuration::backend::MalformedDataException , com::sun::star::uno::RuntimeException))
{
ISubtree const * pCurrentSet = getCurrentParent().asISubtree();
if (!pCurrentSet || !pCurrentSet->isSetNode())
raiseMalformedDataException("Component Builder Context: Cannot add/replace node - context is not a set");
- TemplateIdentifier aCompleteType;
+ backenduno::TemplateIdentifier aCompleteType;
aCompleteType.Name = pCurrentSet->getElementTemplateName();
aCompleteType.Component = pCurrentSet->getElementTemplateModule();
@@ -315,14 +313,14 @@ TemplateIdentifier DataBuilderContext::getCurrentItemType() const
}
// -----------------------------------------------------------------------------
-TemplateIdentifier DataBuilderContext::getValidItemType(TemplateIdentifier const & aItemType) const
- CFG_UNO_THROW1( configuration::backend::MalformedDataException )
+backenduno::TemplateIdentifier DataBuilderContext::getValidItemType(backenduno::TemplateIdentifier const & aItemType) const
+ SAL_THROW((com::sun::star::configuration::backend::MalformedDataException , com::sun::star::uno::RuntimeException))
{
ISubtree const * pCurrentSet = getCurrentParent().asISubtree();
if (!pCurrentSet || !pCurrentSet->isSetNode())
raiseMalformedDataException("Component Builder Context: Cannot add/replace node - context is not a set");
- TemplateIdentifier aCompleteType = completeComponent( aItemType );
+ backenduno::TemplateIdentifier aCompleteType = completeComponent( aItemType );
// for now only a single item-type is supported
if (aCompleteType.Name != pCurrentSet->getElementTemplateName())
@@ -336,7 +334,7 @@ TemplateIdentifier DataBuilderContext::getValidItemType(TemplateIdentifier const
// -----------------------------------------------------------------------------
ISubtree * DataBuilderContext::addNodeToCurrent(std::auto_ptr<ISubtree> _aNode)
- CFG_UNO_THROW1( configuration::backend::MalformedDataException )
+ SAL_THROW((com::sun::star::configuration::backend::MalformedDataException , com::sun::star::uno::RuntimeException))
{
OSL_PRECOND(_aNode.get(), "ERROR: Adding a NULL node");
@@ -348,7 +346,7 @@ ISubtree * DataBuilderContext::addNodeToCurrent(std::auto_ptr<ISubtree> _aNode
// -----------------------------------------------------------------------------
ISubtree * DataBuilderContext::addLocalizedToCurrent(std::auto_ptr<ISubtree> _aNode)
- CFG_UNO_THROW1( configuration::backend::MalformedDataException )
+ SAL_THROW((com::sun::star::configuration::backend::MalformedDataException , com::sun::star::uno::RuntimeException))
{
OSL_PRECOND(_aNode.get(), "ERROR: Adding a NULL node");
@@ -360,7 +358,7 @@ ISubtree * DataBuilderContext::addLocalizedToCurrent(std::auto_ptr<ISubtree> _
// -----------------------------------------------------------------------------
ValueNode * DataBuilderContext::addPropertyToCurrent(std::auto_ptr<ValueNode> _aNode, bool _bMayReplace)
- CFG_UNO_THROW1( configuration::backend::MalformedDataException )
+ SAL_THROW((com::sun::star::configuration::backend::MalformedDataException , com::sun::star::uno::RuntimeException))
{
OSL_PRECOND(_aNode.get(), "ERROR: Adding a NULL node");
OSL_PRECOND(!_bMayReplace || _aNode->getAttributes().isReplacedForUser(), "Wrong status for added property");
@@ -396,33 +394,33 @@ void DataBuilderContext::markCurrentMerged()
// -----------------------------------------------------------------------------
bool DataBuilderContext::isProperty(INode * pProp) const
- CFG_UNO_THROW_RTE( )
+ SAL_THROW((com::sun::star::uno::RuntimeException))
{
OSL_PRECOND(pProp, "ERROR: Unexpected NULL node");
if (pProp == NULL)
{
- OUString sMsg = makeMessageWithName("INTERNAL ERROR (DataBuilderContext): Trying to inspect NULL node",OUString() );
+ rtl::OUString sMsg = makeMessageWithName("INTERNAL ERROR (DataBuilderContext): Trying to inspect NULL node",rtl::OUString() );
throw uno::RuntimeException( sMsg, m_pContext );
}
if ( ISubtree * pTree = pProp->asISubtree() )
return isLocalizedValueSet( *pTree );
- OSL_ENSURE( pProp->ISA(ValueNode), "Unexpected node type");
+ OSL_ASSERT(dynamic_cast< ValueNode * >(pProp) != 0);
return true;
}
// -----------------------------------------------------------------------------
-INode * DataBuilderContext::findChild(OUString const & _aName)
- CFG_UNO_THROW1( configuration::backend::MalformedDataException )
+INode * DataBuilderContext::findChild(rtl::OUString const & _aName)
+ SAL_THROW((com::sun::star::configuration::backend::MalformedDataException , com::sun::star::uno::RuntimeException))
{
return getCurrentParent().getChild(_aName);
}
// -----------------------------------------------------------------------------
-INode * DataBuilderContext::findProperty(OUString const & _aName)
- CFG_UNO_THROW1( configuration::backend::MalformedDataException )
+INode * DataBuilderContext::findProperty(rtl::OUString const & _aName)
+ SAL_THROW((com::sun::star::configuration::backend::MalformedDataException , com::sun::star::uno::RuntimeException))
{
INode * pResult = findChild(_aName);
if (pResult && !isProperty(pResult))
@@ -433,8 +431,8 @@ INode * DataBuilderContext::findProperty(OUString const & _aName)
}
// -----------------------------------------------------------------------------
-ISubtree * DataBuilderContext::findNode(OUString const & _aName)
- CFG_UNO_THROW1( configuration::backend::MalformedDataException )
+ISubtree * DataBuilderContext::findNode(rtl::OUString const & _aName)
+ SAL_THROW((com::sun::star::configuration::backend::MalformedDataException , com::sun::star::uno::RuntimeException))
{
INode * pResult = findChild(_aName);
@@ -444,20 +442,20 @@ ISubtree * DataBuilderContext::findNode(OUString const & _aName)
if (!isNode(pResult))
raiseMalformedDataException("Component Builder Context: Found an existing property, where an inner node was expected");
- OSL_ASSERT(pResult->ISA(ISubtree));
+ OSL_ASSERT(dynamic_cast< ISubtree * >(pResult) != 0);
return pResult->asISubtree();
}
// -----------------------------------------------------------------------------
void DataBuilderContext::pushNode(ISubtree * pTree)
- CFG_UNO_THROW_RTE( )
+ SAL_THROW((com::sun::star::uno::RuntimeException))
{
OSL_PRECOND(hasActiveComponent(), "Component Builder Context: Entering a node without having an active component");
OSL_PRECOND(pTree, "ERROR: Pushing a NULL tree");
if (pTree == NULL)
{
- OUString sMsg = makeMessageWithName("INTERNAL ERROR (DataBuilderContext): Trying to push NULL tree",OUString() );
+ rtl::OUString sMsg = makeMessageWithName("INTERNAL ERROR (DataBuilderContext): Trying to push NULL tree",rtl::OUString() );
throw uno::RuntimeException( sMsg, m_pContext );
}
m_aParentStack.push(pTree);
@@ -465,7 +463,7 @@ void DataBuilderContext::pushNode(ISubtree * pTree)
// -----------------------------------------------------------------------------
void DataBuilderContext::popNode()
- CFG_UNO_THROW1( configuration::backend::MalformedDataException )
+ SAL_THROW((com::sun::star::configuration::backend::MalformedDataException , com::sun::star::uno::RuntimeException))
{
OSL_PRECOND(hasActiveComponent(), "Component Builder Context: Leaving a node without having an active component");
if (m_aParentStack.empty())
@@ -477,8 +475,8 @@ void DataBuilderContext::popNode()
}
// -----------------------------------------------------------------------------
-void DataBuilderContext::startActiveComponent(OUString const & _aComponent)
- CFG_UNO_THROW1( configuration::backend::MalformedDataException )
+void DataBuilderContext::startActiveComponent(rtl::OUString const & _aComponent)
+ SAL_THROW((com::sun::star::configuration::backend::MalformedDataException , com::sun::star::uno::RuntimeException))
{
OSL_PRECOND(!hasActiveComponent(), "Component Builder Context: Component is already active");
OSL_PRECOND(m_aParentStack.empty(), "Component Builder Context: Starting Component/Template while inside a node");
@@ -498,7 +496,7 @@ void DataBuilderContext::startActiveComponent(OUString const & _aComponent)
// -----------------------------------------------------------------------------
void DataBuilderContext::endActiveComponent()
- CFG_UNO_THROW1( configuration::backend::MalformedDataException )
+ SAL_THROW((com::sun::star::configuration::backend::MalformedDataException , com::sun::star::uno::RuntimeException))
{
OSL_PRECOND( hasActiveComponent(), "Component Builder Context: No Component active");
OSL_PRECOND(m_aParentStack.empty(), "Component Builder Context: Ending Component/Template while inside a node");
@@ -506,12 +504,12 @@ void DataBuilderContext::endActiveComponent()
if (!m_aParentStack.empty())
raiseMalformedDataException("Invalid Component Data: Ending component while node is still open");
- m_aActiveComponent = OUString();
+ m_aActiveComponent = rtl::OUString();
OSL_POSTCOND(!hasActiveComponent(), "Component Builder Context: Could not end Component/Template");
}
// -----------------------------------------------------------------------------
-TemplateResult DataBuilderContext::getTemplateData (TemplateRequest const & _aRequest )
+ResultHolder< TemplateInstance > DataBuilderContext::getTemplateData (TemplateRequest const & _aRequest )
{
return(m_aTemplateProvider->getTemplateData (_aRequest));
}
@@ -523,7 +521,7 @@ ComponentDataFactory::ComponentDataFactory()
}
// -----------------------------------------------------------------------------
-std::auto_ptr<ISubtree> ComponentDataFactory::createGroup( OUString const & _aName,
+std::auto_ptr<ISubtree> ComponentDataFactory::createGroup( rtl::OUString const & _aName,
bool _bExtensible,
node::Attributes const & _aAttributes) const
{
@@ -542,8 +540,8 @@ std::auto_ptr<ISubtree> ComponentDataFactory::createGroup( OUString const & _aNa
}
// -----------------------------------------------------------------------------
-std::auto_ptr<ISubtree> ComponentDataFactory::createSet(OUString const & _aName,
- TemplateIdentifier const & _aItemType,
+std::auto_ptr<ISubtree> ComponentDataFactory::createSet(rtl::OUString const & _aName,
+ backenduno::TemplateIdentifier const & _aItemType,
bool _bExtensible,
node::Attributes const & _aAttributes) const
{
@@ -558,7 +556,7 @@ std::auto_ptr<ISubtree> ComponentDataFactory::createSet(OUString const & _aName,
}
// -----------------------------------------------------------------------------
-std::auto_ptr<ISubtree> ComponentDataFactory::createLocalizedContainer( OUString const & _aName,
+std::auto_ptr<ISubtree> ComponentDataFactory::createLocalizedContainer( rtl::OUString const & _aName,
uno::Type const & _aValueType,
node::Attributes const & _aAttributes) const
{
@@ -581,8 +579,8 @@ namespace
}
// -----------------------------------------------------------------------------
-std::auto_ptr<ISubtree> ComponentDataFactory::createPlaceHolder(OUString const & _aName,
- TemplateIdentifier const & _aInstanceType) const
+std::auto_ptr<ISubtree> ComponentDataFactory::createPlaceHolder(rtl::OUString const & _aName,
+ backenduno::TemplateIdentifier const & _aInstanceType) const
{
return getNodeFactory().createSetNode( _aName,
INSTANCE_MARKER + _aInstanceType.Name,
@@ -597,11 +595,11 @@ bool ComponentDataFactory::isInstancePlaceHolder(ISubtree const & _aInstanceTree
}
// -----------------------------------------------------------------------------
-TemplateIdentifier ComponentDataFactory::getInstanceType(ISubtree const & _aInstanceTree)
+backenduno::TemplateIdentifier ComponentDataFactory::getInstanceType(ISubtree const & _aInstanceTree)
{
OSL_ENSURE( isInstancePlaceHolder(_aInstanceTree), "Instance placeholder tree expected" );
- TemplateIdentifier aResult;
+ backenduno::TemplateIdentifier aResult;
if (isInstancePlaceHolder(_aInstanceTree))
{
diff --git a/configmgr/source/backend/componentdatahelper.hxx b/configmgr/source/backend/componentdatahelper.hxx
index a3c1f71992..f482274fca 100644
--- a/configmgr/source/backend/componentdatahelper.hxx
+++ b/configmgr/source/backend/componentdatahelper.hxx
@@ -61,124 +61,119 @@ namespace configmgr
namespace uno = ::com::sun::star::uno;
namespace backenduno = ::com::sun::star::configuration::backend;
- using backenduno::TemplateIdentifier;
-
- using ::rtl::OUString;
-
// -----------------------------------------------------------------------------
class DataBuilderContext
{
Logger m_aLogger;
Stack< ISubtree * > m_aParentStack;
- OUString m_aActiveComponent;
+ rtl::OUString m_aActiveComponent;
uno::XInterface * m_pContext;
- OUString m_aExpectedComponentName;
+ rtl::OUString m_aExpectedComponentName;
ITemplateDataProvider * m_aTemplateProvider;
public:
- typedef uno::Reference< uno::XComponentContext > UnoContext;
- explicit DataBuilderContext(UnoContext const & xContext);
- DataBuilderContext(UnoContext const & xContext, uno::XInterface * _pContext , ITemplateDataProvider* aTemplateProvider = NULL);
- DataBuilderContext(UnoContext const & xContext, uno::XInterface * _pContext, const OUString& aExpectedComponentName,ITemplateDataProvider* aTemplateProvider = NULL );
+ explicit DataBuilderContext(uno::Reference< uno::XComponentContext > const & xContext);
+ DataBuilderContext(uno::Reference< uno::XComponentContext > const & xContext, uno::XInterface * _pContext , ITemplateDataProvider* aTemplateProvider = NULL);
+ DataBuilderContext(uno::Reference< uno::XComponentContext > const & xContext, uno::XInterface * _pContext, const rtl::OUString& aExpectedComponentName,ITemplateDataProvider* aTemplateProvider = NULL );
DataBuilderContext(DataBuilderContext const & aBaseContext, uno::XInterface * _pContext);
~DataBuilderContext();
bool isDone() const;
bool hasActiveComponent() const { return m_aActiveComponent.getLength() != 0; }
- OUString getActiveComponent() const { return m_aActiveComponent; }
+ rtl::OUString getActiveComponent() const { return m_aActiveComponent; }
ISubtree & getCurrentParent()
- CFG_UNO_THROW1( configuration::backend::MalformedDataException )
+ SAL_THROW((com::sun::star::configuration::backend::MalformedDataException , com::sun::star::uno::RuntimeException))
{ return implGetCurrentParent(); }
ISubtree const & getCurrentParent() const
- CFG_UNO_THROW1( configuration::backend::MalformedDataException )
+ SAL_THROW((com::sun::star::configuration::backend::MalformedDataException , com::sun::star::uno::RuntimeException))
{ return implGetCurrentParent(); }
node::Attributes getCurrentAttributes() const
- CFG_UNO_THROW1( configuration::backend::MalformedDataException )
+ SAL_THROW((com::sun::star::configuration::backend::MalformedDataException , com::sun::star::uno::RuntimeException))
{ return implGetCurrentParent().getAttributes(); }
ITemplateDataProvider * getTemplateProvider() const
{ return m_aTemplateProvider; }
- OUString getTemplateComponent(TemplateIdentifier const & aItemType ) const;
+ rtl::OUString getTemplateComponent(backenduno::TemplateIdentifier const & aItemType ) const;
- TemplateIdentifier completeComponent(TemplateIdentifier const & aItemType ) const;
+ backenduno::TemplateIdentifier completeComponent(backenduno::TemplateIdentifier const & aItemType ) const;
- TemplateIdentifier getCurrentItemType() const
- CFG_UNO_THROW1( configuration::backend::MalformedDataException );
- TemplateIdentifier getValidItemType(TemplateIdentifier const & aItemType) const
- CFG_UNO_THROW1( configuration::backend::MalformedDataException );
+ backenduno::TemplateIdentifier getCurrentItemType() const
+ SAL_THROW((com::sun::star::configuration::backend::MalformedDataException , com::sun::star::uno::RuntimeException));
+ backenduno::TemplateIdentifier getValidItemType(backenduno::TemplateIdentifier const & aItemType) const
+ SAL_THROW((com::sun::star::configuration::backend::MalformedDataException , com::sun::star::uno::RuntimeException));
- void startActiveComponent(OUString const & _aComponent)
- CFG_UNO_THROW1( configuration::backend::MalformedDataException );
+ void startActiveComponent(rtl::OUString const & _aComponent)
+ SAL_THROW((com::sun::star::configuration::backend::MalformedDataException , com::sun::star::uno::RuntimeException));
void endActiveComponent()
- CFG_UNO_THROW1( configuration::backend::MalformedDataException );
+ SAL_THROW((com::sun::star::configuration::backend::MalformedDataException , com::sun::star::uno::RuntimeException));
bool isProperty(INode * pProp) const
- CFG_UNO_THROW_RTE();
+ SAL_THROW((com::sun::star::uno::RuntimeException));
- bool isNode(INode * pNode) const CFG_UNO_THROW_RTE()
+ bool isNode(INode * pNode) const SAL_THROW((com::sun::star::uno::RuntimeException))
{ return !isProperty(pNode); }
void pushNode(ISubtree * pTree)
- CFG_UNO_THROW_RTE();
+ SAL_THROW((com::sun::star::uno::RuntimeException));
void popNode()
- CFG_UNO_THROW1( configuration::backend::MalformedDataException );
+ SAL_THROW((com::sun::star::configuration::backend::MalformedDataException , com::sun::star::uno::RuntimeException));
- INode * findProperty(OUString const & _aName)
- CFG_UNO_THROW1( configuration::backend::MalformedDataException );
- ISubtree * findNode(OUString const & _aName)
- CFG_UNO_THROW1( configuration::backend::MalformedDataException );
+ INode * findProperty(rtl::OUString const & _aName)
+ SAL_THROW((com::sun::star::configuration::backend::MalformedDataException , com::sun::star::uno::RuntimeException));
+ ISubtree * findNode(rtl::OUString const & _aName)
+ SAL_THROW((com::sun::star::configuration::backend::MalformedDataException , com::sun::star::uno::RuntimeException));
bool isWritable(INode const * pNode) const
- CFG_NOTHROW( );
+ SAL_THROW(());
bool isRemovable(ISubtree const * pItem) const
- CFG_NOTHROW( );
+ SAL_THROW(());
ISubtree * addNodeToCurrent(std::auto_ptr<ISubtree> _aNode)
- CFG_UNO_THROW1( configuration::backend::MalformedDataException );
+ SAL_THROW((com::sun::star::configuration::backend::MalformedDataException , com::sun::star::uno::RuntimeException));
ISubtree * addLocalizedToCurrent(std::auto_ptr<ISubtree> _aNode)
- CFG_UNO_THROW1( configuration::backend::MalformedDataException );
+ SAL_THROW((com::sun::star::configuration::backend::MalformedDataException , com::sun::star::uno::RuntimeException));
ValueNode * addPropertyToCurrent(std::auto_ptr<ValueNode> _aNode, bool _bMayReplace = false)
- CFG_UNO_THROW1( configuration::backend::MalformedDataException );
+ SAL_THROW((com::sun::star::configuration::backend::MalformedDataException , com::sun::star::uno::RuntimeException));
void markCurrentMerged();
// Logging support
Logger const & getLogger() const { return m_aLogger; }
- OUString getNodeParentagePath() const;
- OUString getNodePath(OUString const & aNodeName) const;
+ rtl::OUString getNodeParentagePath() const;
+ rtl::OUString getNodePath(rtl::OUString const & aNodeName) const;
// Exception support
void raiseMalformedDataException (sal_Char const * _pText) const
- CFG_UNO_THROW1( configuration::backend::MalformedDataException );
+ SAL_THROW((com::sun::star::configuration::backend::MalformedDataException , com::sun::star::uno::RuntimeException));
void raiseIllegalArgumentException (sal_Char const * _pText, sal_Int16 _nPos = 0) const
- CFG_UNO_THROW1( configuration::backend::MalformedDataException );
- void raiseElementExistException (sal_Char const * _pText, OUString const & _sElement) const
- CFG_UNO_THROW1( configuration::backend::MalformedDataException );
- void raiseNoSuchElementException (sal_Char const * _pText, OUString const & _sElement) const
- CFG_UNO_THROW1( configuration::backend::MalformedDataException );
- void raisePropertyExistException (sal_Char const * _pText, OUString const & _sElement) const
- CFG_UNO_THROW1( configuration::backend::MalformedDataException );
+ SAL_THROW((com::sun::star::configuration::backend::MalformedDataException , com::sun::star::uno::RuntimeException));
+ void raiseElementExistException (sal_Char const * _pText, rtl::OUString const & _sElement) const
+ SAL_THROW((com::sun::star::configuration::backend::MalformedDataException , com::sun::star::uno::RuntimeException));
+ void raiseNoSuchElementException (sal_Char const * _pText, rtl::OUString const & _sElement) const
+ SAL_THROW((com::sun::star::configuration::backend::MalformedDataException , com::sun::star::uno::RuntimeException));
+ void raisePropertyExistException (sal_Char const * _pText, rtl::OUString const & _sElement) const
+ SAL_THROW((com::sun::star::configuration::backend::MalformedDataException , com::sun::star::uno::RuntimeException));
void raiseIllegalTypeException (sal_Char const * _pText) const
- CFG_UNO_THROW1( configuration::backend::MalformedDataException );
- TemplateResult getTemplateData (TemplateRequest const & _aRequest );
+ SAL_THROW((com::sun::star::configuration::backend::MalformedDataException , com::sun::star::uno::RuntimeException));
+ ResultHolder< TemplateInstance > getTemplateData (TemplateRequest const & _aRequest );
private:
- INode * findChild(OUString const & _aName)
- CFG_UNO_THROW1( configuration::backend::MalformedDataException );
+ INode * findChild(rtl::OUString const & _aName)
+ SAL_THROW((com::sun::star::configuration::backend::MalformedDataException , com::sun::star::uno::RuntimeException));
- OUString makeMessageWithPath(sal_Char const * _pText) const
- CFG_UNO_THROW_RTE( );
+ rtl::OUString makeMessageWithPath(sal_Char const * _pText) const
+ SAL_THROW((com::sun::star::uno::RuntimeException));
- OUString makeMessageWithName(sal_Char const * _pText, OUString const & _aName) const
- CFG_UNO_THROW_RTE( );
+ rtl::OUString makeMessageWithName(sal_Char const * _pText, rtl::OUString const & _aName) const
+ SAL_THROW((com::sun::star::uno::RuntimeException));
ISubtree & implGetCurrentParent() const
- CFG_UNO_THROW1( configuration::backend::MalformedDataException );
+ SAL_THROW((com::sun::star::configuration::backend::MalformedDataException , com::sun::star::uno::RuntimeException));
};
// -----------------------------------------------------------------------------
@@ -196,24 +191,24 @@ namespace configmgr
public:
OTreeNodeFactory& getNodeFactory() const { return m_rNodeFactory; }
- std::auto_ptr<ISubtree> createGroup(OUString const & _aName,
+ std::auto_ptr<ISubtree> createGroup(rtl::OUString const & _aName,
bool _bExtensible,
node::Attributes const & _aAttributes) const;
- std::auto_ptr<ISubtree> createSet( OUString const & _aName,
- TemplateIdentifier const & aItemType,
+ std::auto_ptr<ISubtree> createSet( rtl::OUString const & _aName,
+ backenduno::TemplateIdentifier const & aItemType,
bool _bExtensible,
node::Attributes const & _aAttributes) const;
- std::auto_ptr<ISubtree> createLocalizedContainer(OUString const & _aName,
+ std::auto_ptr<ISubtree> createLocalizedContainer(rtl::OUString const & _aName,
uno::Type const & _aValueType,
node::Attributes const & _aAttributes) const;
- std::auto_ptr<ISubtree> createPlaceHolder(OUString const & _aName,
- TemplateIdentifier const & _aInstanceType) const;
+ std::auto_ptr<ISubtree> createPlaceHolder(rtl::OUString const & _aName,
+ backenduno::TemplateIdentifier const & _aInstanceType) const;
static bool isInstancePlaceHolder(ISubtree const & _aInstanceTree);
- static TemplateIdentifier getInstanceType(ISubtree const & _aInstanceTree);
+ static backenduno::TemplateIdentifier getInstanceType(ISubtree const & _aInstanceTree);
};
// -----------------------------------------------------------------------------
} // namespace backend
diff --git a/configmgr/source/backend/emptylayer.cxx b/configmgr/source/backend/emptylayer.cxx
index c1a52f770d..bd174556ee 100644
--- a/configmgr/source/backend/emptylayer.cxx
+++ b/configmgr/source/backend/emptylayer.cxx
@@ -90,7 +90,7 @@ namespace configmgr
aHandler->endLayer();
}
else
- throw lang::NullPointerException(OUString::createFromAscii("EmptyLayer: Null Handler"),*this);
+ throw lang::NullPointerException(rtl::OUString::createFromAscii("EmptyLayer: Null Handler"),*this);
}
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
@@ -128,21 +128,21 @@ namespace configmgr
}
// -----------------------------------------------------------------------------
- void SAL_CALL RequireEmptyLayer::overrideNode( const OUString& /*aName*/, sal_Int16 /*aAttributes*/, sal_Bool /*bClear*/ )
+ void SAL_CALL RequireEmptyLayer::overrideNode( const rtl::OUString& /*aName*/, sal_Int16 /*aAttributes*/, sal_Bool /*bClear*/ )
throw (backenduno::MalformedDataException, uno::RuntimeException)
{
failNotEmpty();
}
// -----------------------------------------------------------------------------
- void SAL_CALL RequireEmptyLayer::addOrReplaceNode( const OUString& /*aName*/, sal_Int16 /*aAttributes*/ )
+ void SAL_CALL RequireEmptyLayer::addOrReplaceNode( const rtl::OUString& /*aName*/, sal_Int16 /*aAttributes*/ )
throw (backenduno::MalformedDataException, uno::RuntimeException)
{
failNotEmpty();
}
// -----------------------------------------------------------------------------
- void SAL_CALL RequireEmptyLayer::addOrReplaceNodeFromTemplate( const OUString& /*aName*/, const backenduno::TemplateIdentifier& /*aTemplate*/, sal_Int16 /*aAttributes*/)
+ void SAL_CALL RequireEmptyLayer::addOrReplaceNodeFromTemplate( const rtl::OUString& /*aName*/, const backenduno::TemplateIdentifier& /*aTemplate*/, sal_Int16 /*aAttributes*/)
throw (backenduno::MalformedDataException, uno::RuntimeException)
{
failNotEmpty();
@@ -156,28 +156,28 @@ namespace configmgr
}
// -----------------------------------------------------------------------------
- void SAL_CALL RequireEmptyLayer::dropNode( const OUString& /*aName*/ )
+ void SAL_CALL RequireEmptyLayer::dropNode( const rtl::OUString& /*aName*/ )
throw (backenduno::MalformedDataException, uno::RuntimeException)
{
failNotEmpty();
}
// -----------------------------------------------------------------------------
- void SAL_CALL RequireEmptyLayer::addProperty( const OUString& /*aName*/, sal_Int16 /*aAttributes*/, const uno::Type& /*aType*/ )
+ void SAL_CALL RequireEmptyLayer::addProperty( const rtl::OUString& /*aName*/, sal_Int16 /*aAttributes*/, const uno::Type& /*aType*/ )
throw (backenduno::MalformedDataException, uno::RuntimeException)
{
failNotEmpty();
}
// -----------------------------------------------------------------------------
- void SAL_CALL RequireEmptyLayer::addPropertyWithValue( const OUString& /*aName*/, sal_Int16 /*aAttributes*/, const uno::Any& /*aValue*/ )
+ void SAL_CALL RequireEmptyLayer::addPropertyWithValue( const rtl::OUString& /*aName*/, sal_Int16 /*aAttributes*/, const uno::Any& /*aValue*/ )
throw (backenduno::MalformedDataException, uno::RuntimeException)
{
failNotEmpty();
}
// -----------------------------------------------------------------------------
- void SAL_CALL RequireEmptyLayer::overrideProperty( const OUString& /*aName*/, sal_Int16 /*aAttributes*/, const uno::Type& /*aType*/, sal_Bool /*bClear*/ )
+ void SAL_CALL RequireEmptyLayer::overrideProperty( const rtl::OUString& /*aName*/, sal_Int16 /*aAttributes*/, const uno::Type& /*aType*/, sal_Bool /*bClear*/ )
throw (backenduno::MalformedDataException, uno::RuntimeException)
{
failNotEmpty();
@@ -198,7 +198,7 @@ namespace configmgr
}
// -----------------------------------------------------------------------------
- void SAL_CALL RequireEmptyLayer::setPropertyValueForLocale( const uno::Any& /*aValue*/, const OUString& /*aLocale*/ )
+ void SAL_CALL RequireEmptyLayer::setPropertyValueForLocale( const uno::Any& /*aValue*/, const rtl::OUString& /*aLocale*/ )
throw (backenduno::MalformedDataException, uno::RuntimeException)
{
failNotEmpty();
@@ -212,7 +212,7 @@ namespace configmgr
m_bStarted = false;
OSL_ASSERT(pMsg);
- OUString sMsg = OUString::createFromAscii(pMsg);
+ rtl::OUString sMsg = rtl::OUString::createFromAscii(pMsg);
throw backenduno::MalformedDataException( sMsg, *this, uno::Any() );
}
diff --git a/configmgr/source/backend/emptylayerimpl.hxx b/configmgr/source/backend/emptylayerimpl.hxx
index bed98152f7..3c57face40 100644
--- a/configmgr/source/backend/emptylayerimpl.hxx
+++ b/configmgr/source/backend/emptylayerimpl.hxx
@@ -42,7 +42,6 @@ namespace configmgr
namespace backend
{
// -----------------------------------------------------------------------------
- using rtl::OUString;
namespace uno = ::com::sun::star::uno;
namespace lang = ::com::sun::star::lang;
namespace backenduno = ::com::sun::star::configuration::backend;
@@ -80,15 +79,15 @@ namespace configmgr
throw (backenduno::MalformedDataException, uno::RuntimeException);
virtual void SAL_CALL
- overrideNode( const OUString& aName, sal_Int16 aAttributes, sal_Bool bClear )
+ overrideNode( const rtl::OUString& aName, sal_Int16 aAttributes, sal_Bool bClear )
throw (backenduno::MalformedDataException, uno::RuntimeException);
virtual void SAL_CALL
- addOrReplaceNode( const OUString& aName, sal_Int16 aAttributes )
+ addOrReplaceNode( const rtl::OUString& aName, sal_Int16 aAttributes )
throw (backenduno::MalformedDataException, uno::RuntimeException);
virtual void SAL_CALL
- addOrReplaceNodeFromTemplate( const OUString& aName, const backenduno::TemplateIdentifier& aTemplate, sal_Int16 aAttributes )
+ addOrReplaceNodeFromTemplate( const rtl::OUString& aName, const backenduno::TemplateIdentifier& aTemplate, sal_Int16 aAttributes )
throw (backenduno::MalformedDataException, uno::RuntimeException);
virtual void SAL_CALL
@@ -96,19 +95,19 @@ namespace configmgr
throw (backenduno::MalformedDataException, uno::RuntimeException);
virtual void SAL_CALL
- dropNode( const OUString& aName )
+ dropNode( const rtl::OUString& aName )
throw (backenduno::MalformedDataException, uno::RuntimeException);
virtual void SAL_CALL
- overrideProperty( const OUString& aName, sal_Int16 aAttributes, const uno::Type& aType, sal_Bool bClear )
+ overrideProperty( const rtl::OUString& aName, sal_Int16 aAttributes, const uno::Type& aType, sal_Bool bClear )
throw (backenduno::MalformedDataException, uno::RuntimeException);
virtual void SAL_CALL
- addProperty( const OUString& aName, sal_Int16 aAttributes, const uno::Type& aType )
+ addProperty( const rtl::OUString& aName, sal_Int16 aAttributes, const uno::Type& aType )
throw (backenduno::MalformedDataException, uno::RuntimeException);
virtual void SAL_CALL
- addPropertyWithValue( const OUString& aName, sal_Int16 aAttributes, const uno::Any& aValue )
+ addPropertyWithValue( const rtl::OUString& aName, sal_Int16 aAttributes, const uno::Any& aValue )
throw (backenduno::MalformedDataException, uno::RuntimeException);
virtual void SAL_CALL
@@ -120,7 +119,7 @@ namespace configmgr
throw (backenduno::MalformedDataException, uno::RuntimeException);
virtual void SAL_CALL
- setPropertyValueForLocale( const uno::Any& aValue, const OUString& aLocale )
+ setPropertyValueForLocale( const uno::Any& aValue, const rtl::OUString& aLocale )
throw (backenduno::MalformedDataException, uno::RuntimeException);
private:
diff --git a/configmgr/source/backend/importmergehandler.cxx b/configmgr/source/backend/importmergehandler.cxx
index 1a13e2a2e2..df863cbc88 100644
--- a/configmgr/source/backend/importmergehandler.cxx
+++ b/configmgr/source/backend/importmergehandler.cxx
@@ -50,7 +50,7 @@ namespace configmgr
// -----------------------------------------------------------------------------
ImportMergeHandler::ImportMergeHandler(
- Backend const & xTargetBackend, Mode mode, OUString const & aEntity, sal_Bool const & bNotify )
+ uno::Reference< backenduno::XBackend > const & xTargetBackend, Mode mode, rtl::OUString const & aEntity, sal_Bool const & bNotify )
: BasicImportHandler(xTargetBackend,aEntity, bNotify)
, m_xOutputHandler()
, m_mode(mode)
@@ -77,7 +77,7 @@ inline void ImportMergeHandler::checkStarted()
}
// -----------------------------------------------------------------------------
-inline ImportMergeHandler::OutputHandler ImportMergeHandler::getOutputHandler()
+inline uno::Reference< backenduno::XUpdateHandler > ImportMergeHandler::getOutputHandler()
{
checkStarted();
return m_xOutputHandler;
@@ -93,7 +93,7 @@ bool setHandlerProperty(uno::Reference< uno::XInterface > const & xHandler, char
try
{
uno::Sequence< uno::Any > aArgs(1);
- aArgs[0] <<= beans::NamedValue( OUString::createFromAscii(property), uno::makeAny(value) );
+ aArgs[0] <<= beans::NamedValue( rtl::OUString::createFromAscii(property), uno::makeAny(value) );
xInitHandler->initialize(aArgs);
return true;
}
@@ -114,14 +114,12 @@ bool setHandlerProperty(uno::Reference< uno::XInterface > const & xHandler, char
return false;
}
// -----------------------------------------------------------------------------
-ImportMergeHandler::OutputHandler ImportMergeHandler::createOutputHandler()
+uno::Reference< backenduno::XUpdateHandler > ImportMergeHandler::createOutputHandler()
{
- using rtl::OUStringBuffer;
-
OSL_PRECOND( hasComponent(), "Trying to create output-handler for Import Merger without setting a component first") ;
- OUString const aComponentName = this->getComponent();
+ rtl::OUString const aComponentName = this->getComponent();
- OutputHandler xOutputHandler;
+ uno::Reference< backenduno::XUpdateHandler > xOutputHandler;
try
{
xOutputHandler = hasEntity() ? getBackend()->getUpdateHandler(aComponentName,getEntity())
@@ -129,7 +127,7 @@ ImportMergeHandler::OutputHandler ImportMergeHandler::createOutputHandler()
}
catch (lang::NoSupportException & e)
{
- OUStringBuffer sMessage;
+ rtl::OUStringBuffer sMessage;
sMessage.appendAscii("configmgr::backend::ImportHandler: ");
sMessage.appendAscii("Could not get output handler for component ").append(aComponentName);
sMessage.appendAscii(": Backend does not support updates - ").append( e.Message );
@@ -138,7 +136,7 @@ ImportMergeHandler::OutputHandler ImportMergeHandler::createOutputHandler()
}
catch (lang::IllegalArgumentException & e)
{
- OUStringBuffer sMessage;
+ rtl::OUStringBuffer sMessage;
sMessage.appendAscii("configmgr::backend::ImportHandler: ");
sMessage.appendAscii("Could not get output handler for component ").append(aComponentName);
sMessage.appendAscii(" due to a backend exception: ").append( e.Message );
@@ -148,7 +146,7 @@ ImportMergeHandler::OutputHandler ImportMergeHandler::createOutputHandler()
if (!xOutputHandler.is())
{
- OUStringBuffer sMessage;
+ rtl::OUStringBuffer sMessage;
sMessage.appendAscii("configmgr::backend::ImportHandler: ");
sMessage.appendAscii("Cannot import. ERROR - The backend returns a NULL handler for component ")
.append(aComponentName).append( sal_Unicode('.') );
@@ -172,7 +170,7 @@ ImportMergeHandler::OutputHandler ImportMergeHandler::createOutputHandler()
// XLayerHandler
void SAL_CALL ImportMergeHandler::startLayer( )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
{
m_xOutputHandler.clear();
@@ -181,7 +179,7 @@ void SAL_CALL ImportMergeHandler::startLayer( )
// -----------------------------------------------------------------------------
void SAL_CALL ImportMergeHandler::endLayer( )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
{
if (isStarted())
try
@@ -190,7 +188,7 @@ void SAL_CALL ImportMergeHandler::endLayer( )
}
catch (lang::IllegalAccessException & iae)
{
- OUString const sMsg(RTL_CONSTASCII_USTRINGPARAM("ImportHandler - no write access to layer: "));
+ rtl::OUString const sMsg(RTL_CONSTASCII_USTRINGPARAM("ImportHandler - no write access to layer: "));
throw lang::WrappedTargetException(sMsg.concat(iae.Message),*this,uno::makeAny(iae));
}
@@ -199,8 +197,8 @@ void SAL_CALL ImportMergeHandler::endLayer( )
}
// -----------------------------------------------------------------------------
-void SAL_CALL ImportMergeHandler::overrideNode( const OUString& aName, sal_Int16 aAttributes, sal_Bool bClear )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
+void SAL_CALL ImportMergeHandler::overrideNode( const rtl::OUString& aName, sal_Int16 aAttributes, sal_Bool bClear )
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
{
if (!isStarted() && startComponent(aName))
try
@@ -209,7 +207,7 @@ void SAL_CALL ImportMergeHandler::overrideNode( const OUString& aName, sal_Int16
}
catch (lang::IllegalAccessException & iae)
{
- OUString const sMsg(RTL_CONSTASCII_USTRINGPARAM("ImportHandler - no write access to layer: "));
+ rtl::OUString const sMsg(RTL_CONSTASCII_USTRINGPARAM("ImportHandler - no write access to layer: "));
throw lang::WrappedTargetException(sMsg.concat(iae.Message),*this,uno::makeAny(iae));
}
@@ -220,36 +218,36 @@ void SAL_CALL ImportMergeHandler::overrideNode( const OUString& aName, sal_Int16
}
// -----------------------------------------------------------------------------
-void SAL_CALL ImportMergeHandler::addOrReplaceNode( const OUString& aName, sal_Int16 aAttributes )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
+void SAL_CALL ImportMergeHandler::addOrReplaceNode( const rtl::OUString& aName, sal_Int16 aAttributes )
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
{
getOutputHandler()->addOrReplaceNode(aName,aAttributes);
}
// -----------------------------------------------------------------------------
-void SAL_CALL ImportMergeHandler::addOrReplaceNodeFromTemplate( const OUString& aName, const TemplateIdentifier& aTemplate, sal_Int16 aAttributes )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
+void SAL_CALL ImportMergeHandler::addOrReplaceNodeFromTemplate( const rtl::OUString& aName, const backenduno::TemplateIdentifier& aTemplate, sal_Int16 aAttributes )
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
{
getOutputHandler()->addOrReplaceNodeFromTemplate(aName,aAttributes,aTemplate);
}
// -----------------------------------------------------------------------------
void SAL_CALL ImportMergeHandler::endNode( )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
{
getOutputHandler()->endNode();
}
// -----------------------------------------------------------------------------
-void SAL_CALL ImportMergeHandler::dropNode( const OUString& aName )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
+void SAL_CALL ImportMergeHandler::dropNode( const rtl::OUString& aName )
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
{
getOutputHandler()->removeNode(aName);
}
// -----------------------------------------------------------------------------
-void SAL_CALL ImportMergeHandler::overrideProperty( const OUString& aName, sal_Int16 aAttributes, const uno::Type& aType, sal_Bool bClear )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
+void SAL_CALL ImportMergeHandler::overrideProperty( const rtl::OUString& aName, sal_Int16 aAttributes, const uno::Type& aType, sal_Bool bClear )
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
{
(void) bClear; // avoid warning about unused parameter
OSL_ENSURE(!bClear,"'clear' operation not supported on import");
@@ -258,35 +256,35 @@ void SAL_CALL ImportMergeHandler::overrideProperty( const OUString& aName, sal_I
// -----------------------------------------------------------------------------
void SAL_CALL ImportMergeHandler::endProperty( )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
{
getOutputHandler()->endProperty();
}
// -----------------------------------------------------------------------------
void SAL_CALL ImportMergeHandler::setPropertyValue( const uno::Any& aValue )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
{
getOutputHandler()->setPropertyValue(aValue);
}
// -----------------------------------------------------------------------------
-void SAL_CALL ImportMergeHandler::setPropertyValueForLocale( const uno::Any& aValue, const OUString & aLocale )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
+void SAL_CALL ImportMergeHandler::setPropertyValueForLocale( const uno::Any& aValue, const rtl::OUString & aLocale )
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
{
getOutputHandler()->setPropertyValueForLocale(aValue,aLocale);
}
// -----------------------------------------------------------------------------
-void SAL_CALL ImportMergeHandler::addProperty( const OUString& aName, sal_Int16 aAttributes, const uno::Type& aType )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
+void SAL_CALL ImportMergeHandler::addProperty( const rtl::OUString& aName, sal_Int16 aAttributes, const uno::Type& aType )
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
{
getOutputHandler()->addOrReplaceProperty(aName, aAttributes, aType);
}
// -----------------------------------------------------------------------------
-void SAL_CALL ImportMergeHandler::addPropertyWithValue( const OUString& aName, sal_Int16 aAttributes, const uno::Any& aValue )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
+void SAL_CALL ImportMergeHandler::addPropertyWithValue( const rtl::OUString& aName, sal_Int16 aAttributes, const uno::Any& aValue )
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
{
getOutputHandler()->addOrReplacePropertyWithValue(aName, aAttributes, aValue);
}
diff --git a/configmgr/source/backend/importmergehandler.hxx b/configmgr/source/backend/importmergehandler.hxx
index 44a3c81dbf..8e0983856c 100644
--- a/configmgr/source/backend/importmergehandler.hxx
+++ b/configmgr/source/backend/importmergehandler.hxx
@@ -41,12 +41,9 @@ namespace configmgr
namespace backend
{
// -----------------------------------------------------------------------------
- using rtl::OUString;
namespace uno = ::com::sun::star::uno;
namespace lang = ::com::sun::star::lang;
namespace backenduno = ::com::sun::star::configuration::backend;
- using backenduno::MalformedDataException;
- using backenduno::TemplateIdentifier;
// -----------------------------------------------------------------------------
class ImportMergeHandler : public BasicImportHandler
@@ -60,74 +57,72 @@ namespace configmgr
};
explicit
- ImportMergeHandler(Backend const & xTargetBackend, Mode mode,
- OUString const & aEntity = OUString(), sal_Bool const & bNotify = sal_False);
+ ImportMergeHandler(uno::Reference< backenduno::XBackend > const & xTargetBackend, Mode mode,
+ rtl::OUString const & aEntity = rtl::OUString(), sal_Bool const & bNotify = sal_False);
// XLayerHandler
protected:
virtual void SAL_CALL
startLayer( )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
virtual void SAL_CALL
endLayer( )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
virtual void SAL_CALL
- overrideNode( const OUString& aName, sal_Int16 aAttributes, sal_Bool bClear )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
+ overrideNode( const rtl::OUString& aName, sal_Int16 aAttributes, sal_Bool bClear )
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
virtual void SAL_CALL
- addOrReplaceNode( const OUString& aName, sal_Int16 aAttributes )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
+ addOrReplaceNode( const rtl::OUString& aName, sal_Int16 aAttributes )
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
virtual void SAL_CALL
- addOrReplaceNodeFromTemplate( const OUString& aName, const TemplateIdentifier& aTemplate, sal_Int16 aAttributes )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
+ addOrReplaceNodeFromTemplate( const rtl::OUString& aName, const backenduno::TemplateIdentifier& aTemplate, sal_Int16 aAttributes )
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
virtual void SAL_CALL
endNode( )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
virtual void SAL_CALL
- dropNode( const OUString& aName )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
+ dropNode( const rtl::OUString& aName )
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
virtual void SAL_CALL
- overrideProperty( const OUString& aName, sal_Int16 aAttributes, const uno::Type& aType, sal_Bool bClear )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
+ overrideProperty( const rtl::OUString& aName, sal_Int16 aAttributes, const uno::Type& aType, sal_Bool bClear )
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
virtual void SAL_CALL
endProperty( )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
virtual void SAL_CALL
setPropertyValue( const uno::Any& aValue )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
virtual void SAL_CALL
- setPropertyValueForLocale( const uno::Any& aValue, const OUString & aLocale )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
+ setPropertyValueForLocale( const uno::Any& aValue, const rtl::OUString & aLocale )
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
virtual void SAL_CALL
- addProperty( const OUString& aName, sal_Int16 aAttributes, const uno::Type& aType )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
+ addProperty( const rtl::OUString& aName, sal_Int16 aAttributes, const uno::Type& aType )
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
virtual void SAL_CALL
- addPropertyWithValue( const OUString& aName, sal_Int16 aAttributes, const uno::Any& aValue )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
+ addPropertyWithValue( const rtl::OUString& aName, sal_Int16 aAttributes, const uno::Any& aValue )
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
private:
- typedef uno::Reference< backenduno::XUpdateHandler > OutputHandler;
-
bool isStarted() const;
void checkStarted();
void failNotStarted();
- OutputHandler getOutputHandler();
+ uno::Reference< backenduno::XUpdateHandler > getOutputHandler();
- OutputHandler createOutputHandler();
+ uno::Reference< backenduno::XUpdateHandler > createOutputHandler();
private:
- OutputHandler m_xOutputHandler;
+ uno::Reference< backenduno::XUpdateHandler > m_xOutputHandler;
Mode m_mode;
};
// -----------------------------------------------------------------------------
diff --git a/configmgr/source/backend/importsvc.cxx b/configmgr/source/backend/importsvc.cxx
index 8a3779ee8c..0e20097e1e 100644
--- a/configmgr/source/backend/importsvc.cxx
+++ b/configmgr/source/backend/importsvc.cxx
@@ -54,7 +54,7 @@ namespace configmgr
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
-AsciiServiceName const aMergeImporterServices[] =
+sal_Char const * const aMergeImporterServices[] =
{
"com.sun.star.configuration.backend.MergeImporter",
0,
@@ -72,35 +72,35 @@ const ServiceRegistrationInfo* getMergeImportServiceInfo()
{ return getRegistrationInfo(& aMergeImporterSI); }
// -----------------------------------------------------------------------------
-MergeImportService::MergeImportService(CreationArg _xContext)
+MergeImportService::MergeImportService(uno::Reference< uno::XComponentContext > const & _xContext)
: ImportService(_xContext, &aMergeImporterSI)
{
}
// -----------------------------------------------------------------------------
uno::Reference< uno::XInterface > SAL_CALL instantiateMergeImporter
-( CreationContext const& xContext )
+( uno::Reference< uno::XComponentContext > const& xContext )
{
return * new MergeImportService( xContext );
}
// -----------------------------------------------------------------------------
-MergeImportService::InputHandler MergeImportService::createImportHandler(Backend const & xBackend, OUString const & aEntity)
+uno::Reference< backenduno::XLayerHandler > MergeImportService::createImportHandler(uno::Reference< backenduno::XBackend > const & xBackend, rtl::OUString const & aEntity)
{
if (!xBackend.is())
{
- OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("configmgr::backend::ImportService: Trying to import without a backend. No default backend could be created") );
+ rtl::OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("configmgr::backend::ImportService: Trying to import without a backend. No default backend could be created") );
throw lang::NullPointerException(sMessage,*this);
}
- InputHandler aHandler( new ImportMergeHandler(xBackend, ImportMergeHandler::merge, aEntity, m_bSendNotification) );
+ uno::Reference< backenduno::XLayerHandler > aHandler( new ImportMergeHandler(xBackend, ImportMergeHandler::merge, aEntity, m_bSendNotification) );
return aHandler;
}
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
-AsciiServiceName const aCopyImporterServices[] =
+sal_Char const * const aCopyImporterServices[] =
{
"com.sun.star.configuration.backend.CopyImporter",
0,
@@ -118,35 +118,35 @@ const ServiceRegistrationInfo* getCopyImportServiceInfo()
{ return getRegistrationInfo(& aCopyImporterSI); }
// -----------------------------------------------------------------------------
-CopyImportService::CopyImportService(CreationArg _xContext)
+CopyImportService::CopyImportService(uno::Reference< uno::XComponentContext > const & _xContext)
: ImportService(_xContext, &aCopyImporterSI)
{
}
// -----------------------------------------------------------------------------
uno::Reference< uno::XInterface > SAL_CALL instantiateCopyImporter
-( CreationContext const& xContext )
+( uno::Reference< uno::XComponentContext > const& xContext )
{
return * new CopyImportService( xContext );
}
// -----------------------------------------------------------------------------
-CopyImportService::InputHandler CopyImportService::createImportHandler(Backend const & xBackend, OUString const & aEntity)
+uno::Reference< backenduno::XLayerHandler > CopyImportService::createImportHandler(uno::Reference< backenduno::XBackend > const & xBackend, rtl::OUString const & aEntity)
{
if (!xBackend.is())
{
- OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("configmgr::backend::ImportService: Trying to import without a backend. No default backend could be created") );
+ rtl::OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("configmgr::backend::ImportService: Trying to import without a backend. No default backend could be created") );
throw lang::NullPointerException(sMessage,*this);
}
ImportMergeHandler::Mode aMode = m_bOverwrite ? ImportMergeHandler::copy : ImportMergeHandler::no_overwrite;
- InputHandler aHandler( new ImportMergeHandler(xBackend,aMode,aEntity) );
+ uno::Reference< backenduno::XLayerHandler > aHandler( new ImportMergeHandler(xBackend,aMode,aEntity) );
return aHandler;
}
// -----------------------------------------------------------------------------
-sal_Bool CopyImportService::setImplementationProperty(OUString const & aName, uno::Any const & aValue)
+sal_Bool CopyImportService::setImplementationProperty(rtl::OUString const & aName, uno::Any const & aValue)
{
if (aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("Overwrite")))
{
@@ -159,7 +159,7 @@ sal_Bool CopyImportService::setImplementationProperty(OUString const & aName, un
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
-ImportService::ImportService(CreationArg _xContext, ServiceInfoHelper const & aSvcInfo )
+ImportService::ImportService(uno::Reference< uno::XComponentContext > const & _xContext, ServiceInfoHelper const & aSvcInfo )
: m_bSendNotification(false)
, m_aMutex()
, m_xContext(_xContext)
@@ -168,7 +168,7 @@ ImportService::ImportService(CreationArg _xContext, ServiceInfoHelper const & aS
{
if (!m_xContext.is())
{
- OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Configuration Importer: Unexpected NULL context"));
+ rtl::OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Configuration Importer: Unexpected NULL context"));
throw lang::NullPointerException(sMessage,NULL);
}
}
@@ -178,13 +178,13 @@ ImportService::~ImportService()
{}
// -----------------------------------------------------------------------------
-ImportService::Backend ImportService::createDefaultBackend() const
+uno::Reference< backenduno::XBackend > ImportService::createDefaultBackend() const
{
return BackendFactory::instance( m_xContext ).getUnoBackend();
}
// -----------------------------------------------------------------------------
-sal_Bool ImportService::setImplementationProperty(OUString const & aName, uno::Any const & aValue)
+sal_Bool ImportService::setImplementationProperty(rtl::OUString const & aName, uno::Any const & aValue)
{
if (aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("Notify")))
{
@@ -205,7 +205,7 @@ void SAL_CALL
if (sal_Int32(nCount) != aArguments.getLength())
{
- OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Too many arguments to initialize a Configuration Importer"));
+ rtl::OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Too many arguments to initialize a Configuration Importer"));
throw lang::IllegalArgumentException(sMessage,*this,0);
}
@@ -219,7 +219,7 @@ void SAL_CALL
continue;
}
- OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Cannot use argument to initialize a Configuration Importer"
+ rtl::OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Cannot use argument to initialize a Configuration Importer"
"- NamedValue expected"));
throw lang::IllegalArgumentException(sMessage,*this,i+1);
}
@@ -257,7 +257,7 @@ void SAL_CALL
{
if (!aBackend.is())
{
- OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("configmgr::backend::ImportService: Trying to set a NULL backend") );
+ rtl::OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("configmgr::backend::ImportService: Trying to set a NULL backend") );
throw lang::NullPointerException(sMessage,*this);
}
@@ -268,42 +268,42 @@ void SAL_CALL
void SAL_CALL
ImportService::importLayer( const uno::Reference< backenduno::XLayer >& aLayer )
- throw ( MalformedDataException,
+ throw ( backenduno::MalformedDataException,
lang::WrappedTargetException, lang::IllegalArgumentException,
lang::NullPointerException, uno::RuntimeException)
{
if (!aLayer.is())
{
- OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("configmgr::backend::ImportService: Trying to import a NULL layer") );
+ rtl::OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("configmgr::backend::ImportService: Trying to import a NULL layer") );
throw lang::NullPointerException(sMessage,*this);
}
- InputHandler aInputHandler = createImportHandler( getTargetBackend() );
+ uno::Reference< backenduno::XLayerHandler > aInputHandler = createImportHandler( getTargetBackend() );
aLayer->readData( aInputHandler );
}
// -----------------------------------------------------------------------------
void SAL_CALL
- ImportService::importLayerForEntity( const uno::Reference< backenduno::XLayer >& aLayer, const OUString& aEntity )
- throw ( MalformedDataException,
+ ImportService::importLayerForEntity( const uno::Reference< backenduno::XLayer >& aLayer, const rtl::OUString& aEntity )
+ throw ( backenduno::MalformedDataException,
lang::WrappedTargetException, lang::IllegalArgumentException,
lang::NullPointerException, uno::RuntimeException)
{
if (!aLayer.is())
{
- OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("configmgr::backend::ImportService: Trying to import a NULL layer") );
+ rtl::OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("configmgr::backend::ImportService: Trying to import a NULL layer") );
throw lang::NullPointerException(sMessage,*this);
}
- InputHandler aInputHandler = createImportHandler( getTargetBackend(), aEntity );
+ uno::Reference< backenduno::XLayerHandler > aInputHandler = createImportHandler( getTargetBackend(), aEntity );
aLayer->readData( aInputHandler );
}
// -----------------------------------------------------------------------------
// XServiceInfo
-OUString SAL_CALL
+rtl::OUString SAL_CALL
ImportService::getImplementationName( )
throw (uno::RuntimeException)
{
@@ -313,7 +313,7 @@ OUString SAL_CALL
sal_Bool SAL_CALL
- ImportService::supportsService( const OUString& ServiceName )
+ ImportService::supportsService( const rtl::OUString& ServiceName )
throw (uno::RuntimeException)
{
return getServiceInfo().supportsService( ServiceName );
diff --git a/configmgr/source/backend/importsvc.hxx b/configmgr/source/backend/importsvc.hxx
index d76a686b87..a539882097 100644
--- a/configmgr/source/backend/importsvc.hxx
+++ b/configmgr/source/backend/importsvc.hxx
@@ -48,7 +48,6 @@ namespace configmgr
namespace backend
{
// -----------------------------------------------------------------------------
- using rtl::OUString;
namespace uno = ::com::sun::star::uno;
namespace lang = ::com::sun::star::lang;
namespace backenduno = ::com::sun::star::configuration::backend;
@@ -61,10 +60,8 @@ namespace configmgr
>
{
public:
- typedef uno::Reference< uno::XComponentContext > const & CreationArg;
-
explicit
- ImportService(CreationArg _xContext, ServiceInfoHelper const & aSvcInfo);
+ ImportService(uno::Reference< uno::XComponentContext > const & _xContext, ServiceInfoHelper const & aSvcInfo);
~ImportService();
// XInitialization
@@ -73,15 +70,15 @@ namespace configmgr
throw (uno::Exception, uno::RuntimeException);
// XServiceInfo
- virtual OUString SAL_CALL
+ virtual rtl::OUString SAL_CALL
getImplementationName( )
throw (uno::RuntimeException);
virtual sal_Bool SAL_CALL
- supportsService( const OUString& ServiceName )
+ supportsService( const rtl::OUString& ServiceName )
throw (uno::RuntimeException);
- virtual uno::Sequence< OUString > SAL_CALL
+ virtual uno::Sequence< rtl::OUString > SAL_CALL
getSupportedServiceNames( )
throw (uno::RuntimeException);
@@ -101,31 +98,26 @@ namespace configmgr
lang::NullPointerException, uno::RuntimeException);
virtual void SAL_CALL
- importLayerForEntity( const uno::Reference< backenduno::XLayer >& aLayer, const OUString& aEntity )
+ importLayerForEntity( const uno::Reference< backenduno::XLayer >& aLayer, const rtl::OUString& aEntity )
throw ( backenduno::MalformedDataException,
lang::WrappedTargetException, lang::IllegalArgumentException,
lang::NullPointerException, uno::RuntimeException);
protected:
- typedef uno::Reference< uno::XComponentContext > Context;
- typedef uno::Reference< lang::XMultiServiceFactory > ServiceFactory;
- typedef uno::Reference< backenduno::XBackend > Backend;
- typedef uno::Reference< backenduno::XLayerHandler > InputHandler;
-
- Backend createDefaultBackend() const;
+ uno::Reference< backenduno::XBackend > createDefaultBackend() const;
- //ServiceFactory getServiceFactory() const
+ //uno::Reference< lang::XMultiServiceFactory > getServiceFactory() const
- virtual sal_Bool setImplementationProperty( OUString const & aName, uno::Any const & aValue);
- /** Notify Backend of import */
+ virtual sal_Bool setImplementationProperty( rtl::OUString const & aName, uno::Any const & aValue);
+ /** Notify backend of import */
sal_Bool m_bSendNotification;
private:
// is pure virtual to allow different import services
- virtual InputHandler createImportHandler(Backend const & xBackend, OUString const & aEntity = OUString()) = 0;
+ virtual uno::Reference< backenduno::XLayerHandler > createImportHandler(uno::Reference< backenduno::XBackend > const & xBackend, rtl::OUString const & aEntity = rtl::OUString()) = 0;
private:
osl::Mutex m_aMutex;
- Context m_xContext;
- Backend m_xDestinationBackend;
+ uno::Reference< uno::XComponentContext > m_xContext;
+ uno::Reference< backenduno::XBackend > m_xDestinationBackend;
ServiceInfoHelper m_aServiceInfo;
@@ -137,19 +129,19 @@ namespace configmgr
class MergeImportService : public ImportService
{
public:
- explicit MergeImportService(CreationArg _xContext);
+ explicit MergeImportService(uno::Reference< uno::XComponentContext > const & _xContext);
private:
- InputHandler createImportHandler(Backend const & xBackend, OUString const & aEntity);
+ uno::Reference< backenduno::XLayerHandler > createImportHandler(uno::Reference< backenduno::XBackend > const & xBackend, rtl::OUString const & aEntity);
};
// -----------------------------------------------------------------------------
class CopyImportService : public ImportService
{
public:
- explicit CopyImportService(CreationArg _xContext);
+ explicit CopyImportService(uno::Reference< uno::XComponentContext > const & _xContext);
private:
- InputHandler createImportHandler(Backend const & xBackend, OUString const & aEntity);
- sal_Bool setImplementationProperty( OUString const & aName, uno::Any const & aValue);
+ uno::Reference< backenduno::XLayerHandler > createImportHandler(uno::Reference< backenduno::XBackend > const & xBackend, rtl::OUString const & aEntity);
+ sal_Bool setImplementationProperty( rtl::OUString const & aName, uno::Any const & aValue);
private:
sal_Bool m_bOverwrite;
};
diff --git a/configmgr/source/backend/layerdefaultremover.cxx b/configmgr/source/backend/layerdefaultremover.cxx
index 1aebdfa0d5..6cfe71a9d6 100644
--- a/configmgr/source/backend/layerdefaultremover.cxx
+++ b/configmgr/source/backend/layerdefaultremover.cxx
@@ -44,7 +44,7 @@ namespace configmgr
namespace uno = ::com::sun::star::uno;
// -----------------------------------------------------------------------------
- LayerDefaultRemover::LayerDefaultRemover(ResultHandler const & _xResultHandler)
+ LayerDefaultRemover::LayerDefaultRemover(uno::Reference< backenduno::XLayerHandler > const & _xResultHandler)
:m_xResultHandler(_xResultHandler)
{
}
@@ -68,7 +68,7 @@ namespace configmgr
// -----------------------------------------------------------------------------
void SAL_CALL LayerDefaultRemover::startLayer( )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
{
clearPendingProperty();
m_xResultHandler->startLayer();
@@ -76,7 +76,7 @@ namespace configmgr
// -----------------------------------------------------------------------------
void SAL_CALL LayerDefaultRemover::endLayer( )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
{
if (hasPendingProperty())
{
@@ -94,8 +94,8 @@ namespace configmgr
}
// -----------------------------------------------------------------------------
- void SAL_CALL LayerDefaultRemover::overrideNode( const OUString& aName, sal_Int16 aAttributes, sal_Bool bClear )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
+ void SAL_CALL LayerDefaultRemover::overrideNode( const rtl::OUString& aName, sal_Int16 aAttributes, sal_Bool bClear )
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
{
if (hasPendingProperty())
{
@@ -115,16 +115,16 @@ namespace configmgr
}
// -----------------------------------------------------------------------------
- void SAL_CALL LayerDefaultRemover::addOrReplaceNode( const OUString& aName, sal_Int16 aAttributes )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
+ void SAL_CALL LayerDefaultRemover::addOrReplaceNode( const rtl::OUString& aName, sal_Int16 aAttributes )
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
{
playBackNodeStack();
m_xResultHandler->addOrReplaceNode(aName, aAttributes);
}
// -----------------------------------------------------------------------------
- void SAL_CALL LayerDefaultRemover::addOrReplaceNodeFromTemplate( const OUString& aName, const backenduno::TemplateIdentifier& aTemplate, sal_Int16 aAttributes )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
+ void SAL_CALL LayerDefaultRemover::addOrReplaceNodeFromTemplate( const rtl::OUString& aName, const backenduno::TemplateIdentifier& aTemplate, sal_Int16 aAttributes )
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
{
playBackNodeStack();
m_xResultHandler->addOrReplaceNodeFromTemplate(aName,aTemplate,aAttributes);
@@ -132,7 +132,7 @@ namespace configmgr
// -----------------------------------------------------------------------------
void SAL_CALL LayerDefaultRemover::endNode( )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
{
if (hasPendingProperty())
{
@@ -151,32 +151,32 @@ namespace configmgr
}
// -----------------------------------------------------------------------------
- void SAL_CALL LayerDefaultRemover::dropNode( const OUString& aName )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
+ void SAL_CALL LayerDefaultRemover::dropNode( const rtl::OUString& aName )
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
{
playBackNodeStack();
m_xResultHandler->dropNode(aName);
}
// -----------------------------------------------------------------------------
- void SAL_CALL LayerDefaultRemover::addProperty( const OUString& aName, sal_Int16 aAttributes, const uno::Type& aType )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
+ void SAL_CALL LayerDefaultRemover::addProperty( const rtl::OUString& aName, sal_Int16 aAttributes, const uno::Type& aType )
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
{
playBackNodeStack();
m_xResultHandler->addProperty (aName,aAttributes,aType);
}
// -----------------------------------------------------------------------------
- void SAL_CALL LayerDefaultRemover::addPropertyWithValue( const OUString& aName, sal_Int16 aAttributes, const uno::Any& aValue )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
+ void SAL_CALL LayerDefaultRemover::addPropertyWithValue( const rtl::OUString& aName, sal_Int16 aAttributes, const uno::Any& aValue )
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
{
playBackNodeStack();
m_xResultHandler->addPropertyWithValue(aName,aAttributes,aValue);
}
// -----------------------------------------------------------------------------
- void SAL_CALL LayerDefaultRemover::overrideProperty( const OUString& aName, sal_Int16 aAttributes, const uno::Type& aType, sal_Bool bClear )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
+ void SAL_CALL LayerDefaultRemover::overrideProperty( const rtl::OUString& aName, sal_Int16 aAttributes, const uno::Type& aType, sal_Bool bClear )
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
{
if (hasPendingProperty())
{
@@ -186,7 +186,7 @@ namespace configmgr
}
if (aAttributes != 0 || bClear)
{
- m_aPropName.Name=OUString();
+ m_aPropName.Name=rtl::OUString();
playBackNodeStack();
m_xResultHandler->overrideProperty(aName,aAttributes,aType,bClear);
}
@@ -199,7 +199,7 @@ namespace configmgr
// -----------------------------------------------------------------------------
void SAL_CALL LayerDefaultRemover::endProperty( )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
{
if (hasPendingProperty())
{
@@ -211,15 +211,15 @@ namespace configmgr
// -----------------------------------------------------------------------------
void SAL_CALL LayerDefaultRemover::setPropertyValue( const uno::Any& aValue )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
{
playBackNodeStack(true);
m_xResultHandler->setPropertyValue(aValue);
}
// -----------------------------------------------------------------------------
- void SAL_CALL LayerDefaultRemover::setPropertyValueForLocale( const uno::Any& aValue, const OUString& aLocale )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
+ void SAL_CALL LayerDefaultRemover::setPropertyValueForLocale( const uno::Any& aValue, const rtl::OUString& aLocale )
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
{
playBackNodeStack(true);
m_xResultHandler->setPropertyValueForLocale(aValue,aLocale);
@@ -242,7 +242,7 @@ namespace configmgr
}
if (!m_aNodeStack.empty())
{
- for (NodeStack::iterator aIter = m_aNodeStack.begin();
+ for (std::vector<rtl::OUString>::iterator aIter = m_aNodeStack.begin();
aIter != m_aNodeStack.end(); aIter++)
{
m_xResultHandler->overrideNode(*aIter, 0,false);
@@ -263,7 +263,7 @@ namespace configmgr
void LayerDefaultRemover::raiseMalformedDataException(sal_Char const * pMsg)
{
OSL_ASSERT(pMsg);
- OUString sMsg = OUString::createFromAscii(pMsg);
+ rtl::OUString sMsg = rtl::OUString::createFromAscii(pMsg);
throw backenduno::MalformedDataException( sMsg, *this, uno::Any() );
}
diff --git a/configmgr/source/backend/layerdefaultremover.hxx b/configmgr/source/backend/layerdefaultremover.hxx
index b249f7c666..784b7f7a53 100644
--- a/configmgr/source/backend/layerdefaultremover.hxx
+++ b/configmgr/source/backend/layerdefaultremover.hxx
@@ -47,75 +47,71 @@ namespace configmgr
namespace backend
{
// -----------------------------------------------------------------------------
- using rtl::OUString;
namespace uno = ::com::sun::star::uno;
namespace lang = ::com::sun::star::lang;
namespace backenduno = ::com::sun::star::configuration::backend;
-
- using backenduno::MalformedDataException;
// -----------------------------------------------------------------------------
class LayerDefaultRemover : public cppu::WeakImplHelper1<backenduno::XLayerHandler>
{
public:
- typedef uno::Reference< backenduno::XLayerHandler > ResultHandler;
explicit
- LayerDefaultRemover(ResultHandler const & _xResultHandler);
+ LayerDefaultRemover(uno::Reference< backenduno::XLayerHandler > const & _xResultHandler);
virtual ~LayerDefaultRemover();
// XLayerHandler
public:
virtual void SAL_CALL
startLayer( )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
virtual void SAL_CALL
endLayer( )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
virtual void SAL_CALL
- overrideNode( const OUString& aName, sal_Int16 aAttributes, sal_Bool bClear )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
+ overrideNode( const rtl::OUString& aName, sal_Int16 aAttributes, sal_Bool bClear )
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
virtual void SAL_CALL
- addOrReplaceNode( const OUString& aName, sal_Int16 aAttributes )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
+ addOrReplaceNode( const rtl::OUString& aName, sal_Int16 aAttributes )
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
virtual void SAL_CALL
- addOrReplaceNodeFromTemplate( const OUString& aName, const backenduno::TemplateIdentifier& aTemplate, sal_Int16 aAttributes )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
+ addOrReplaceNodeFromTemplate( const rtl::OUString& aName, const backenduno::TemplateIdentifier& aTemplate, sal_Int16 aAttributes )
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
virtual void SAL_CALL
endNode( )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
virtual void SAL_CALL
- dropNode( const OUString& aName )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
+ dropNode( const rtl::OUString& aName )
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
virtual void SAL_CALL
- overrideProperty( const OUString& aName, sal_Int16 aAttributes, const uno::Type& aType, sal_Bool bClear )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
+ overrideProperty( const rtl::OUString& aName, sal_Int16 aAttributes, const uno::Type& aType, sal_Bool bClear )
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
virtual void SAL_CALL
- addProperty( const OUString& aName, sal_Int16 aAttributes, const uno::Type& aType )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
+ addProperty( const rtl::OUString& aName, sal_Int16 aAttributes, const uno::Type& aType )
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
virtual void SAL_CALL
- addPropertyWithValue( const OUString& aName, sal_Int16 aAttributes, const uno::Any& aValue )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
+ addPropertyWithValue( const rtl::OUString& aName, sal_Int16 aAttributes, const uno::Any& aValue )
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
virtual void SAL_CALL
endProperty( )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
virtual void SAL_CALL
setPropertyValue( const uno::Any& aValue )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
virtual void SAL_CALL
- setPropertyValueForLocale( const uno::Any& aValue, const OUString& aLocale )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
+ setPropertyValueForLocale( const uno::Any& aValue, const rtl::OUString& aLocale )
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
private:
void playBackNodeStack( bool bPlayProperty=false);
@@ -123,12 +119,11 @@ namespace configmgr
inline bool hasPendingProperty();
inline void clearPendingProperty();
private:
- ResultHandler m_xResultHandler;
- typedef std::vector<OUString> NodeStack;
- NodeStack m_aNodeStack;
+ uno::Reference< backenduno::XLayerHandler > m_xResultHandler;
+ std::vector<rtl::OUString> m_aNodeStack;
struct PropertyStruct
{
- OUString Name;
+ rtl::OUString Name;
uno::Type Type;
}m_aPropName;
};
diff --git a/configmgr/source/backend/layermerge.cxx b/configmgr/source/backend/layermerge.cxx
index 63dbb38540..05c11577ea 100644
--- a/configmgr/source/backend/layermerge.cxx
+++ b/configmgr/source/backend/layermerge.cxx
@@ -69,20 +69,18 @@ namespace configmgr
struct LayerMergeHandler::Converter
{
- typedef uno::Reference< com::sun::star::script::XTypeConverter > TypeConverter;
-
explicit
- Converter(Context const & xContext);
+ Converter(uno::Reference< uno::XComponentContext > const & xContext);
uno::Any convertValue(uno::Type const & _aTargetType, uno::Any const & _aValue);
- static TypeConverter createTCV(Context const & xContext);
+ static uno::Reference< com::sun::star::script::XTypeConverter > createTCV(uno::Reference< uno::XComponentContext > const & xContext);
ValueConverter m_aConverter;
bool m_bConvertData;
};
// -----------------------------------------------------------------------------
-LayerMergeHandler::LayerMergeHandler(Context const & xContext, MergedComponentData & _rData, ITemplateDataProvider* aTemplateProvider )
+LayerMergeHandler::LayerMergeHandler(uno::Reference< uno::XComponentContext > const & xContext, MergedComponentData & _rData, ITemplateDataProvider* aTemplateProvider )
: m_rData(_rData)
//, m_aContext(xContext,static_cast<backenduno::XLayerHandler*>(this),aTemplateProvider )
, m_aContext(xContext)
@@ -117,7 +115,7 @@ void LayerMergeHandler::prepareLayer()
}
// -----------------------------------------------------------------------------
-bool LayerMergeHandler::prepareSublayer(OUString const & aLocale)
+bool LayerMergeHandler::prepareSublayer(rtl::OUString const & aLocale)
{
OSL_ENSURE(isDone(), "LayerMergeHandler: Warning: Previous layer not terminated properly");
if (!isDone())
@@ -196,7 +194,7 @@ void LayerMergeHandler::propagateAttributes(ISubtree & _rParent)
// -----------------------------------------------------------------------------
node::Attributes LayerMergeHandler::makePropertyAttributes(sal_Int16 aSchemaAttributes)
- CFG_UNO_THROW1( configuration::backend::MalformedDataException )
+ SAL_THROW((com::sun::star::configuration::backend::MalformedDataException , com::sun::star::uno::RuntimeException))
{
const sal_uInt16 k_allPropertySchemaAttributes =
SchemaAttribute::REQUIRED;
@@ -228,7 +226,7 @@ node::Attributes LayerMergeHandler::makePropertyAttributes(sal_Int16 aSchemaAttr
// -----------------------------------------------------------------------------
void LayerMergeHandler::checkPropertyType(uno::Type const & _aType)
- CFG_UNO_THROW1( configuration::backend::MalformedDataException )
+ SAL_THROW((com::sun::star::configuration::backend::MalformedDataException , com::sun::star::uno::RuntimeException))
{
OSL_ASSERT(m_pProperty);
@@ -285,7 +283,7 @@ void LayerMergeHandler::checkPropertyType(uno::Type const & _aType)
// -----------------------------------------------------------------------------
void LayerMergeHandler::setValueAndCheck(ValueNode& _rValueNode, uno::Any const & _aValue)
- CFG_UNO_THROW1( configuration::backend::MalformedDataException )
+ SAL_THROW((com::sun::star::configuration::backend::MalformedDataException , com::sun::star::uno::RuntimeException))
{
if (_aValue.hasValue() && m_pConverter && m_pConverter->m_bConvertData)
{
@@ -304,8 +302,8 @@ void LayerMergeHandler::setValueAndCheck(ValueNode& _rValueNode, uno::Any const
}
// -----------------------------------------------------------------------------
-void LayerMergeHandler::setLocalizedValue(ISubtree * pProperty, uno::Any const & _aValue, OUString const & _aLocale)
- CFG_UNO_THROW1( configuration::backend::MalformedDataException )
+void LayerMergeHandler::setLocalizedValue(ISubtree * pProperty, uno::Any const & _aValue, rtl::OUString const & _aLocale)
+ SAL_THROW((com::sun::star::configuration::backend::MalformedDataException , com::sun::star::uno::RuntimeException))
{
if (ISubtree * pLocalizedCont = pProperty->asISubtree())
{
@@ -362,7 +360,7 @@ void LayerMergeHandler::setLocalizedValue(ISubtree * pProperty, uno::Any const &
// -----------------------------------------------------------------------------
void LayerMergeHandler::applyPropertyValue(uno::Any const & _aValue)
- CFG_UNO_THROW1( configuration::backend::MalformedDataException )
+ SAL_THROW((com::sun::star::configuration::backend::MalformedDataException , com::sun::star::uno::RuntimeException))
{
OSL_ASSERT(m_pProperty);
@@ -385,8 +383,8 @@ void LayerMergeHandler::applyPropertyValue(uno::Any const & _aValue)
}
// -----------------------------------------------------------------------------
-void LayerMergeHandler::applyPropertyValue(uno::Any const & _aValue, OUString const & _aLocale)
- CFG_UNO_THROW1( configuration::backend::MalformedDataException )
+void LayerMergeHandler::applyPropertyValue(uno::Any const & _aValue, rtl::OUString const & _aLocale)
+ SAL_THROW((com::sun::star::configuration::backend::MalformedDataException , com::sun::star::uno::RuntimeException))
{
OSL_ASSERT(m_pProperty);
@@ -414,7 +412,7 @@ void LayerMergeHandler::applyPropertyValue(uno::Any const & _aValue, OUString co
// -----------------------------------------------------------------------------
void LayerMergeHandler::applyAttributes(INode * pNode, sal_Int16 aNodeAttributes)
- CFG_UNO_THROW1( configuration::backend::MalformedDataException )
+ SAL_THROW((com::sun::star::configuration::backend::MalformedDataException , com::sun::star::uno::RuntimeException))
{
sal_Int16 const k_allNodeAttributes =
NodeAttribute::MANDATORY |
@@ -492,7 +490,7 @@ void logRejection(DataBuilderContext const & aContext, INode * pNode, bool bMand
// -----------------------------------------------------------------------------
bool LayerMergeHandler::startOverride(INode * pNode, sal_Bool bClear) /* ensure writable, mark merged */
- CFG_NOTHROW( )
+ SAL_THROW(())
{
OSL_PRECOND(pNode,"startOverride: non-NULL base node required");
if (!m_aContext.isWritable(pNode))
@@ -517,7 +515,7 @@ bool LayerMergeHandler::startOverride(INode * pNode, sal_Bool bClear) /* ensure
// -----------------------------------------------------------------------------
void LayerMergeHandler::ensureUnchanged(INode const * pNode) const
- CFG_UNO_THROW1( configuration::backend::MalformedDataException )
+ SAL_THROW((com::sun::star::configuration::backend::MalformedDataException , com::sun::star::uno::RuntimeException))
{
// to do: change state handling to detect this within sets
OSL_PRECOND(pNode,"INTERNAL ERROR: Unexpected NULL node pointer");
@@ -533,7 +531,7 @@ void LayerMergeHandler::ensureUnchanged(INode const * pNode) const
// XLayerHandler
void SAL_CALL LayerMergeHandler::startLayer( )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
{
ISubtree * pSchema = m_rData.getSchemaTree();
OSL_ENSURE(pSchema,"No base data to merge layer into");
@@ -541,7 +539,7 @@ void SAL_CALL LayerMergeHandler::startLayer( )
if (!pSchema)
{
m_aContext.getLogger().error("No schema data for merging layer", "startLayer", "configmgr::LayerMergeHandler");
- throw uno::RuntimeException(OUString::createFromAscii("Layer merging: No data to merge with"),*this);
+ throw uno::RuntimeException(rtl::OUString::createFromAscii("Layer merging: No data to merge with"),*this);
}
m_aContext.startActiveComponent(pSchema->getName());
@@ -556,7 +554,7 @@ void SAL_CALL LayerMergeHandler::startLayer( )
// -----------------------------------------------------------------------------
void SAL_CALL LayerMergeHandler::endLayer( )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
{
if (this->isSkipping())
m_aContext.raiseMalformedDataException("Layer merging: Unmatched data being skipped was not terminated properly.");
@@ -570,8 +568,8 @@ void SAL_CALL LayerMergeHandler::endLayer( )
}
// -----------------------------------------------------------------------------
-void LayerMergeHandler::overrideLayerRoot( const OUString& aName, sal_Int16 aAttributes, sal_Bool bClear )
- CFG_UNO_THROW1( configuration::backend::MalformedDataException )
+void LayerMergeHandler::overrideLayerRoot( const rtl::OUString& aName, sal_Int16 aAttributes, sal_Bool bClear )
+ SAL_THROW((com::sun::star::configuration::backend::MalformedDataException , com::sun::star::uno::RuntimeException))
{
OSL_PRECOND( m_aContext.hasActiveComponent(), "Layer merging: active component is not set");
OSL_PRECOND( m_aContext.isDone(), "Layer merging: node is not root");
@@ -625,8 +623,8 @@ void LayerMergeHandler::implOverrideNode(
}
}
-void SAL_CALL LayerMergeHandler::overrideNode( const OUString& aName, sal_Int16 aAttributes, sal_Bool bClear )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
+void SAL_CALL LayerMergeHandler::overrideNode( const rtl::OUString& aName, sal_Int16 aAttributes, sal_Bool bClear )
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
{
if (this->isSkipping())
{
@@ -657,8 +655,8 @@ void SAL_CALL LayerMergeHandler::overrideNode( const OUString& aName, sal_Int16
}
// -----------------------------------------------------------------------------
-void LayerMergeHandler::implAddOrReplaceNode( const OUString& aName, const TemplateIdentifier& aTemplate, sal_Int16 aAttributes )
- CFG_UNO_THROW1( configuration::backend::MalformedDataException )
+void LayerMergeHandler::implAddOrReplaceNode( const rtl::OUString& aName, const backenduno::TemplateIdentifier& aTemplate, sal_Int16 aAttributes )
+ SAL_THROW((com::sun::star::configuration::backend::MalformedDataException , com::sun::star::uno::RuntimeException))
{
ISubtree * pReplacedNode = m_aContext.findNode(aName);
if (pReplacedNode)
@@ -686,8 +684,7 @@ void LayerMergeHandler::implAddOrReplaceNode( const OUString& aName, const Templ
}
else
{
- TemplateRequest aTemplateRequest(configuration::makeName(aTemplate.Name, configuration::Name::NoValidate()),
- configuration::makeName(aTemplate.Component, configuration::Name::NoValidate()) );
+ TemplateRequest aTemplateRequest(aTemplate.Name, aTemplate.Component);
apNewInstance = m_aContext.getTemplateData( aTemplateRequest ).extractDataAndClear();
if (apNewInstance.get())
apNewInstance->setName( aName );
@@ -710,8 +707,8 @@ void LayerMergeHandler::implAddOrReplaceNode( const OUString& aName, const Templ
}
// -----------------------------------------------------------------------------
-void SAL_CALL LayerMergeHandler::addOrReplaceNode( const OUString& aName, sal_Int16 aAttributes )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
+void SAL_CALL LayerMergeHandler::addOrReplaceNode( const rtl::OUString& aName, sal_Int16 aAttributes )
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
{
if (this->isSkipping())
{
@@ -723,8 +720,8 @@ void SAL_CALL LayerMergeHandler::addOrReplaceNode( const OUString& aName, sal_In
}
// -----------------------------------------------------------------------------
-void SAL_CALL LayerMergeHandler::addOrReplaceNodeFromTemplate( const OUString& aName, const TemplateIdentifier& aTemplate, sal_Int16 aAttributes )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
+void SAL_CALL LayerMergeHandler::addOrReplaceNodeFromTemplate( const rtl::OUString& aName, const backenduno::TemplateIdentifier& aTemplate, sal_Int16 aAttributes )
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
{
if (this->isSkipping())
{
@@ -738,7 +735,7 @@ void SAL_CALL LayerMergeHandler::addOrReplaceNodeFromTemplate( const OUString& a
// -----------------------------------------------------------------------------
void SAL_CALL LayerMergeHandler::endNode( )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
{
if (this->leaveSkippedNode())
return;
@@ -749,8 +746,8 @@ void SAL_CALL LayerMergeHandler::endNode( )
}
// -----------------------------------------------------------------------------
-void SAL_CALL LayerMergeHandler::dropNode( const OUString& aName )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
+void SAL_CALL LayerMergeHandler::dropNode( const rtl::OUString& aName )
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
{
if (this->isSkipping())
return;
@@ -785,8 +782,8 @@ void SAL_CALL LayerMergeHandler::dropNode( const OUString& aName )
}
// -----------------------------------------------------------------------------
-void SAL_CALL LayerMergeHandler::overrideProperty( const OUString& aName, sal_Int16 aAttributes, const uno::Type& aType, sal_Bool bClear )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
+void SAL_CALL LayerMergeHandler::overrideProperty( const rtl::OUString& aName, sal_Int16 aAttributes, const uno::Type& aType, sal_Bool bClear )
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
{
if (this->isSkipping())
{
@@ -825,7 +822,7 @@ void SAL_CALL LayerMergeHandler::overrideProperty( const OUString& aName, sal_In
// -----------------------------------------------------------------------------
void SAL_CALL LayerMergeHandler::endProperty( )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
{
if (this->leaveSkippedNode())
return;
@@ -841,8 +838,8 @@ void SAL_CALL LayerMergeHandler::endProperty( )
}
// -----------------------------------------------------------------------------
-void SAL_CALL LayerMergeHandler::addProperty( const OUString& aName, sal_Int16 aAttributes, const uno::Type& aType )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
+void SAL_CALL LayerMergeHandler::addProperty( const rtl::OUString& aName, sal_Int16 aAttributes, const uno::Type& aType )
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
{
if (this->isSkipping())
return;
@@ -861,8 +858,8 @@ void SAL_CALL LayerMergeHandler::addProperty( const OUString& aName, sal_Int16 a
}
// -----------------------------------------------------------------------------
-void SAL_CALL LayerMergeHandler::addPropertyWithValue( const OUString& aName, sal_Int16 aAttributes, const uno::Any& aValue )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
+void SAL_CALL LayerMergeHandler::addPropertyWithValue( const rtl::OUString& aName, sal_Int16 aAttributes, const uno::Any& aValue )
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
{
if (this->isSkipping())
return;
@@ -881,7 +878,7 @@ void SAL_CALL LayerMergeHandler::addPropertyWithValue( const OUString& aName, sa
// -----------------------------------------------------------------------------
void SAL_CALL LayerMergeHandler::setPropertyValue( const uno::Any& aValue )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
{
if (this->isSkipping())
return;
@@ -897,8 +894,8 @@ void SAL_CALL LayerMergeHandler::setPropertyValue( const uno::Any& aValue )
}
// -----------------------------------------------------------------------------
-void SAL_CALL LayerMergeHandler::setPropertyValueForLocale( const uno::Any& aValue, OUString const & aLocale )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
+void SAL_CALL LayerMergeHandler::setPropertyValueForLocale( const uno::Any& aValue, rtl::OUString const & aLocale )
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
{
if (this->isSkipping())
return;
@@ -915,38 +912,36 @@ void SAL_CALL LayerMergeHandler::setPropertyValueForLocale( const uno::Any& aVal
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
-LayerMergeHandler::Converter::TypeConverter
- LayerMergeHandler::Converter::createTCV(Context const & xContext)
+uno::Reference< com::sun::star::script::XTypeConverter >
+ LayerMergeHandler::Converter::createTCV(uno::Reference< uno::XComponentContext > const & xContext)
{
OSL_ENSURE(xContext.is(),"Cannot create TypeConverter for LayerMergeHandler without a Context");
uno::Reference< lang::XMultiComponentFactory > xFactory = xContext->getServiceManager();
OSL_ENSURE(xFactory.is(),"Cannot create TypeConverter for LayerMergeHandler without a ServiceManager");
- TypeConverter xTCV;
+ uno::Reference< com::sun::star::script::XTypeConverter > xTCV;
if (xFactory.is())
{
static const rtl::OUString k_sTCVService(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.script.Converter"));
- xTCV = TypeConverter::query(xFactory->createInstanceWithContext(k_sTCVService,xContext));
+ xTCV = uno::Reference< com::sun::star::script::XTypeConverter >::query(xFactory->createInstanceWithContext(k_sTCVService,xContext));
}
return xTCV;
}
// -----------------------------------------------------------------------------
-LayerMergeHandler::Converter::Converter(Context const & xContext)
+LayerMergeHandler::Converter::Converter(uno::Reference< uno::XComponentContext > const & xContext)
: m_aConverter( createTCV(xContext) )
, m_bConvertData(false)
{
}
// -----------------------------------------------------------------------------
-typedef uno::Sequence< sal_Int8 > Binary;
-// -----------------------------------------------------------------------------
static
inline
uno::Type getBinaryDataType()
{
- Binary const * const forBinary = 0;
+ uno::Sequence< sal_Int8 > const * const forBinary = 0;
return ::getCppuType(forBinary);
}
// -----------------------------------------------------------------------------
@@ -962,12 +957,12 @@ uno::Any LayerMergeHandler::Converter::convertValue(uno::Type const & _aTargetTy
if (m_aConverter.isList())
{
- uno::Sequence< OUString > aStringList;
+ uno::Sequence< rtl::OUString > aStringList;
if (_aValue >>= aStringList)
return m_aConverter.convertListToAny(aStringList);
}
- OUString aContent;
+ rtl::OUString aContent;
if (_aValue >>= aContent)
return m_aConverter.convertToAny(aContent);
diff --git a/configmgr/source/backend/layermerge.hxx b/configmgr/source/backend/layermerge.hxx
index 31a7da45cd..c21e5d1a91 100644
--- a/configmgr/source/backend/layermerge.hxx
+++ b/configmgr/source/backend/layermerge.hxx
@@ -49,24 +49,19 @@ namespace configmgr
namespace lang = ::com::sun::star::lang;
namespace backenduno = ::com::sun::star::configuration::backend;
- using backenduno::MalformedDataException;
// -----------------------------------------------------------------------------
- typedef ::cppu::WeakImplHelper1<backenduno::XLayerHandler> LayerMergeHandler_Base;
-
class LayerMergeHandler
- : public LayerMergeHandler_Base
+ : public cppu::WeakImplHelper1<backenduno::XLayerHandler>
{
public:
- typedef uno::Reference< uno::XComponentContext > Context;
-
explicit
- LayerMergeHandler(Context const & _xContext, MergedComponentData & _rData, ITemplateDataProvider* aTemplateProvider = NULL);
+ LayerMergeHandler(uno::Reference< uno::XComponentContext > const & _xContext, MergedComponentData & _rData, ITemplateDataProvider* aTemplateProvider = NULL);
virtual ~LayerMergeHandler();
// prepare merging
void prepareLayer();
- bool prepareSublayer(OUString const & aLocale);
+ bool prepareSublayer(rtl::OUString const & aLocale);
// checking the result
bool isDone() const { return m_aContext.isDone(); }
@@ -76,94 +71,94 @@ namespace configmgr
public:
virtual void SAL_CALL
startLayer( )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
virtual void SAL_CALL
endLayer( )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
virtual void SAL_CALL
- overrideNode( const OUString& aName, sal_Int16 aAttributes, sal_Bool bClear )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
+ overrideNode( const rtl::OUString& aName, sal_Int16 aAttributes, sal_Bool bClear )
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
virtual void SAL_CALL
- addOrReplaceNode( const OUString& aName, sal_Int16 aAttributes )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
+ addOrReplaceNode( const rtl::OUString& aName, sal_Int16 aAttributes )
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
virtual void SAL_CALL
- addOrReplaceNodeFromTemplate( const OUString& aName, const TemplateIdentifier& aTemplate, sal_Int16 aAttributes )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
+ addOrReplaceNodeFromTemplate( const rtl::OUString& aName, const backenduno::TemplateIdentifier& aTemplate, sal_Int16 aAttributes )
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
virtual void SAL_CALL
endNode( )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
virtual void SAL_CALL
- dropNode( const OUString& aName )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
+ dropNode( const rtl::OUString& aName )
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
virtual void SAL_CALL
- overrideProperty( const OUString& aName, sal_Int16 aAttributes, const uno::Type& aType, sal_Bool bClear )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
+ overrideProperty( const rtl::OUString& aName, sal_Int16 aAttributes, const uno::Type& aType, sal_Bool bClear )
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
virtual void SAL_CALL
- addProperty( const OUString& aName, sal_Int16 aAttributes, const uno::Type& aType )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
+ addProperty( const rtl::OUString& aName, sal_Int16 aAttributes, const uno::Type& aType )
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
virtual void SAL_CALL
- addPropertyWithValue( const OUString& aName, sal_Int16 aAttributes, const uno::Any& aValue )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
+ addPropertyWithValue( const rtl::OUString& aName, sal_Int16 aAttributes, const uno::Any& aValue )
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
virtual void SAL_CALL
endProperty( )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
virtual void SAL_CALL
setPropertyValue( const uno::Any& aValue )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
virtual void SAL_CALL
- setPropertyValueForLocale( const uno::Any& aValue, const OUString & aLocale )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
+ setPropertyValueForLocale( const uno::Any& aValue, const rtl::OUString & aLocale )
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
private:
void propagateAttributes(ISubtree & _rParent);
node::Attributes makePropertyAttributes(sal_Int16 aSchemaAttributes)
- CFG_UNO_THROW1( configuration::backend::MalformedDataException );
+ SAL_THROW((com::sun::star::configuration::backend::MalformedDataException , com::sun::star::uno::RuntimeException));
void checkPropertyType(uno::Type const & _aType)
- CFG_UNO_THROW1( configuration::backend::MalformedDataException );
+ SAL_THROW((com::sun::star::configuration::backend::MalformedDataException , com::sun::star::uno::RuntimeException));
void applyPropertyValue(uno::Any const & _aValue)
- CFG_UNO_THROW1( configuration::backend::MalformedDataException );
+ SAL_THROW((com::sun::star::configuration::backend::MalformedDataException , com::sun::star::uno::RuntimeException));
- void applyPropertyValue(uno::Any const & _aValue, OUString const & _aLocale)
- CFG_UNO_THROW1( configuration::backend::MalformedDataException );
+ void applyPropertyValue(uno::Any const & _aValue, rtl::OUString const & _aLocale)
+ SAL_THROW((com::sun::star::configuration::backend::MalformedDataException , com::sun::star::uno::RuntimeException));
void applyAttributes(INode * pNode, sal_Int16 aNodeAttributes)
- CFG_UNO_THROW1( configuration::backend::MalformedDataException );
+ SAL_THROW((com::sun::star::configuration::backend::MalformedDataException , com::sun::star::uno::RuntimeException));
- void overrideLayerRoot( const OUString& aName, sal_Int16 aAttributes, sal_Bool bClear )
- CFG_UNO_THROW1( configuration::backend::MalformedDataException );
+ void overrideLayerRoot( const rtl::OUString& aName, sal_Int16 aAttributes, sal_Bool bClear )
+ SAL_THROW((com::sun::star::configuration::backend::MalformedDataException , com::sun::star::uno::RuntimeException));
bool startOverride(INode * pNode, sal_Bool bClear) /* check if writable, mark merged */
- CFG_NOTHROW( );
+ SAL_THROW(());
void implOverrideNode(
ISubtree * node, sal_Int16 attributes, bool clear);
- void implAddOrReplaceNode(const OUString& aName, const TemplateIdentifier& aTemplate, sal_Int16 aAttributes)
- CFG_UNO_THROW1( configuration::backend::MalformedDataException );
+ void implAddOrReplaceNode(const rtl::OUString& aName, const backenduno::TemplateIdentifier& aTemplate, sal_Int16 aAttributes)
+ SAL_THROW((com::sun::star::configuration::backend::MalformedDataException , com::sun::star::uno::RuntimeException));
void ensureUnchanged(INode const * pNode) const
- CFG_UNO_THROW1( configuration::backend::MalformedDataException );
+ SAL_THROW((com::sun::star::configuration::backend::MalformedDataException , com::sun::star::uno::RuntimeException));
- void setLocalizedValue(ISubtree * pProperty, uno::Any const & _aValue, OUString const & _aLocale)
- CFG_UNO_THROW1( configuration::backend::MalformedDataException );
+ void setLocalizedValue(ISubtree * pProperty, uno::Any const & _aValue, rtl::OUString const & _aLocale)
+ SAL_THROW((com::sun::star::configuration::backend::MalformedDataException , com::sun::star::uno::RuntimeException));
void setValueAndCheck(ValueNode & _rValueNode, uno::Any const & _aValue)
- CFG_UNO_THROW1( configuration::backend::MalformedDataException );
+ SAL_THROW((com::sun::star::configuration::backend::MalformedDataException , com::sun::star::uno::RuntimeException));
private:
void skipNode() { ++m_nSkipping; }
bool isSkipping() const { return m_nSkipping != 0; }
@@ -173,7 +168,7 @@ namespace configmgr
MergedComponentData & m_rData;
DataBuilderContext m_aContext;
ComponentDataFactory m_aFactory;
- OUString m_aLocale;
+ rtl::OUString m_aLocale;
INode * m_pProperty;
Converter * m_pConverter;
diff --git a/configmgr/source/backend/layerupdate.cxx b/configmgr/source/backend/layerupdate.cxx
index 0a87900c3c..8bbb401b39 100644
--- a/configmgr/source/backend/layerupdate.cxx
+++ b/configmgr/source/backend/layerupdate.cxx
@@ -67,7 +67,7 @@ LayerUpdate & LayerUpdate::operator =(LayerUpdate const & _aOther)
}
// -----------------------------------------------------------------------------
-void LayerUpdate::setContextNode(NodeUpdateRef const & _xContextNode)
+void LayerUpdate::setContextNode(rtl::Reference<NodeUpdate> const & _xContextNode)
{
m_xContextNode = _xContextNode;
if (_xContextNode.is())
@@ -78,27 +78,26 @@ void LayerUpdate::setContextNode(NodeUpdateRef const & _xContextNode)
}
// -----------------------------------------------------------------------------
-void LayerUpdate::makeContextPath(OUString const & _aPath)
+void LayerUpdate::makeContextPath(rtl::OUString const & _aPath)
{
- using configuration::AbsolutePath;
- AbsolutePath const aParsedPath = configuration::AbsolutePath::parse(_aPath);
+ configuration::AbsolutePath const aParsedPath = configuration::AbsolutePath::parse(_aPath);
m_aContextPath.clear();
m_aContextPath.reserve( aParsedPath.getDepth() );
- for (AbsolutePath::Iterator it = aParsedPath.begin(); it != aParsedPath.end(); ++it)
+ for (std::vector<configuration::Path::Component>::const_reverse_iterator it = aParsedPath.begin(); it != aParsedPath.end(); ++it)
{
- m_aContextPath.push_back( it->getName().toString() );
+ m_aContextPath.push_back( it->getName() );
}
}
// -----------------------------------------------------------------------------
-NodeUpdateRef LayerUpdate::getContextNode() const
+rtl::Reference<NodeUpdate> LayerUpdate::getContextNode() const
{
return m_xContextNode;
}
// -----------------------------------------------------------------------------
-LayerUpdate::ContextPath const & LayerUpdate::getContextPath() const
+std::vector<rtl::OUString> const & LayerUpdate::getContextPath() const
{
OSL_PRECOND( m_xContextNode.is(), "Cannot get context path without context node" );
diff --git a/configmgr/source/backend/layerupdate.hxx b/configmgr/source/backend/layerupdate.hxx
index 80587159e3..dfedfa9b5a 100644
--- a/configmgr/source/backend/layerupdate.hxx
+++ b/configmgr/source/backend/layerupdate.hxx
@@ -52,37 +52,30 @@ namespace configmgr
// -----------------------------------------------------------------------------
namespace uno = ::com::sun::star::uno;
namespace backenduno = ::com::sun::star::configuration::backend;
-
- using rtl::OUString;
// -----------------------------------------------------------------------------
class NodeUpdate;
- typedef rtl::Reference<NodeUpdate> NodeUpdateRef;
class LayerUpdate
{
public:
- typedef uno::Reference< backenduno::XLayerHandler > LayerWriter;
-
LayerUpdate();
LayerUpdate(LayerUpdate const & _aOther);
~LayerUpdate();
LayerUpdate & operator =(LayerUpdate const & _aOther);
public:
- typedef std::vector<OUString> ContextPath;
-
bool isEmpty() const { return ! m_xContextNode.is(); }
- NodeUpdateRef getContextNode() const;
- ContextPath const & getContextPath() const;
+ rtl::Reference<NodeUpdate> getContextNode() const;
+ std::vector<rtl::OUString> const & getContextPath() const;
- void setContextNode(NodeUpdateRef const & _xContextNode);
+ void setContextNode(rtl::Reference<NodeUpdate> const & _xContextNode);
private:
- void makeContextPath(OUString const & _aContextPath);
+ void makeContextPath(rtl::OUString const & _aContextPath);
private:
- NodeUpdateRef m_xContextNode;
- ContextPath m_aContextPath;
+ rtl::Reference<NodeUpdate> m_xContextNode;
+ std::vector<rtl::OUString> m_aContextPath;
};
// -----------------------------------------------------------------------------
diff --git a/configmgr/source/backend/layerupdatebuilder.cxx b/configmgr/source/backend/layerupdatebuilder.cxx
index 7cd5288a9f..a461316096 100644
--- a/configmgr/source/backend/layerupdatebuilder.cxx
+++ b/configmgr/source/backend/layerupdatebuilder.cxx
@@ -83,7 +83,7 @@ bool LayerUpdateBuilder::init()
if (m_pCurrentNode) return false;
LayerUpdate & update = data();
- m_pCurrentNode = new NodeModification(NULL, OUString(), 0, 0, false);
+ m_pCurrentNode = new NodeModification(NULL, rtl::OUString(), 0, 0, false);
update.setContextNode(m_pCurrentNode);
OSL_ENSURE(m_pCurrentProp == NULL, "LayerUpdateBuilder: Internal error: got a current property for a new context");
@@ -92,12 +92,12 @@ bool LayerUpdateBuilder::init()
}
// -----------------------------------------------------------------------------
-bool LayerUpdateBuilder::modifyNode(OUString const & _aName, sal_Int16 _nFlags, sal_Int16 _nFlagsMask, sal_Bool _bReset)
+bool LayerUpdateBuilder::modifyNode(rtl::OUString const & _aName, sal_Int16 _nFlags, sal_Int16 _nFlagsMask, sal_Bool _bReset)
{
OSL_PRECOND(m_pCurrentNode && !m_pCurrentProp, "LayerUpdateBuilder: Illegal state for this operation");
NodeUpdate * pNewNode = new NodeModification(m_pCurrentNode,_aName,_nFlags,_nFlagsMask,_bReset);
- ElementUpdateRef xNewNode(pNewNode);
+ rtl::Reference<ElementUpdate> xNewNode(pNewNode);
if (!m_pCurrentNode->addNodeUpdate(xNewNode))
return false;
@@ -107,7 +107,7 @@ bool LayerUpdateBuilder::modifyNode(OUString const & _aName, sal_Int16 _nFlags,
}
// -----------------------------------------------------------------------------
-bool LayerUpdateBuilder::replaceNode(OUString const & _aName, sal_Int16 _nFlags, backenduno::TemplateIdentifier const * _pTemplate)
+bool LayerUpdateBuilder::replaceNode(rtl::OUString const & _aName, sal_Int16 _nFlags, backenduno::TemplateIdentifier const * _pTemplate)
{
OSL_PRECOND(m_pCurrentNode && !m_pCurrentProp, "LayerUpdateBuilder: Illegal state for this operation");
@@ -115,7 +115,7 @@ bool LayerUpdateBuilder::replaceNode(OUString const & _aName, sal_Int16 _nFlags,
new NodeReplace(m_pCurrentNode,_aName,_nFlags,_pTemplate->Name,_pTemplate->Component) :
new NodeReplace(m_pCurrentNode,_aName,_nFlags);
- ElementUpdateRef xNewNode(pNewNode);
+ rtl::Reference<ElementUpdate> xNewNode(pNewNode);
if (!m_pCurrentNode->addNodeUpdate(xNewNode))
return false;
@@ -136,13 +136,13 @@ bool LayerUpdateBuilder::finishNode()
}
// -----------------------------------------------------------------------------
-bool LayerUpdateBuilder::removeNode(OUString const & _aName)
+bool LayerUpdateBuilder::removeNode(rtl::OUString const & _aName)
{
OSL_PRECOND(m_pCurrentNode && !m_pCurrentProp, "LayerUpdateBuilder: Illegal state for this operation");
NodeDrop * pNewNode = new NodeDrop(m_pCurrentNode,_aName);
- ElementUpdateRef xNewNode(pNewNode);
+ rtl::Reference<ElementUpdate> xNewNode(pNewNode);
if (!m_pCurrentNode->addNodeUpdate(xNewNode))
return false;
@@ -151,12 +151,12 @@ bool LayerUpdateBuilder::removeNode(OUString const & _aName)
}
// -----------------------------------------------------------------------------
-bool LayerUpdateBuilder::modifyProperty(OUString const & _aName, sal_Int16 _nFlags, sal_Int16 _nFlagsMask, uno::Type const & _aType)
+bool LayerUpdateBuilder::modifyProperty(rtl::OUString const & _aName, sal_Int16 _nFlags, sal_Int16 _nFlagsMask, uno::Type const & _aType)
{
OSL_PRECOND(m_pCurrentNode && !m_pCurrentProp, "LayerUpdateBuilder: Illegal state for this operation");
PropertyUpdate * pNewProp = new PropertyUpdate(m_pCurrentNode,_aName,_nFlags,_nFlagsMask,_aType);
- ElementUpdateRef xNewProp(pNewProp);
+ rtl::Reference<ElementUpdate> xNewProp(pNewProp);
if (!m_pCurrentNode->addPropertyUpdate(xNewProp))
return false;
@@ -174,7 +174,7 @@ bool LayerUpdateBuilder::setPropertyValue(uno::Any const & _aValue)
}
// -----------------------------------------------------------------------------
-bool LayerUpdateBuilder::setPropertyValueForLocale(uno::Any const & _aValue, OUString const & _aLocale)
+bool LayerUpdateBuilder::setPropertyValueForLocale(uno::Any const & _aValue, rtl::OUString const & _aLocale)
{
OSL_PRECOND(m_pCurrentProp, "LayerUpdateBuilder: Illegal state for property operation");
@@ -190,7 +190,7 @@ bool LayerUpdateBuilder::resetPropertyValue()
}
// -----------------------------------------------------------------------------
-bool LayerUpdateBuilder::resetPropertyValueForLocale(OUString const & _aLocale)
+bool LayerUpdateBuilder::resetPropertyValueForLocale(rtl::OUString const & _aLocale)
{
OSL_PRECOND(m_pCurrentProp, "LayerUpdateBuilder: Illegal state for property operation");
@@ -211,13 +211,13 @@ bool LayerUpdateBuilder::finishProperty()
}
// -----------------------------------------------------------------------------
-bool LayerUpdateBuilder::addNullProperty(OUString const & _aName, sal_Int16 _nFlags, uno::Type const & _aType)
+bool LayerUpdateBuilder::addNullProperty(rtl::OUString const & _aName, sal_Int16 _nFlags, uno::Type const & _aType)
{
OSL_PRECOND(m_pCurrentNode && !m_pCurrentProp, "LayerUpdateBuilder: Illegal state for this operation");
PropertyAdd * pNewProp = new PropertyAdd(m_pCurrentNode,_aName,_nFlags,_aType);
- ElementUpdateRef xNewProp(pNewProp);
+ rtl::Reference<ElementUpdate> xNewProp(pNewProp);
if (!m_pCurrentNode->addPropertyUpdate(xNewProp))
return false;
@@ -226,13 +226,13 @@ bool LayerUpdateBuilder::addNullProperty(OUString const & _aName, sal_Int16 _nFl
}
// -----------------------------------------------------------------------------
-bool LayerUpdateBuilder::addProperty(OUString const & _aName, sal_Int16 _nFlags, uno::Any const & _aValue)
+bool LayerUpdateBuilder::addProperty(rtl::OUString const & _aName, sal_Int16 _nFlags, uno::Any const & _aValue)
{
OSL_PRECOND(m_pCurrentNode && !m_pCurrentProp, "LayerUpdateBuilder: Illegal state for this operation");
PropertyAdd * pNewProp = new PropertyAdd(m_pCurrentNode,_aName,_nFlags,_aValue);
- ElementUpdateRef xNewProp(pNewProp);
+ rtl::Reference<ElementUpdate> xNewProp(pNewProp);
if (!m_pCurrentNode->addPropertyUpdate(xNewProp))
return false;
@@ -241,13 +241,13 @@ bool LayerUpdateBuilder::addProperty(OUString const & _aName, sal_Int16 _nFlags,
}
// -----------------------------------------------------------------------------
-bool LayerUpdateBuilder::resetProperty(OUString const & _aName)
+bool LayerUpdateBuilder::resetProperty(rtl::OUString const & _aName)
{
OSL_PRECOND(m_pCurrentNode && !m_pCurrentProp, "LayerUpdateBuilder: Illegal state for this operation");
PropertyReset * pNewProp = new PropertyReset(m_pCurrentNode,_aName);
- ElementUpdateRef xNewProp(pNewProp);
+ rtl::Reference<ElementUpdate> xNewProp(pNewProp);
if (!m_pCurrentNode->addPropertyUpdate(xNewProp))
return false;
diff --git a/configmgr/source/backend/layerupdatebuilder.hxx b/configmgr/source/backend/layerupdatebuilder.hxx
index bd32f13a08..47e4b38612 100644
--- a/configmgr/source/backend/layerupdatebuilder.hxx
+++ b/configmgr/source/backend/layerupdatebuilder.hxx
@@ -46,7 +46,6 @@ namespace configmgr
namespace backend
{
// -----------------------------------------------------------------------------
- using rtl::OUString;
namespace uno = ::com::sun::star::uno;
namespace backenduno = ::com::sun::star::configuration::backend;
// -----------------------------------------------------------------------------
@@ -65,22 +64,22 @@ namespace configmgr
/// initialize the update
bool init();
- bool modifyNode(OUString const & _aName, sal_Int16 _nFlags, sal_Int16 _nFlagsMask, sal_Bool _bReset);
- bool replaceNode(OUString const & _aName, sal_Int16 _nFlags, backenduno::TemplateIdentifier const * _pTemplate = NULL);
+ bool modifyNode(rtl::OUString const & _aName, sal_Int16 _nFlags, sal_Int16 _nFlagsMask, sal_Bool _bReset);
+ bool replaceNode(rtl::OUString const & _aName, sal_Int16 _nFlags, backenduno::TemplateIdentifier const * _pTemplate = NULL);
bool finishNode();
- bool removeNode(OUString const & _aName);
+ bool removeNode(rtl::OUString const & _aName);
- bool modifyProperty(OUString const & _aName, sal_Int16 _nFlags, sal_Int16 _nFlagsMask, uno::Type const & _aType);
+ bool modifyProperty(rtl::OUString const & _aName, sal_Int16 _nFlags, sal_Int16 _nFlagsMask, uno::Type const & _aType);
bool setPropertyValue(uno::Any const & _aValue);
- bool setPropertyValueForLocale(uno::Any const & _aValue, OUString const & _aLocale);
+ bool setPropertyValueForLocale(uno::Any const & _aValue, rtl::OUString const & _aLocale);
bool resetPropertyValue();
- bool resetPropertyValueForLocale(OUString const & _aLocale);
+ bool resetPropertyValueForLocale(rtl::OUString const & _aLocale);
bool finishProperty();
- bool addNullProperty(OUString const & _aName, sal_Int16 _nFlags, uno::Type const & _aType);
- bool addProperty(OUString const & _aName, sal_Int16 _nFlags, uno::Any const & _aValue);
- bool resetProperty(OUString const & _aName);
+ bool addNullProperty(rtl::OUString const & _aName, sal_Int16 _nFlags, uno::Type const & _aType);
+ bool addProperty(rtl::OUString const & _aName, sal_Int16 _nFlags, uno::Any const & _aValue);
+ bool resetProperty(rtl::OUString const & _aName);
bool finish();
void clear();
diff --git a/configmgr/source/backend/layerupdatehandler.cxx b/configmgr/source/backend/layerupdatehandler.cxx
index dcbf512bb6..99ffd0db88 100644
--- a/configmgr/source/backend/layerupdatehandler.cxx
+++ b/configmgr/source/backend/layerupdatehandler.cxx
@@ -42,7 +42,7 @@
#include <com/sun/star/beans/PropertyExistException.hpp>
// -----------------------------------------------------------------------------
-#define OUSTR( str ) OUString( RTL_CONSTASCII_USTRINGPARAM( str ) )
+#define OUSTR( str ) rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( str ) )
// -----------------------------------------------------------------------------
namespace configmgr
{
@@ -56,14 +56,14 @@ namespace configmgr
// -----------------------------------------------------------------------------
uno::Reference< uno::XInterface > SAL_CALL instantiateUpdateMerger
-( CreationContext const& xContext )
+( uno::Reference< uno::XComponentContext > const& xContext )
{
return * new LayerUpdateHandler( xContext );
}
// -----------------------------------------------------------------------------
-LayerUpdateHandler::LayerUpdateHandler(CreationArg _xContext)
+LayerUpdateHandler::LayerUpdateHandler(uno::Reference< uno::XComponentContext > const & _xContext)
: UpdateService(_xContext)
, m_aBuilder()
{
@@ -90,28 +90,28 @@ void LayerUpdateHandler::checkBuilder(bool _bForProperty)
void LayerUpdateHandler::raiseMalformedDataException(sal_Char const * pMsg)
{
- OUString sMsg = OUString::createFromAscii(pMsg);
+ rtl::OUString sMsg = rtl::OUString::createFromAscii(pMsg);
throw backenduno::MalformedDataException(sMsg,*this,uno::Any());
}
// -----------------------------------------------------------------------------
void LayerUpdateHandler::raiseNodeChangedBeforeException(sal_Char const * pMsg)
{
- OUString sMsg = OUString::createFromAscii(pMsg);
+ rtl::OUString sMsg = rtl::OUString::createFromAscii(pMsg);
throw backenduno::MalformedDataException(sMsg,*this,uno::Any());
}
// -----------------------------------------------------------------------------
void LayerUpdateHandler::raisePropChangedBeforeException(sal_Char const * pMsg)
{
- OUString sMsg = OUString::createFromAscii(pMsg);
+ rtl::OUString sMsg = rtl::OUString::createFromAscii(pMsg);
throw backenduno::MalformedDataException(sMsg,*this,uno::Any());
}
// -----------------------------------------------------------------------------
void LayerUpdateHandler::raisePropExistsException(sal_Char const * pMsg)
{
- OUString sMsg = OUString::createFromAscii(pMsg);
+ rtl::OUString sMsg = rtl::OUString::createFromAscii(pMsg);
com::sun::star::beans::PropertyExistException e(sMsg,*this);
throw backenduno::MalformedDataException(sMsg,*this, uno::makeAny(e));
@@ -121,7 +121,7 @@ void LayerUpdateHandler::raisePropExistsException(sal_Char const * pMsg)
// XUpdateHandler
void SAL_CALL
LayerUpdateHandler::startUpdate( )
- throw ( MalformedDataException, lang::IllegalAccessException,
+ throw ( backenduno::MalformedDataException, lang::IllegalAccessException,
lang::WrappedTargetException, uno::RuntimeException)
{
this->checkSourceLayer();
@@ -132,7 +132,7 @@ void SAL_CALL
void SAL_CALL
LayerUpdateHandler::endUpdate( )
- throw ( MalformedDataException, lang::IllegalAccessException,
+ throw ( backenduno::MalformedDataException, lang::IllegalAccessException,
lang::WrappedTargetException, uno::RuntimeException)
{
checkBuilder();
@@ -149,8 +149,8 @@ void SAL_CALL
// -----------------------------------------------------------------------------
void SAL_CALL
- LayerUpdateHandler::modifyNode( const OUString& aName, sal_Int16 aAttributes, sal_Int16 aAttributeMask, sal_Bool bReset )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
+ LayerUpdateHandler::modifyNode( const rtl::OUString& aName, sal_Int16 aAttributes, sal_Int16 aAttributeMask, sal_Bool bReset )
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
{
checkBuilder();
@@ -160,8 +160,8 @@ void SAL_CALL
// -----------------------------------------------------------------------------
void SAL_CALL
- LayerUpdateHandler::addOrReplaceNode( const OUString& aName, sal_Int16 aAttributes )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
+ LayerUpdateHandler::addOrReplaceNode( const rtl::OUString& aName, sal_Int16 aAttributes )
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
{
checkBuilder();
@@ -171,8 +171,8 @@ void SAL_CALL
// -----------------------------------------------------------------------------
void SAL_CALL
- LayerUpdateHandler::addOrReplaceNodeFromTemplate( const OUString& aName, sal_Int16 aAttributes, const TemplateIdentifier& aTemplate )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
+ LayerUpdateHandler::addOrReplaceNodeFromTemplate( const rtl::OUString& aName, sal_Int16 aAttributes, const backenduno::TemplateIdentifier& aTemplate )
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
{
checkBuilder();
@@ -183,7 +183,7 @@ void SAL_CALL
void SAL_CALL
LayerUpdateHandler::endNode( )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
{
checkBuilder();
@@ -199,8 +199,8 @@ void SAL_CALL
// -----------------------------------------------------------------------------
void SAL_CALL
- LayerUpdateHandler::removeNode( const OUString& aName )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
+ LayerUpdateHandler::removeNode( const rtl::OUString& aName )
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
{
checkBuilder();
@@ -210,8 +210,8 @@ void SAL_CALL
// -----------------------------------------------------------------------------
void SAL_CALL
- LayerUpdateHandler:: modifyProperty( const OUString& aName, sal_Int16 aAttributes, sal_Int16 aAttributeMask, const uno::Type & aType )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
+ LayerUpdateHandler:: modifyProperty( const rtl::OUString& aName, sal_Int16 aAttributes, sal_Int16 aAttributeMask, const uno::Type & aType )
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
{
checkBuilder(false);
@@ -222,7 +222,7 @@ void SAL_CALL
void SAL_CALL
LayerUpdateHandler:: setPropertyValue( const uno::Any& aValue )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
{
checkBuilder(true); // already checks for open property
@@ -231,8 +231,8 @@ void SAL_CALL
// -----------------------------------------------------------------------------
void SAL_CALL
- LayerUpdateHandler:: setPropertyValueForLocale( const uno::Any& aValue, const OUString& aLocale )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
+ LayerUpdateHandler:: setPropertyValueForLocale( const uno::Any& aValue, const rtl::OUString& aLocale )
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
{
checkBuilder(true); // already checks for open property
@@ -242,7 +242,7 @@ void SAL_CALL
void SAL_CALL
LayerUpdateHandler::resetPropertyValue( )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
{
checkBuilder(true); // already checks for open property
@@ -251,8 +251,8 @@ void SAL_CALL
// -----------------------------------------------------------------------------
void SAL_CALL
- LayerUpdateHandler::resetPropertyValueForLocale( const OUString& aLocale )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
+ LayerUpdateHandler::resetPropertyValueForLocale( const rtl::OUString& aLocale )
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
{
checkBuilder(true); // already checks for open property
@@ -262,7 +262,7 @@ void SAL_CALL
void SAL_CALL
LayerUpdateHandler::endProperty( )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
{
checkBuilder(true); // already checks for open property
@@ -271,8 +271,8 @@ void SAL_CALL
// -----------------------------------------------------------------------------
void SAL_CALL
- LayerUpdateHandler::resetProperty( const OUString& aName )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
+ LayerUpdateHandler::resetProperty( const rtl::OUString& aName )
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
{
if (!m_aBuilder.resetProperty(aName))
raisePropChangedBeforeException("LayerUpdateHandler: Cannot reset property - property has already been changed.");
@@ -280,8 +280,8 @@ void SAL_CALL
// -----------------------------------------------------------------------------
void SAL_CALL
- LayerUpdateHandler::addOrReplaceProperty( const OUString& aName, sal_Int16 aAttributes, const uno::Type& aType )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
+ LayerUpdateHandler::addOrReplaceProperty( const rtl::OUString& aName, sal_Int16 aAttributes, const uno::Type& aType )
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
{
if (!m_aBuilder.addNullProperty(aName,aAttributes,aType))
raisePropExistsException("LayerUpdateHandler: Cannot add property - property exists (and has already been changed).");
@@ -289,8 +289,8 @@ void SAL_CALL
// -----------------------------------------------------------------------------
void SAL_CALL
- LayerUpdateHandler::addOrReplacePropertyWithValue( const OUString& aName, sal_Int16 aAttributes, const uno::Any& aValue )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
+ LayerUpdateHandler::addOrReplacePropertyWithValue( const rtl::OUString& aName, sal_Int16 aAttributes, const uno::Any& aValue )
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
{
if (!m_aBuilder.addProperty(aName,aAttributes,aValue))
raisePropExistsException("LayerUpdateHandler: Cannot add property - property exists (and has already been changed).");
@@ -298,8 +298,8 @@ void SAL_CALL
// -----------------------------------------------------------------------------
void SAL_CALL
- LayerUpdateHandler::removeProperty( const OUString& aName )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
+ LayerUpdateHandler::removeProperty( const rtl::OUString& aName )
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
{
// treat 'remove' as 'reset'. (Note: does not verify that this actually amounts to dropping the property)
if (!m_aBuilder.resetProperty(aName))
diff --git a/configmgr/source/backend/layerupdatehandler.hxx b/configmgr/source/backend/layerupdatehandler.hxx
index 1baf037299..93bd4a30e5 100644
--- a/configmgr/source/backend/layerupdatehandler.hxx
+++ b/configmgr/source/backend/layerupdatehandler.hxx
@@ -31,6 +31,10 @@
#ifndef CONFIGMGR_BACKEND_LAYERUPDATEHANDLER_HXX
#define CONFIGMGR_BACKEND_LAYERUPDATEHANDLER_HXX
+#include "sal/config.h"
+
+#include "boost/utility.hpp"
+
#include "updatesvc.hxx"
#include "layerupdatebuilder.hxx"
#include "utility.hxx"
@@ -43,94 +47,90 @@ namespace configmgr
namespace backend
{
// -----------------------------------------------------------------------------
- using rtl::OUString;
namespace uno = ::com::sun::star::uno;
namespace lang = ::com::sun::star::lang;
namespace backenduno = ::com::sun::star::configuration::backend;
-
- using backenduno::TemplateIdentifier;
- using backenduno::MalformedDataException;
// -----------------------------------------------------------------------------
class LayerUpdateBuilder;
- class LayerUpdateHandler : public UpdateService , Noncopyable
+ class LayerUpdateHandler: private boost::noncopyable, public UpdateService
{
public:
explicit
- LayerUpdateHandler(CreationArg _xContext);
+ LayerUpdateHandler(uno::Reference< uno::XComponentContext > const & _xContext);
~LayerUpdateHandler();
// XUpdateHandler
virtual void SAL_CALL
startUpdate( )
- throw ( MalformedDataException, lang::IllegalAccessException,
+ throw ( backenduno::MalformedDataException, lang::IllegalAccessException,
lang::WrappedTargetException, uno::RuntimeException);
virtual void SAL_CALL
endUpdate( )
- throw ( MalformedDataException, lang::IllegalAccessException,
+ throw ( backenduno::MalformedDataException, lang::IllegalAccessException,
lang::WrappedTargetException, uno::RuntimeException);
virtual void SAL_CALL
- modifyNode( const OUString& aName, sal_Int16 aAttributes, sal_Int16 aAttributeMask, sal_Bool bReset )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
+ modifyNode( const rtl::OUString& aName, sal_Int16 aAttributes, sal_Int16 aAttributeMask, sal_Bool bReset )
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
virtual void SAL_CALL
- addOrReplaceNode( const OUString& aName, sal_Int16 aAttributes )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
+ addOrReplaceNode( const rtl::OUString& aName, sal_Int16 aAttributes )
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
virtual void SAL_CALL
- addOrReplaceNodeFromTemplate( const OUString& aName, sal_Int16 aAttributes, const TemplateIdentifier& aTemplate )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
+ addOrReplaceNodeFromTemplate( const rtl::OUString& aName, sal_Int16 aAttributes, const backenduno::TemplateIdentifier& aTemplate )
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
virtual void SAL_CALL
endNode( )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
virtual void SAL_CALL
- removeNode( const OUString& aName )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
+ removeNode( const rtl::OUString& aName )
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
virtual void SAL_CALL
- modifyProperty( const OUString& aName, sal_Int16 aAttributes, sal_Int16 aAttributeMask, const uno::Type& aType )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
+ modifyProperty( const rtl::OUString& aName, sal_Int16 aAttributes, sal_Int16 aAttributeMask, const uno::Type& aType )
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
virtual void SAL_CALL
setPropertyValue( const uno::Any& aValue )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
virtual void SAL_CALL
- setPropertyValueForLocale( const uno::Any& aValue, const OUString& aLocale )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
+ setPropertyValueForLocale( const uno::Any& aValue, const rtl::OUString& aLocale )
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
virtual void SAL_CALL
resetPropertyValue( )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
virtual void SAL_CALL
- resetPropertyValueForLocale( const OUString& aLocale )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
+ resetPropertyValueForLocale( const rtl::OUString& aLocale )
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
virtual void SAL_CALL
endProperty( )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
virtual void SAL_CALL
- resetProperty( const OUString& aName )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
+ resetProperty( const rtl::OUString& aName )
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
virtual void SAL_CALL
- addOrReplaceProperty( const OUString& aName, sal_Int16 aAttributes, const uno::Type& aType )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
+ addOrReplaceProperty( const rtl::OUString& aName, sal_Int16 aAttributes, const uno::Type& aType )
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
virtual void SAL_CALL
- addOrReplacePropertyWithValue( const OUString& aName, sal_Int16 aAttributes, const uno::Any& aValue )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
+ addOrReplacePropertyWithValue( const rtl::OUString& aName, sal_Int16 aAttributes, const uno::Any& aValue )
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
virtual void SAL_CALL
- removeProperty( const OUString& aName )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
+ removeProperty( const rtl::OUString& aName )
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
private:
LayerUpdateBuilder & getUpdateBuilder();
diff --git a/configmgr/source/backend/layerupdatemerger.cxx b/configmgr/source/backend/layerupdatemerger.cxx
index 4058f70164..c6bfcfc7f1 100644
--- a/configmgr/source/backend/layerupdatemerger.cxx
+++ b/configmgr/source/backend/layerupdatemerger.cxx
@@ -43,7 +43,7 @@ namespace configmgr
{
// -----------------------------------------------------------------------------
-LayerUpdateMerger::LayerUpdateMerger(LayerSource const & _xSourceLayer, LayerUpdate const & _aLayerUpdate)
+LayerUpdateMerger::LayerUpdateMerger(uno::Reference< backenduno::XLayer > const & _xSourceLayer, LayerUpdate const & _aLayerUpdate)
: BasicUpdateMerger(_xSourceLayer)
, m_aLayerUpdate(_aLayerUpdate)
, m_xCurrentNode()
@@ -70,7 +70,7 @@ void LayerUpdateMerger::flushUpdate()
// -----------------------------------------------------------------------------
void SAL_CALL LayerUpdateMerger::startLayer( )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
{
BasicUpdateMerger::startLayer();
@@ -81,7 +81,7 @@ void SAL_CALL LayerUpdateMerger::startLayer( )
// -----------------------------------------------------------------------------
void SAL_CALL LayerUpdateMerger::endLayer( )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
{
BasicUpdateMerger::endLayer();
@@ -89,8 +89,8 @@ void SAL_CALL LayerUpdateMerger::endLayer( )
}
// -----------------------------------------------------------------------------
-void SAL_CALL LayerUpdateMerger::overrideNode( const OUString& aName, sal_Int16 aAttributes, sal_Bool bClear )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
+void SAL_CALL LayerUpdateMerger::overrideNode( const rtl::OUString& aName, sal_Int16 aAttributes, sal_Bool bClear )
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
{
if (BasicUpdateMerger::isHandling())
{
@@ -100,7 +100,7 @@ void SAL_CALL LayerUpdateMerger::overrideNode( const OUString& aName, sal_Int16
OSL_ASSERT(m_xCurrentNode.is());
- ElementUpdateRef xUpdate = m_xCurrentNode->getNodeByName(aName);
+ rtl::Reference<ElementUpdate> xUpdate = m_xCurrentNode->getNodeByName(aName);
if (!xUpdate.is())
{
BasicUpdateMerger::overrideNode(aName, aAttributes, bClear);
@@ -122,8 +122,8 @@ void SAL_CALL LayerUpdateMerger::overrideNode( const OUString& aName, sal_Int16
}
// -----------------------------------------------------------------------------
-void SAL_CALL LayerUpdateMerger::addOrReplaceNode( const OUString& aName, sal_Int16 aAttributes )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
+void SAL_CALL LayerUpdateMerger::addOrReplaceNode( const rtl::OUString& aName, sal_Int16 aAttributes )
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
{
if (BasicUpdateMerger::isHandling())
{
@@ -133,7 +133,7 @@ void SAL_CALL LayerUpdateMerger::addOrReplaceNode( const OUString& aName, sal_In
OSL_ASSERT(m_xCurrentNode.is());
- ElementUpdateRef xUpdate = m_xCurrentNode->getNodeByName(aName);
+ rtl::Reference<ElementUpdate> xUpdate = m_xCurrentNode->getNodeByName(aName);
if (!xUpdate.is())
{
BasicUpdateMerger::addOrReplaceNode(aName, aAttributes);
@@ -155,8 +155,8 @@ void SAL_CALL LayerUpdateMerger::addOrReplaceNode( const OUString& aName, sal_In
}
// -----------------------------------------------------------------------------
-void SAL_CALL LayerUpdateMerger::addOrReplaceNodeFromTemplate( const OUString& aName, const TemplateIdentifier& aTemplate, sal_Int16 aAttributes )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
+void SAL_CALL LayerUpdateMerger::addOrReplaceNodeFromTemplate( const rtl::OUString& aName, const backenduno::TemplateIdentifier& aTemplate, sal_Int16 aAttributes )
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
{
if (BasicUpdateMerger::isHandling())
{
@@ -166,7 +166,7 @@ void SAL_CALL LayerUpdateMerger::addOrReplaceNodeFromTemplate( const OUString& a
OSL_ASSERT(m_xCurrentNode.is());
- ElementUpdateRef xUpdate = m_xCurrentNode->getNodeByName(aName);
+ rtl::Reference<ElementUpdate> xUpdate = m_xCurrentNode->getNodeByName(aName);
if (!xUpdate.is())
{
BasicUpdateMerger::addOrReplaceNodeFromTemplate(aName, aTemplate, aAttributes);
@@ -189,7 +189,7 @@ void SAL_CALL LayerUpdateMerger::addOrReplaceNodeFromTemplate( const OUString& a
// -----------------------------------------------------------------------------
void SAL_CALL LayerUpdateMerger::endNode( )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
{
if (BasicUpdateMerger::isHandling())
{
@@ -202,7 +202,7 @@ void SAL_CALL LayerUpdateMerger::endNode( )
// write unhandled so far changes
m_xCurrentNode->writeChildrenToLayer( getResultWriter().get() );
- NodeUpdateRef xParent( m_xCurrentNode->getParent() );
+ rtl::Reference<NodeUpdate> xParent( m_xCurrentNode->getParent() );
if (xParent.is())
getResultWriter()->endNode();
@@ -214,8 +214,8 @@ void SAL_CALL LayerUpdateMerger::endNode( )
}
// -----------------------------------------------------------------------------
-void SAL_CALL LayerUpdateMerger::dropNode( const OUString& aName )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
+void SAL_CALL LayerUpdateMerger::dropNode( const rtl::OUString& aName )
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
{
if (BasicUpdateMerger::isHandling())
{
@@ -225,7 +225,7 @@ void SAL_CALL LayerUpdateMerger::dropNode( const OUString& aName )
OSL_ASSERT(m_xCurrentNode.is());
- ElementUpdateRef xUpdate = m_xCurrentNode->getNodeByName(aName);
+ rtl::Reference<ElementUpdate> xUpdate = m_xCurrentNode->getNodeByName(aName);
if (xUpdate.is())
{
m_xCurrentNode->removeNodeByName(aName);
@@ -248,8 +248,8 @@ void SAL_CALL LayerUpdateMerger::dropNode( const OUString& aName )
}
// -----------------------------------------------------------------------------
-void SAL_CALL LayerUpdateMerger::overrideProperty( const OUString& aName, sal_Int16 aAttributes, const uno::Type& aType, sal_Bool bClear )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
+void SAL_CALL LayerUpdateMerger::overrideProperty( const rtl::OUString& aName, sal_Int16 aAttributes, const uno::Type& aType, sal_Bool bClear )
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
{
if (BasicUpdateMerger::isHandling())
{
@@ -259,7 +259,7 @@ void SAL_CALL LayerUpdateMerger::overrideProperty( const OUString& aName, sal_In
OSL_ASSERT( m_xCurrentNode.is());
- ElementUpdateRef xUpdate = m_xCurrentNode->getPropertyByName(aName);
+ rtl::Reference<ElementUpdate> xUpdate = m_xCurrentNode->getPropertyByName(aName);
if (!xUpdate.is())
{
BasicUpdateMerger::overrideProperty(aName, aAttributes, aType, bClear);
@@ -288,7 +288,7 @@ void SAL_CALL LayerUpdateMerger::overrideProperty( const OUString& aName, sal_In
// -----------------------------------------------------------------------------
void SAL_CALL LayerUpdateMerger::endProperty( )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
{
if (BasicUpdateMerger::isHandling())
{
@@ -300,8 +300,8 @@ void SAL_CALL LayerUpdateMerger::endProperty( )
if (!m_xCurrentProp.is())
{
- OUString sMsg( RTL_CONSTASCII_USTRINGPARAM("LayerUpdateMerger: Invalid data: Ending property that wasn't started.") );
- throw MalformedDataException( sMsg, *this, uno::Any() );
+ rtl::OUString sMsg( RTL_CONSTASCII_USTRINGPARAM("LayerUpdateMerger: Invalid data: Ending property that wasn't started.") );
+ throw backenduno::MalformedDataException( sMsg, *this, uno::Any() );
}
// write unhandled so far values
@@ -314,7 +314,7 @@ void SAL_CALL LayerUpdateMerger::endProperty( )
// -----------------------------------------------------------------------------
void SAL_CALL LayerUpdateMerger::setPropertyValue( const uno::Any& aValue )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
{
if (BasicUpdateMerger::isHandling())
{
@@ -326,8 +326,8 @@ void SAL_CALL LayerUpdateMerger::setPropertyValue( const uno::Any& aValue )
if (!m_xCurrentProp.is())
{
- OUString sMsg( RTL_CONSTASCII_USTRINGPARAM("LayerUpdateMerger: Invalid data: setting value, but no property is started.") );
- throw MalformedDataException( sMsg, *this, uno::Any() );
+ rtl::OUString sMsg( RTL_CONSTASCII_USTRINGPARAM("LayerUpdateMerger: Invalid data: setting value, but no property is started.") );
+ throw backenduno::MalformedDataException( sMsg, *this, uno::Any() );
}
if (!m_xCurrentProp->hasChange())
@@ -353,8 +353,8 @@ void SAL_CALL LayerUpdateMerger::setPropertyValue( const uno::Any& aValue )
}
// -----------------------------------------------------------------------------
-void SAL_CALL LayerUpdateMerger::setPropertyValueForLocale( const uno::Any& aValue, const OUString & aLocale )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
+void SAL_CALL LayerUpdateMerger::setPropertyValueForLocale( const uno::Any& aValue, const rtl::OUString & aLocale )
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
{
if (BasicUpdateMerger::isHandling())
{
@@ -366,8 +366,8 @@ void SAL_CALL LayerUpdateMerger::setPropertyValueForLocale( const uno::Any& aVal
if (!m_xCurrentProp.is())
{
- OUString sMsg( RTL_CONSTASCII_USTRINGPARAM("LayerUpdateMerger: Invalid data: setting value, but no property is started.") );
- throw MalformedDataException( sMsg, *this, uno::Any() );
+ rtl::OUString sMsg( RTL_CONSTASCII_USTRINGPARAM("LayerUpdateMerger: Invalid data: setting value, but no property is started.") );
+ throw backenduno::MalformedDataException( sMsg, *this, uno::Any() );
}
if (!m_xCurrentProp->hasChangeFor(aLocale))
@@ -393,8 +393,8 @@ void SAL_CALL LayerUpdateMerger::setPropertyValueForLocale( const uno::Any& aVal
}
// -----------------------------------------------------------------------------
-void SAL_CALL LayerUpdateMerger::addProperty( const OUString& aName, sal_Int16 aAttributes, const uno::Type& aType )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
+void SAL_CALL LayerUpdateMerger::addProperty( const rtl::OUString& aName, sal_Int16 aAttributes, const uno::Type& aType )
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
{
if (BasicUpdateMerger::isHandling())
{
@@ -403,7 +403,7 @@ void SAL_CALL LayerUpdateMerger::addProperty( const OUString& aName, sal_Int16 a
}
OSL_ASSERT( m_xCurrentNode.is());
- ElementUpdateRef xUpdate = m_xCurrentNode->getPropertyByName(aName);
+ rtl::Reference<ElementUpdate> xUpdate = m_xCurrentNode->getPropertyByName(aName);
if (!xUpdate.is())
{
BasicUpdateMerger::addProperty(aName, aAttributes, aType);
@@ -442,8 +442,8 @@ void SAL_CALL LayerUpdateMerger::addProperty( const OUString& aName, sal_Int16 a
}
// -----------------------------------------------------------------------------
-void SAL_CALL LayerUpdateMerger::addPropertyWithValue( const OUString& aName, sal_Int16 aAttributes, const uno::Any& aValue )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
+void SAL_CALL LayerUpdateMerger::addPropertyWithValue( const rtl::OUString& aName, sal_Int16 aAttributes, const uno::Any& aValue )
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
{
if (BasicUpdateMerger::isHandling())
{
@@ -452,7 +452,7 @@ void SAL_CALL LayerUpdateMerger::addPropertyWithValue( const OUString& aName, sa
}
OSL_ASSERT( m_xCurrentNode.is());
- ElementUpdateRef xUpdate = m_xCurrentNode->getPropertyByName(aName);
+ rtl::Reference<ElementUpdate> xUpdate = m_xCurrentNode->getPropertyByName(aName);
if (!xUpdate.is())
{
BasicUpdateMerger::addPropertyWithValue(aName, aAttributes, aValue);
diff --git a/configmgr/source/backend/layerupdatemerger.hxx b/configmgr/source/backend/layerupdatemerger.hxx
index 6097eb4e9c..751c5b7274 100644
--- a/configmgr/source/backend/layerupdatemerger.hxx
+++ b/configmgr/source/backend/layerupdatemerger.hxx
@@ -42,22 +42,18 @@ namespace configmgr
namespace backend
{
// -----------------------------------------------------------------------------
- using rtl::OUString;
-// -----------------------------------------------------------------------------
class NodeUpdate;
class PropertyUpdate;
- typedef rtl::Reference<NodeUpdate> NodeUpdateRef;
- typedef rtl::Reference<PropertyUpdate> PropertyUpdateRef;
class LayerUpdateMerger : protected BasicUpdateMerger
{
public:
- static LayerSource getMergedLayer(LayerSource const & _xSourceLayer, LayerUpdate const & _aLayerUpdate)
+ static uno::Reference< backenduno::XLayer > getMergedLayer(uno::Reference< backenduno::XLayer > const & _xSourceLayer, LayerUpdate const & _aLayerUpdate)
{ return new LayerUpdateMerger(_xSourceLayer, _aLayerUpdate); }
public:
explicit
- LayerUpdateMerger( LayerSource const & _xSourceLayer, LayerUpdate const & _aLayerUpdate);
+ LayerUpdateMerger( uno::Reference< backenduno::XLayer > const & _xSourceLayer, LayerUpdate const & _aLayerUpdate);
~LayerUpdateMerger();
@@ -66,55 +62,55 @@ namespace configmgr
protected:
virtual void SAL_CALL
startLayer( )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
virtual void SAL_CALL
endLayer( )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
virtual void SAL_CALL
- overrideNode( const OUString& aName, sal_Int16 aAttributes, sal_Bool bClear )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
+ overrideNode( const rtl::OUString& aName, sal_Int16 aAttributes, sal_Bool bClear )
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
virtual void SAL_CALL
- addOrReplaceNode( const OUString& aName, sal_Int16 aAttributes )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
+ addOrReplaceNode( const rtl::OUString& aName, sal_Int16 aAttributes )
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
virtual void SAL_CALL
- addOrReplaceNodeFromTemplate( const OUString& aName, const TemplateIdentifier& aTemplate, sal_Int16 aAttributes )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
+ addOrReplaceNodeFromTemplate( const rtl::OUString& aName, const backenduno::TemplateIdentifier& aTemplate, sal_Int16 aAttributes )
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
virtual void SAL_CALL
endNode( )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
virtual void SAL_CALL
- dropNode( const OUString& aName )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
+ dropNode( const rtl::OUString& aName )
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
virtual void SAL_CALL
- overrideProperty( const OUString& aName, sal_Int16 aAttributes, const uno::Type& aType, sal_Bool bClear )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
+ overrideProperty( const rtl::OUString& aName, sal_Int16 aAttributes, const uno::Type& aType, sal_Bool bClear )
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
virtual void SAL_CALL
endProperty( )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
virtual void SAL_CALL
setPropertyValue( const uno::Any& aValue )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
virtual void SAL_CALL
- setPropertyValueForLocale( const uno::Any& aValue, const OUString & aLocale )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
+ setPropertyValueForLocale( const uno::Any& aValue, const rtl::OUString & aLocale )
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
virtual void SAL_CALL
- addProperty( const OUString& aName, sal_Int16 aAttributes, const uno::Type& aType )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
+ addProperty( const rtl::OUString& aName, sal_Int16 aAttributes, const uno::Type& aType )
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
virtual void SAL_CALL
- addPropertyWithValue( const OUString& aName, sal_Int16 aAttributes, const uno::Any& aValue )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
+ addPropertyWithValue( const rtl::OUString& aName, sal_Int16 aAttributes, const uno::Any& aValue )
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
// BasicUpdateMerger
virtual void flushUpdate();
@@ -122,8 +118,8 @@ namespace configmgr
void malformedUpdate(sal_Char const * pMsg);
private:
LayerUpdate m_aLayerUpdate;
- NodeUpdateRef m_xCurrentNode;
- PropertyUpdateRef m_xCurrentProp;
+ rtl::Reference<NodeUpdate> m_xCurrentNode;
+ rtl::Reference<PropertyUpdate> m_xCurrentProp;
};
// -----------------------------------------------------------------------------
} // namespace xml
diff --git a/configmgr/source/backend/mergedcomponentdata.cxx b/configmgr/source/backend/mergedcomponentdata.cxx
index 9720d6aa6f..bc3604fd0f 100644
--- a/configmgr/source/backend/mergedcomponentdata.cxx
+++ b/configmgr/source/backend/mergedcomponentdata.cxx
@@ -75,13 +75,13 @@ bool MergedComponentData::hasTemplates() const
}
// -----------------------------------------------------------------------------
-OUString MergedComponentData::getTemplateAccessor (TemplateIdentifier const & _aTemplateName) const
+rtl::OUString MergedComponentData::getTemplateAccessor (backenduno::TemplateIdentifier const & _aTemplateName) const
{
return _aTemplateName.Name;
}
// -----------------------------------------------------------------------------
-bool MergedComponentData::hasTemplate(OUString const & _aTemplateName) const
+bool MergedComponentData::hasTemplate(rtl::OUString const & _aTemplateName) const
{
return m_pTemplatesTree.get() != NULL &&
m_pTemplatesTree->getChild( _aTemplateName ) != NULL;
@@ -100,7 +100,7 @@ std::auto_ptr<ISubtree> MergedComponentData::extractTemplatesTree()
}
// -----------------------------------------------------------------------------
-std::auto_ptr<INode> MergedComponentData::extractTemplateNode(OUString const & _aTemplateName)
+std::auto_ptr<INode> MergedComponentData::extractTemplateNode(rtl::OUString const & _aTemplateName)
{
if (m_pTemplatesTree.get() == NULL)
return std::auto_ptr<INode>();
@@ -109,7 +109,7 @@ std::auto_ptr<INode> MergedComponentData::extractTemplateNode(OUString const & _
}
// -----------------------------------------------------------------------------
-ISubtree const * MergedComponentData::findTemplate(OUString const & _aTemplateName) const
+ISubtree const * MergedComponentData::findTemplate(rtl::OUString const & _aTemplateName) const
{
INode const * pTemplateNode = m_pTemplatesTree->getChild(_aTemplateName);
@@ -121,7 +121,7 @@ ISubtree const * MergedComponentData::findTemplate(OUString const & _aTemplateNa
}
// -----------------------------------------------------------------------------
-std::auto_ptr<INode> MergedComponentData::instantiateTemplate(OUString const & _aName, OUString const & _aTemplateName) const
+std::auto_ptr<INode> MergedComponentData::instantiateTemplate(rtl::OUString const & _aName, rtl::OUString const & _aTemplateName) const
{
if (INode const * pTemplateNode = m_pTemplatesTree->getChild(_aTemplateName))
{
@@ -152,7 +152,7 @@ void MergedComponentData::setTemplatesTree(std::auto_ptr<ISubtree> _aTemplateT
m_pTemplatesTree = _aTemplateTree;
}
// -----------------------------------------------------------------------------
-ISubtree * MergedComponentData::addTemplate(std::auto_ptr<ISubtree> _aNode, TemplateIdentifier const & aTemplate)
+ISubtree * MergedComponentData::addTemplate(std::auto_ptr<ISubtree> _aNode, backenduno::TemplateIdentifier const & aTemplate)
{
OSL_PRECOND(_aNode.get(), "ERROR: Adding a NULL template");
diff --git a/configmgr/source/backend/mergedcomponentdata.hxx b/configmgr/source/backend/mergedcomponentdata.hxx
index 8c8a11eef2..6cda735aea 100644
--- a/configmgr/source/backend/mergedcomponentdata.hxx
+++ b/configmgr/source/backend/mergedcomponentdata.hxx
@@ -52,10 +52,6 @@ namespace configmgr
// -----------------------------------------------------------------------------
namespace backenduno = ::com::sun::star::configuration::backend;
- using backenduno::TemplateIdentifier;
-
- using ::rtl::OUString;
-
// -----------------------------------------------------------------------------
class MergedComponentData
@@ -66,28 +62,28 @@ namespace configmgr
bool hasSchema() const;
bool hasTemplates() const;
- bool hasTemplate(OUString const & _aTemplateName) const;
+ bool hasTemplate(rtl::OUString const & _aTemplateName) const;
- OUString getTemplateAccessor (TemplateIdentifier const & _aTemplateName) const;
+ rtl::OUString getTemplateAccessor (backenduno::TemplateIdentifier const & _aTemplateName) const;
ISubtree const * getSchemaTree() const { return m_pSchemaTree.get(); }
ISubtree const * getTemplatesTree() const { return m_pTemplatesTree.get(); }
- ISubtree const * findTemplate(OUString const & _aTemplateName) const;
+ ISubtree const * findTemplate(rtl::OUString const & _aTemplateName) const;
ISubtree * getSchemaTree() { return m_pSchemaTree.get(); }
ISubtree * getTemplatesTree() { return m_pTemplatesTree.get(); }
- std::auto_ptr<INode> instantiateTemplate(OUString const & _aName, OUString const & _aTemplateName) const;
+ std::auto_ptr<INode> instantiateTemplate(rtl::OUString const & _aName, rtl::OUString const & _aTemplateName) const;
void clear();
ISubtree * setSchemaRoot(std::auto_ptr<ISubtree> _aSchemaRoot);
- ISubtree * addTemplate(std::auto_ptr<ISubtree> _aNode, TemplateIdentifier const & aTemplate);
+ ISubtree * addTemplate(std::auto_ptr<ISubtree> _aNode, backenduno::TemplateIdentifier const & aTemplate);
void setTemplatesTree(std::auto_ptr<ISubtree> _aTemplateTree);
std::auto_ptr<ISubtree> extractSchemaTree();
std::auto_ptr<ISubtree> extractTemplatesTree();
- std::auto_ptr<INode> extractTemplateNode(OUString const & _aTemplateName);
+ std::auto_ptr<INode> extractTemplateNode(rtl::OUString const & _aTemplateName);
private:
std::auto_ptr<ISubtree> m_pSchemaTree;
std::auto_ptr<ISubtree> m_pTemplatesTree;
diff --git a/configmgr/source/backend/multistratumbackend.cxx b/configmgr/source/backend/multistratumbackend.cxx
index 3b52c41059..3bc3169a32 100644
--- a/configmgr/source/backend/multistratumbackend.cxx
+++ b/configmgr/source/backend/multistratumbackend.cxx
@@ -98,10 +98,8 @@ bool checkOptionalArg(rtl::OUString& aArg)
}
}
//------------------------------------------------------------------------------
-typedef std::pair<rtl::OUString, rtl::OUString> ServiceInfo;
-typedef std::vector<ServiceInfo> ServiceInfoList;
void parseStrataInfo(const rtl::OUString aServiceList,
- ServiceInfoList& aServiceInfoList,
+ std::vector< std::pair<rtl::OUString, rtl::OUString> >& aServiceInfoList,
const uno::Reference<uno::XInterface>& pContext)
{
sal_Int32 nNextToken =0;
@@ -109,7 +107,7 @@ void parseStrataInfo(const rtl::OUString aServiceList,
do
{
- OUString aServiceName =aServiceList.getToken(0, ':',nNextToken);
+ rtl::OUString aServiceName =aServiceList.getToken(0, ':',nNextToken);
if((nNextToken ==-1)||(aServiceName.getLength()==0))
{
throw backenduno::BackendSetupException(
@@ -117,9 +115,9 @@ void parseStrataInfo(const rtl::OUString aServiceList,
"Malformed Strata Service specified")),
pContext, uno::Any()) ;
}
- OUString aServiceData = aServiceList.getToken(0, ';',nNextToken);
+ rtl::OUString aServiceData = aServiceList.getToken(0, ';',nNextToken);
- ServiceInfo aServiceInfo(aServiceName,aServiceData);
+ std::pair<rtl::OUString, rtl::OUString> aServiceInfo(aServiceName,aServiceData);
aServiceInfoList.push_back(aServiceInfo);
}
while (nNextToken >= 0 && nNextToken < nLength ) ;
@@ -127,7 +125,7 @@ void parseStrataInfo(const rtl::OUString aServiceList,
//------------------------------------------------------------------------------
MultiStratumBackend::MultiStratumBackend(
const uno::Reference<uno::XComponentContext>& xContext)
- : BackendBase(mMutex), mFactory(xContext->getServiceManager(),uno::UNO_QUERY_THROW)
+ : cppu::WeakComponentImplHelper7< backenduno::XBackend, backenduno::XBackendEntities, backenduno::XVersionedSchemaSupplier, backenduno::XBackendChangesNotifier, backenduno::XBackendChangesListener, lang::XInitialization, lang::XServiceInfo >(mMutex), mFactory(xContext->getServiceManager(),uno::UNO_QUERY_THROW)
,mListenerList()
{
@@ -189,7 +187,7 @@ void SAL_CALL MultiStratumBackend::initialize(
if (bAdminMode)
{
// find given entity
- OUString sDefaultEntity;
+ rtl::OUString sDefaultEntity;
if ( (context->getValueByName(kEntity) >>= sDefaultEntity) && sDefaultEntity.getLength() )
{
for (sal_uInt32 i = 0; i < mBackendStrata.size(); i++)
@@ -235,16 +233,15 @@ void SAL_CALL MultiStratumBackend::initialize(
}
//------------------------------------------------------------------------------
-typedef uno::Reference<backenduno::XSchemaSupplier> SchemaSupplier;
void MultiStratumBackend::initializeSchemaSupplier(const uno::Reference<uno::XComponentContext>& aContext)
{
- OUString aServiceName;
+ rtl::OUString aServiceName;
aContext->getValueByName(kSchemaServiceParam) >>= aServiceName;
uno::Sequence< uno::Any > aInitArgs( 1 );
aInitArgs[0] <<= aContext;
- mSchemaSupplier = SchemaSupplier::query(mFactory->createInstanceWithArguments(aServiceName,aInitArgs)) ;
+ mSchemaSupplier = uno::Reference<backenduno::XSchemaSupplier>::query(mFactory->createInstanceWithArguments(aServiceName,aInitArgs)) ;
if (!mSchemaSupplier.is())
{
throw backenduno::BackendSetupException(
@@ -258,18 +255,16 @@ void MultiStratumBackend::initializeSchemaSupplier(const uno::Reference<uno::XC
static
bool approveRecovery(const backenduno::StratumCreationException & aError)
{
- using namespace apihelper;
- typedef SimpleInteractionRequest::Continuation Choice;
- Choice const k_supported_choices = CONTINUATION_APPROVE ; //| CONTINUATION_DISAPPROVE;
+ sal_uInt32 const k_supported_choices = apihelper::CONTINUATION_APPROVE ; //| apihelper::CONTINUATION_DISAPPROVE;
- Choice chosen = CONTINUATION_UNKNOWN;
+ sal_uInt32 chosen = apihelper::CONTINUATION_UNKNOWN;
- ConfigurationInteractionHandler handler;
+ apihelper::ConfigurationInteractionHandler handler;
try {
uno::Reference< css::task::XInteractionHandler > h(handler.get());
if (h.is()) {
- rtl::Reference< SimpleInteractionRequest > req(
- new SimpleInteractionRequest(
+ rtl::Reference< apihelper::SimpleInteractionRequest > req(
+ new apihelper::SimpleInteractionRequest(
uno::makeAny(aError), k_supported_choices));
h->handle(req.get());
chosen = req->getResponse();
@@ -280,9 +275,9 @@ bool approveRecovery(const backenduno::StratumCreationException & aError)
switch (chosen)
{
- case CONTINUATION_APPROVE: return true;
- case CONTINUATION_DISAPPROVE: return false;
- case CONTINUATION_UNKNOWN: break;
+ case apihelper::CONTINUATION_APPROVE: return true;
+ case apihelper::CONTINUATION_DISAPPROVE: return false;
+ case apihelper::CONTINUATION_UNKNOWN: break;
default: OSL_ENSURE(false,"Unsolicited continuation chosen"); break;
}
@@ -293,7 +288,7 @@ bool approveRecovery(const backenduno::StratumCreationException & aError)
void MultiStratumBackend::initializeBackendStrata(const uno::Reference<uno::XComponentContext>& aContext)
{
- OUString sStrata;
+ rtl::OUString sStrata;
//Get Strata
aContext->getValueByName(kStrataServiceParam) >>= sStrata;
if(sStrata.getLength()==0)
@@ -306,14 +301,14 @@ void MultiStratumBackend::initializeBackendStrata(const uno::Reference<uno::XCom
}
//need to parse the Strata to extract service names and data location
- ServiceInfoList aServiceInfoList;
+ std::vector< std::pair<rtl::OUString, rtl::OUString> > aServiceInfoList;
parseStrataInfo(sStrata,aServiceInfoList,*this);
- for (ServiceInfoList::const_iterator it = aServiceInfoList.begin(); it != aServiceInfoList.end(); ++it)
+ for (std::vector< std::pair<rtl::OUString, rtl::OUString> >::const_iterator it = aServiceInfoList.begin(); it != aServiceInfoList.end(); ++it)
{
uno::Sequence< uno::Any > aInitArgs( 1 );
- OUString sServiceName = it->first;
- const OUString& sServiceData = it->second;
+ rtl::OUString sServiceName = it->first;
+ const rtl::OUString& sServiceData = it->second;
aInitArgs[0] <<= sServiceData;
uno::Reference <uno::XInterface> xBackend;
bool bOptional = checkOptionalArg(sServiceName);
@@ -327,8 +322,8 @@ void MultiStratumBackend::initializeBackendStrata(const uno::Reference<uno::XCom
if(!bOptional)
{
static const sal_Char sErrContext[] = "MultiStratumBackend: Could not create Backend Stratum Service: ";
- OUString const sContext(RTL_CONSTASCII_USTRINGPARAM(sErrContext));
- OUString const sMessage = sContext.concat(exception.Message);
+ rtl::OUString const sContext(RTL_CONSTASCII_USTRINGPARAM(sErrContext));
+ rtl::OUString const sMessage = sContext.concat(exception.Message);
backenduno::StratumCreationException error(sMessage,*this,
::cppu::getCaughtException(),
@@ -355,7 +350,7 @@ rtl::OUString SAL_CALL
{
return mOwnerEntity;
}
- return OUString();
+ return rtl::OUString();
}
//------------------------------------------------------------------------------
@@ -373,10 +368,10 @@ rtl::OUString SAL_CALL
}
else
{
- return OUString();
+ return rtl::OUString();
}
}
- return OUString();
+ return rtl::OUString();
}
//------------------------------------------------------------------------------
@@ -388,7 +383,7 @@ sal_Bool SAL_CALL
osl::MutexGuard aGuard(mMutex);
if (checkOkState())
{
- for (BackendStrata::const_iterator it = mBackendStrata.begin(); it != mBackendStrata.end(); ++it)
+ for (std::vector< uno::Reference <uno::XInterface> >::const_iterator it = mBackendStrata.begin(); it != mBackendStrata.end(); ++it)
{
uno::Reference< backenduno::XBackendEntities > xEntities( *it, uno::UNO_QUERY );
if (xEntities.is())
@@ -433,7 +428,7 @@ sal_Bool SAL_CALL
if (checkOkState())
{
- for (BackendStrata::const_iterator it = mBackendStrata.begin(); it != mBackendStrata.end(); ++it)
+ for (std::vector< uno::Reference <uno::XInterface> >::const_iterator it = mBackendStrata.begin(); it != mBackendStrata.end(); ++it)
{
uno::Reference< backenduno::XBackendEntities > xEntities( *it, uno::UNO_QUERY );
if (xEntities.is())
@@ -535,7 +530,7 @@ uno::Sequence<uno::Reference<backenduno::XLayer> > SAL_CALL
sal_Int32 MultiStratumBackend::findSupportingStratum(const rtl::OUString& aEntity)
{
sal_Int32 nNumLayers = mBackendStrata.size();
- for (BackendStrata::reverse_iterator it = mBackendStrata.rbegin(); it != mBackendStrata.rend(); ++it)
+ for (std::vector< uno::Reference <uno::XInterface> >::reverse_iterator it = mBackendStrata.rbegin(); it != mBackendStrata.rend(); ++it)
{
uno::Reference< backenduno::XBackendEntities > xEntities( *it, uno::UNO_QUERY );
if (xEntities.is())
@@ -554,14 +549,13 @@ sal_Int32 MultiStratumBackend::findSupportingStratum(const rtl::OUString& aEntit
*this, 0) ;
}
//------------------------------------------------------------------------------
-typedef std::vector<uno::Reference<backenduno::XLayer> > BackendLayers;
uno::Sequence<uno::Reference<backenduno::XLayer> >
MultiStratumBackend::searchSupportingStrata(sal_Int32 nNumLayers,
rtl::OUString aEntity,
const rtl::OUString& aComponent)
{
uno::Sequence<uno::Reference<backenduno::XLayer> > aLayers;
- BackendLayers aBackendLayers;
+ std::vector<uno::Reference<backenduno::XLayer> > aBackendLayers;
for (sal_Int32 i = 0 ; i < nNumLayers ; ++ i)
{
uno::Sequence<uno::Reference<backenduno::XLayer> > aMultiLayers;
@@ -616,7 +610,7 @@ uno::Sequence<uno::Reference<backenduno::XLayer> >
mBackendStrata[i], uno::UNO_REF_QUERY_THROW) ;
if (xSingleLayerStratum.is())
{
- uno::Reference<backenduno::XLayer> xLayer = xSingleLayerStratum->getLayer( aComponent, OUString());
+ uno::Reference<backenduno::XLayer> xLayer = xSingleLayerStratum->getLayer( aComponent, rtl::OUString());
//Could be an empty layer
if (xLayer.is())
{
@@ -658,7 +652,7 @@ uno::Reference<backenduno::XUpdateHandler> SAL_CALL
{
sal_Int32 nNumSupportedLayers = mBackendStrata.size();
- OUString aUsedEntity;
+ rtl::OUString aUsedEntity;
if(aEntity != mOwnerEntity)
{
@@ -765,7 +759,7 @@ void SAL_CALL MultiStratumBackend::disposing()
}
if (!mBackendStrata.empty())
{
- for (BackendStrata::const_iterator it = mBackendStrata.begin(); it != mBackendStrata.end(); ++it)
+ for (std::vector< uno::Reference <uno::XInterface> >::const_iterator it = mBackendStrata.begin(); it != mBackendStrata.end(); ++it)
{
uno::Reference< lang::XComponent> xComp( *it, uno::UNO_QUERY );
if (xComp.is())
@@ -789,7 +783,7 @@ static const sal_Char * const kBackendService = "com.sun.star.configuration.back
static const sal_Char * const kImplementation =
"com.sun.star.comp.configuration.backend.MultiStratumBackend" ;
-static const AsciiServiceName kServiceNames [] =
+static sal_Char const * const kServiceNames [] =
{
kBackendService,
0
@@ -807,7 +801,7 @@ const ServiceRegistrationInfo *getMultiStratumBackendServiceInfo()
}
uno::Reference<uno::XInterface> SAL_CALL
- instantiateMultiStratumBackend(const CreationContext& xContext)
+ instantiateMultiStratumBackend(const uno::Reference< uno::XComponentContext >& xContext)
{
return *new MultiStratumBackend(xContext) ;
}
@@ -917,7 +911,7 @@ void MultiStratumBackend::notifyListeners(const backenduno::ComponentChangeEvent
{
//fire off notification to all registered listeners for specific Component
ListenerList::const_iterator aIter;
- OUString aComponentName = aEvent.Component;
+ rtl::OUString aComponentName = aEvent.Component;
if (mListenerList.empty())
{
OSL_TRACE("MultiStratumBackend: notifyListeners: no listeners registered for component %s",
diff --git a/configmgr/source/backend/multistratumbackend.hxx b/configmgr/source/backend/multistratumbackend.hxx
index 339d2f586d..00865ea664 100644
--- a/configmgr/source/backend/multistratumbackend.hxx
+++ b/configmgr/source/backend/multistratumbackend.hxx
@@ -56,20 +56,11 @@ namespace uno = css::uno ;
namespace lang = css::lang ;
namespace backenduno = css::configuration::backend ;
-typedef cppu::WeakComponentImplHelper7< backenduno::XBackend,
- backenduno::XBackendEntities,
- backenduno::XVersionedSchemaSupplier,
- backenduno::XBackendChangesNotifier,
- backenduno::XBackendChangesListener,
- lang::XInitialization,
- lang::XServiceInfo> BackendBase ;
-
-
/**
Class implementing the Backend service for multibackend access.
It creates the required backends and coordinates access to them.
*/
-class MultiStratumBackend : public BackendBase {
+class MultiStratumBackend : public cppu::WeakComponentImplHelper7< backenduno::XBackend, backenduno::XBackendEntities, backenduno::XVersionedSchemaSupplier, backenduno::XBackendChangesNotifier, backenduno::XBackendChangesListener, lang::XInitialization, lang::XServiceInfo > {
public :
/**
Service constructor from a service factory.
@@ -212,19 +203,17 @@ class MultiStratumBackend : public BackendBase {
uno::Reference<lang::XMultiServiceFactory> mFactory ;
/** Mutex for resource protection */
osl::Mutex mMutex ;
- typedef std::vector< uno::Reference <uno::XInterface> > BackendStrata;
uno::Reference<backenduno::XSchemaSupplier> mSchemaSupplier ;
/** list of all backends */
- BackendStrata mBackendStrata;
+ std::vector< uno::Reference <uno::XInterface> > mBackendStrata;
rtl::OUString mOwnerEntity;
/** Helper object that listens to the Strata Backends */
- typedef uno::Reference<backenduno::XBackendChangesListener> ListenerRef;
- ListenerRef mStrataListener;
+ uno::Reference<backenduno::XBackendChangesListener> mStrataListener;
/** List of higher level listeners */
- typedef std::multimap<rtl::OUString, ListenerRef> ListenerList;
+ typedef std::multimap< rtl::OUString, uno::Reference<backenduno::XBackendChangesListener> > ListenerList;
ListenerList mListenerList;
} ;
diff --git a/configmgr/source/backend/schemabuilder.cxx b/configmgr/source/backend/schemabuilder.cxx
index e73805978f..0956119e85 100644
--- a/configmgr/source/backend/schemabuilder.cxx
+++ b/configmgr/source/backend/schemabuilder.cxx
@@ -58,15 +58,15 @@ namespace configmgr
//#if OSL_DEBUG_LEVEL > 0
// currently not used in debug builds
#if 0
- static void check_if_complete(MergedComponentData & md, SchemaBuilder::Context const & xContext)
+ static void check_if_complete(MergedComponentData & md, uno::Reference< uno::XComponentContext > const & xContext)
{
uno::Reference< backenduno::XSchemaHandler >
- test(new SchemaBuilder(xContext, OUString(),md,NULL));
+ test(new SchemaBuilder(xContext, rtl::OUString(),md,NULL));
}
#endif
// -----------------------------------------------------------------------------
-SchemaBuilder::SchemaBuilder(Context const & xContext, const OUString& aExpectedComponentName, MergedComponentData & rData, ITemplateDataProvider* aTemplateProvider )
+SchemaBuilder::SchemaBuilder(uno::Reference< uno::XComponentContext > const & xContext, const rtl::OUString& aExpectedComponentName, MergedComponentData & rData, ITemplateDataProvider* aTemplateProvider )
: m_aData(rData)
, m_aContext(xContext)
//, m_aContext(xContext,static_cast<backenduno::XSchemaHandler*>(this), aExpectedComponentName, aTemplateProvider )
@@ -86,7 +86,7 @@ SchemaBuilder::~SchemaBuilder( )
// XSchemaHandler
void SAL_CALL SchemaBuilder::startSchema( )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
{
if (!this->isDone())
m_aContext.raiseMalformedDataException("Schema builder: Unexpected Restart of Schema");
@@ -99,7 +99,7 @@ void SAL_CALL SchemaBuilder::startSchema( )
// -----------------------------------------------------------------------------
void SAL_CALL SchemaBuilder::endSchema( )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
{
if (!this->isDone())
m_aContext.raiseMalformedDataException("Schema builder: Unexpected End of Schema");
@@ -108,19 +108,19 @@ void SAL_CALL SchemaBuilder::endSchema( )
}
// -----------------------------------------------------------------------------
-void SAL_CALL SchemaBuilder::importComponent( const OUString& /*aName*/ )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
+void SAL_CALL SchemaBuilder::importComponent( const rtl::OUString& /*aName*/ )
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
{
//OSL_TRACE("WARNING: Configuration schema parser: Cross-component references are not yet supported\n");
}
// -----------------------------------------------------------------------------
-void SAL_CALL SchemaBuilder::startComponent( const OUString& aName )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
+void SAL_CALL SchemaBuilder::startComponent( const rtl::OUString& aName )
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
{
if (m_aData.hasSchema())
- m_aContext.raiseElementExistException("Schema builder: The component schema is already loaded", OUString());
+ m_aContext.raiseElementExistException("Schema builder: The component schema is already loaded", rtl::OUString());
m_aContext.startActiveComponent(aName);
@@ -134,7 +134,7 @@ void SAL_CALL SchemaBuilder::startComponent( const OUString& aName )
// -----------------------------------------------------------------------------
void SAL_CALL SchemaBuilder::endComponent( )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
{
m_aContext.popNode();
@@ -153,8 +153,8 @@ bool SchemaBuilder::isExtensible(sal_Int16 aSchemaAttributes)
}
// -----------------------------------------------------------------------------
-void SAL_CALL SchemaBuilder::startGroupTemplate( const TemplateIdentifier& aTemplate, sal_Int16 aAttributes )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
+void SAL_CALL SchemaBuilder::startGroupTemplate( const backenduno::TemplateIdentifier& aTemplate, sal_Int16 aAttributes )
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
{
if (aTemplate.Component.getLength() == 0)
m_aContext.raiseIllegalArgumentException("Schema builder: Starting template without owning component",1);
@@ -164,7 +164,7 @@ void SAL_CALL SchemaBuilder::startGroupTemplate( const TemplateIdentifier& aTemp
if (m_aData.hasTemplate(aTemplate.Name))
m_aContext.raiseElementExistException("Schema builder: Template already exists",aTemplate.Name);
- OUString aName = m_aData.getTemplateAccessor(aTemplate);
+ rtl::OUString aName = m_aData.getTemplateAccessor(aTemplate);
bool bExtensible = isExtensible(aAttributes);
std::auto_ptr<ISubtree> aTemplateTree =
@@ -176,8 +176,8 @@ void SAL_CALL SchemaBuilder::startGroupTemplate( const TemplateIdentifier& aTemp
}
// -----------------------------------------------------------------------------
-void SAL_CALL SchemaBuilder::startSetTemplate( const TemplateIdentifier& aTemplate, sal_Int16 aAttributes, const TemplateIdentifier& aItemType )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
+void SAL_CALL SchemaBuilder::startSetTemplate( const backenduno::TemplateIdentifier& aTemplate, sal_Int16 aAttributes, const backenduno::TemplateIdentifier& aItemType )
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
{
if (aTemplate.Component.getLength() == 0)
m_aContext.raiseIllegalArgumentException("Schema builder: Starting template without owning component",1);
@@ -187,8 +187,8 @@ void SAL_CALL SchemaBuilder::startSetTemplate( const TemplateIdentifier& aTempla
if (m_aData.hasTemplate(aTemplate.Name))
m_aContext.raiseElementExistException("Schema builder: Template already exists",aTemplate.Name);
- OUString aName = m_aData.getTemplateAccessor(aTemplate);
- TemplateIdentifier aFullType = m_aContext.completeComponent(aItemType);
+ rtl::OUString aName = m_aData.getTemplateAccessor(aTemplate);
+ backenduno::TemplateIdentifier aFullType = m_aContext.completeComponent(aItemType);
bool bExtensible = isExtensible(aAttributes);
std::auto_ptr<ISubtree> aTemplateTree =
@@ -201,7 +201,7 @@ void SAL_CALL SchemaBuilder::startSetTemplate( const TemplateIdentifier& aTempla
// -----------------------------------------------------------------------------
void SAL_CALL SchemaBuilder::endTemplate( )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
{
m_aContext.popNode();
@@ -209,8 +209,8 @@ void SAL_CALL SchemaBuilder::endTemplate( )
}
// -----------------------------------------------------------------------------
-void SAL_CALL SchemaBuilder::startGroup( const OUString& aName, sal_Int16 aAttributes )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
+void SAL_CALL SchemaBuilder::startGroup( const rtl::OUString& aName, sal_Int16 aAttributes )
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
{
bool bExtensible = isExtensible(aAttributes);
@@ -222,10 +222,10 @@ void SAL_CALL SchemaBuilder::startGroup( const OUString& aName, sal_Int16 aAttri
}
// -----------------------------------------------------------------------------
-void SAL_CALL SchemaBuilder::startSet( const OUString& aName, sal_Int16 aAttributes, const TemplateIdentifier& aItemType )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
+void SAL_CALL SchemaBuilder::startSet( const rtl::OUString& aName, sal_Int16 aAttributes, const backenduno::TemplateIdentifier& aItemType )
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
{
- TemplateIdentifier aFullType = m_aContext.completeComponent(aItemType);
+ backenduno::TemplateIdentifier aFullType = m_aContext.completeComponent(aItemType);
bool bExtensible = isExtensible(aAttributes);
std::auto_ptr<ISubtree> aTree = m_aFactory.createSet(aName,aFullType,bExtensible,getNodeAttributes());
@@ -237,7 +237,7 @@ void SAL_CALL SchemaBuilder::startSet( const OUString& aName, sal_Int16 aAttribu
// -----------------------------------------------------------------------------
void SAL_CALL SchemaBuilder::endNode( )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
{
m_aContext.popNode();
@@ -263,8 +263,8 @@ node::Attributes SchemaBuilder::makePropertyAttributes(sal_Int16 aSchemaAttribut
}
// -----------------------------------------------------------------------------
-void SAL_CALL SchemaBuilder::addProperty( const OUString& aName, sal_Int16 aAttributes, const uno::Type& aType )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
+void SAL_CALL SchemaBuilder::addProperty( const rtl::OUString& aName, sal_Int16 aAttributes, const uno::Type& aType )
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
{
// TODO: add type validation
node::Attributes aValueAttributes = makePropertyAttributes(aAttributes);
@@ -286,8 +286,8 @@ void SAL_CALL SchemaBuilder::addProperty( const OUString& aName, sal_Int16 aAttr
}
// -----------------------------------------------------------------------------
-void SAL_CALL SchemaBuilder::addPropertyWithDefault( const OUString& aName, sal_Int16 aAttributes, const uno::Any& aDefaultValue )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
+void SAL_CALL SchemaBuilder::addPropertyWithDefault( const rtl::OUString& aName, sal_Int16 aAttributes, const uno::Any& aDefaultValue )
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
{
// TODO: add parameter validation
node::Attributes aValueAttributes = makePropertyAttributes(aAttributes);
@@ -315,10 +315,10 @@ void SAL_CALL SchemaBuilder::addPropertyWithDefault( const OUString& aName, sal_
}
// -----------------------------------------------------------------------------
-void SAL_CALL SchemaBuilder::addInstance( const OUString& aName, const TemplateIdentifier& aTemplate )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
+void SAL_CALL SchemaBuilder::addInstance( const rtl::OUString& aName, const backenduno::TemplateIdentifier& aTemplate )
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
{
- TemplateIdentifier aFullType = m_aContext.completeComponent(aTemplate);
+ backenduno::TemplateIdentifier aFullType = m_aContext.completeComponent(aTemplate);
std::auto_ptr<ISubtree> aPlaceHolder =
m_aFactory.createPlaceHolder(aName,aFullType);
@@ -327,8 +327,8 @@ void SAL_CALL SchemaBuilder::addInstance( const OUString& aName, const TemplateI
}
// -----------------------------------------------------------------------------
-void SAL_CALL SchemaBuilder::addItemType( const TemplateIdentifier& aItemType )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
+void SAL_CALL SchemaBuilder::addItemType( const backenduno::TemplateIdentifier& aItemType )
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException)
{
if ( m_aContext.getCurrentParent().getElementTemplateName() != aItemType.Name ||
m_aContext.getCurrentParent().getElementTemplateModule() != m_aContext.getTemplateComponent(aItemType) )
@@ -369,15 +369,12 @@ namespace
{
class SubstitutionHelper : NodeModification
{
- typedef std::vector< ISubtree const * > TemplateStack;
- typedef std::vector< OUString > InstanceList;
-
MergedComponentData & m_rData;
DataBuilderContext m_aContext;
ComponentDataFactory m_aFactory;
- InstanceList m_aReplacementList;
- TemplateStack m_aTemplateStack;
+ std::vector< rtl::OUString > m_aReplacementList;
+ std::vector< ISubtree const * > m_aTemplateStack;
public:
SubstitutionHelper(DataBuilderContext const & aBaseContext, MergedComponentData & _rData, uno::XInterface * _pContext)
: m_rData(_rData)
@@ -392,7 +389,7 @@ namespace
void substituteInNode(ISubtree & _rNode);
void substituteInList();
- void substitute(OUString const & _aName);
+ void substitute(rtl::OUString const & _aName);
virtual void handle(ValueNode&);
virtual void handle(ISubtree&);
@@ -436,7 +433,7 @@ namespace
void SubstitutionHelper::substituteInNode(ISubtree & _rNode)
{
- InstanceList aSaveInstances;
+ std::vector< rtl::OUString > aSaveInstances;
aSaveInstances.swap(m_aReplacementList);
// todo: own stack to check against infinite recursion
@@ -454,7 +451,7 @@ namespace
void SubstitutionHelper::substituteInList()
{
- for(InstanceList::iterator it = m_aReplacementList.begin();
+ for(std::vector< rtl::OUString >::iterator it = m_aReplacementList.begin();
it != m_aReplacementList.end(); ++it)
{
this->substitute(*it);
@@ -462,7 +459,7 @@ namespace
}
// -----------------------------------------------------------------------------
- void SubstitutionHelper::substitute(OUString const & _aName)
+ void SubstitutionHelper::substitute(rtl::OUString const & _aName)
{
ISubtree & rParent = m_aContext.getCurrentParent();
@@ -473,12 +470,12 @@ namespace
ISubtree * pReplacedInstance = pReplacedNode->asISubtree();
OSL_ASSERT( pReplacedInstance != NULL );
- TemplateIdentifier aTemplateName = m_aFactory.getInstanceType(*pReplacedInstance);
+ backenduno::TemplateIdentifier aTemplateName = m_aFactory.getInstanceType(*pReplacedInstance);
if (aTemplateName.Component == m_aContext.getActiveComponent())
{
if (ISubtree const * pTemplate = m_rData.findTemplate(aTemplateName.Name))
{
- TemplateStack::iterator beg = m_aTemplateStack.begin(), end = m_aTemplateStack.end();
+ std::vector< ISubtree const * >::iterator beg = m_aTemplateStack.begin(), end = m_aTemplateStack.end();
if (std::find(beg,end,pTemplate) != end)
m_aContext.raiseMalformedDataException("SchemaBuilder: Could not expand instances: Template is recursive");
@@ -505,9 +502,9 @@ namespace
//Import Template from different component
else
{
- TemplateRequest aTemplateRequest(configuration::makeName(aTemplateName.Name, configuration::Name::NoValidate()),
- configuration::makeName(aTemplateName.Component, configuration::Name::NoValidate()) );
- TemplateResult aResult = m_aContext.getTemplateData( aTemplateRequest );
+ TemplateRequest aTemplateRequest(aTemplateName.Name,
+ aTemplateName.Component );
+ ResultHolder< TemplateInstance > aResult = m_aContext.getTemplateData( aTemplateRequest );
std::auto_ptr<INode> pTemplateInstance = aResult.extractDataAndClear();
pTemplateInstance->setName(_aName);
diff --git a/configmgr/source/backend/schemabuilder.hxx b/configmgr/source/backend/schemabuilder.hxx
index 1ccd2892e0..4fc42c377e 100644
--- a/configmgr/source/backend/schemabuilder.hxx
+++ b/configmgr/source/backend/schemabuilder.hxx
@@ -50,19 +50,13 @@ namespace configmgr
namespace lang = ::com::sun::star::lang;
namespace backenduno = ::com::sun::star::configuration::backend;
-
- using backenduno::MalformedDataException;
// -----------------------------------------------------------------------------
- typedef ::cppu::WeakImplHelper1<backenduno::XSchemaHandler> SchemaBuilder_Base;
-
class SchemaBuilder
- : public SchemaBuilder_Base
+ : public cppu::WeakImplHelper1<backenduno::XSchemaHandler>
{
public:
- typedef uno::Reference< uno::XComponentContext > Context;
-
- SchemaBuilder(Context const & xContext, const OUString& aExpectedComponentName, MergedComponentData & rData, ITemplateDataProvider* aTemplateProvider = NULL );
+ SchemaBuilder(uno::Reference< uno::XComponentContext > const & xContext, const rtl::OUString& aExpectedComponentName, MergedComponentData & rData, ITemplateDataProvider* aTemplateProvider = NULL );
virtual ~SchemaBuilder();
// checking the result
@@ -75,63 +69,63 @@ namespace configmgr
public:
virtual void SAL_CALL
startSchema( )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
virtual void SAL_CALL
endSchema( )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
virtual void SAL_CALL
- importComponent( const OUString& aName )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
+ importComponent( const rtl::OUString& aName )
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
virtual void SAL_CALL
- startComponent( const OUString& aName )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
+ startComponent( const rtl::OUString& aName )
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
virtual void SAL_CALL
endComponent( )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
virtual void SAL_CALL
- startGroupTemplate( const TemplateIdentifier& aTemplate, sal_Int16 aAttributes )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
+ startGroupTemplate( const backenduno::TemplateIdentifier& aTemplate, sal_Int16 aAttributes )
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
virtual void SAL_CALL
- startSetTemplate( const TemplateIdentifier& aTemplate, sal_Int16 aAttributes, const TemplateIdentifier& aItemType )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
+ startSetTemplate( const backenduno::TemplateIdentifier& aTemplate, sal_Int16 aAttributes, const backenduno::TemplateIdentifier& aItemType )
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
virtual void SAL_CALL
endTemplate( )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
virtual void SAL_CALL
- startGroup( const OUString& aName, sal_Int16 aAttributes )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
+ startGroup( const rtl::OUString& aName, sal_Int16 aAttributes )
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
virtual void SAL_CALL
- startSet( const OUString& aName, sal_Int16 aAttributes, const TemplateIdentifier& aItemType )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
+ startSet( const rtl::OUString& aName, sal_Int16 aAttributes, const backenduno::TemplateIdentifier& aItemType )
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
virtual void SAL_CALL
endNode( )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
virtual void SAL_CALL
- addProperty( const OUString& aName, sal_Int16 aAttributes, const uno::Type& aType )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
+ addProperty( const rtl::OUString& aName, sal_Int16 aAttributes, const uno::Type& aType )
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
virtual void SAL_CALL
- addPropertyWithDefault( const OUString& aName, sal_Int16 aAttributes, const uno::Any& aDefaultValue )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
+ addPropertyWithDefault( const rtl::OUString& aName, sal_Int16 aAttributes, const uno::Any& aDefaultValue )
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
virtual void SAL_CALL
- addInstance( const OUString& aName, const TemplateIdentifier& aTemplate )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
+ addInstance( const rtl::OUString& aName, const backenduno::TemplateIdentifier& aTemplate )
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
virtual void SAL_CALL
- addItemType( const TemplateIdentifier& aItemType )
- throw (MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
+ addItemType( const backenduno::TemplateIdentifier& aItemType )
+ throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
private:
static node::Attributes getComponentRootAttributes();
diff --git a/configmgr/source/backend/singlebackendadapter.cxx b/configmgr/source/backend/singlebackendadapter.cxx
index 5086aa8901..bcecbe7e5b 100644
--- a/configmgr/source/backend/singlebackendadapter.cxx
+++ b/configmgr/source/backend/singlebackendadapter.cxx
@@ -45,7 +45,7 @@ namespace configmgr { namespace backend {
SingleBackendAdapter::SingleBackendAdapter(
const uno::Reference<uno::XComponentContext>& xContext)
- : BackendBase(mMutex), mFactory(xContext->getServiceManager(),uno::UNO_QUERY) {
+ : cppu::WeakComponentImplHelper5< backenduno::XBackend, backenduno::XBackendEntities, backenduno::XSchemaSupplier, lang::XInitialization, lang::XServiceInfo >(mMutex), mFactory(xContext->getServiceManager(),uno::UNO_QUERY) {
}
//------------------------------------------------------------------------------
@@ -67,13 +67,13 @@ void SAL_CALL SingleBackendAdapter::initialize(
if (!mBackend.is())
{
throw com::sun::star::configuration::CannotLoadConfigurationException(
- OUString::createFromAscii("Online SingleBackend Adapter: Cannot operate without real (Single)Backend"),
+ rtl::OUString::createFromAscii("Online SingleBackend Adapter: Cannot operate without real (Single)Backend"),
*this);
}
}
//------------------------------------------------------------------------------
-static inline OUString getSingleLayerDummyEntity()
-{ return OUString(RTL_CONSTASCII_USTRINGPARAM("*")); }
+static inline rtl::OUString getSingleLayerDummyEntity()
+{ return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("*")); }
//------------------------------------------------------------------------------
bool SingleBackendAdapter::checkOkState()
{
@@ -284,7 +284,7 @@ static const sal_Char * const kOnlineService = "com.sun.star.configuration.back
static const sal_Char * const kImplementation =
"com.sun.star.comp.configuration.backend.SingleBackendAdapter" ;
-static const AsciiServiceName kServiceNames [] =
+static sal_Char const * const kServiceNames [] =
{
kOnlineService,
kAdapterService,
@@ -305,7 +305,7 @@ const ServiceRegistrationInfo *getSingleBackendAdapterServiceInfo()
}
uno::Reference<uno::XInterface> SAL_CALL
- instantiateSingleBackendAdapter(const CreationContext& xContext)
+ instantiateSingleBackendAdapter(const uno::Reference< uno::XComponentContext >& xContext)
{
return *new SingleBackendAdapter(xContext) ;
}
diff --git a/configmgr/source/backend/singlebackendadapter.hxx b/configmgr/source/backend/singlebackendadapter.hxx
index 1b5390828c..5790f27dd8 100644
--- a/configmgr/source/backend/singlebackendadapter.hxx
+++ b/configmgr/source/backend/singlebackendadapter.hxx
@@ -46,16 +46,11 @@ namespace uno = css::uno ;
namespace lang = css::lang ;
namespace backenduno = css::configuration::backend ;
-typedef cppu::WeakComponentImplHelper5< backenduno::XBackend,
- backenduno::XBackendEntities,
- backenduno::XSchemaSupplier,
- lang::XInitialization,
- lang::XServiceInfo> BackendBase ;
/**
Class implementing the Backend service for remote access.
It just transfers calls to a SingleBackend implementation.
*/
-class SingleBackendAdapter : public BackendBase {
+class SingleBackendAdapter : public cppu::WeakComponentImplHelper5< backenduno::XBackend, backenduno::XBackendEntities, backenduno::XSchemaSupplier, lang::XInitialization, lang::XServiceInfo > {
public :
/**
Service constructor from a service factory.
diff --git a/configmgr/source/backend/updatedata.cxx b/configmgr/source/backend/updatedata.cxx
index 4453971c6a..0f15d1a894 100644
--- a/configmgr/source/backend/updatedata.cxx
+++ b/configmgr/source/backend/updatedata.cxx
@@ -46,7 +46,7 @@ namespace configmgr
{
// -----------------------------------------------------------------------------
-ElementUpdate::ElementUpdate(NodeUpdate * _pParent, OUString const & _aName, sal_Int16 _nFlags, sal_Int16 _nFlagsMask)
+ElementUpdate::ElementUpdate(NodeUpdate * _pParent, rtl::OUString const & _aName, sal_Int16 _nFlags, sal_Int16 _nFlagsMask)
: NamedUpdate(_aName)
, m_pParent(_pParent)
, m_nFlags(_nFlags)
@@ -74,7 +74,7 @@ PropertyUpdate * ElementUpdate::asPropertyUpdate()
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
-NodeUpdate::NodeUpdate(NodeUpdate * _pParent, OUString const & _aName, sal_Int16 _nFlags, sal_Int16 _nFlagsMask, Op _op)
+NodeUpdate::NodeUpdate(NodeUpdate * _pParent, rtl::OUString const & _aName, sal_Int16 _nFlags, sal_Int16 _nFlagsMask, Op _op)
: ElementUpdate(_pParent,_aName,_nFlags, _nFlagsMask)
, m_aNodes()
, m_aProperties()
@@ -92,7 +92,7 @@ NodeUpdate * NodeUpdate::asNodeUpdate(bool _bMerged)
}
// -----------------------------------------------------------------------------
-bool NodeUpdate::addNodeUpdate(ElementUpdateRef const & _aNode)
+bool NodeUpdate::addNodeUpdate(rtl::Reference<ElementUpdate> const & _aNode)
{
OSL_PRECOND( _aNode.is(), "ERROR: NodeUpdate: Trying to add NULL node.");
OSL_PRECOND( _aNode->getParent() == this, "ERROR: NodeUpdate: Node being added has wrong parent.");
@@ -103,7 +103,7 @@ bool NodeUpdate::addNodeUpdate(ElementUpdateRef const & _aNode)
}
// -----------------------------------------------------------------------------
-bool NodeUpdate::addPropertyUpdate(ElementUpdateRef const & _aProp)
+bool NodeUpdate::addPropertyUpdate(rtl::Reference<ElementUpdate> const & _aProp)
{
OSL_PRECOND( _aProp.is(), "ERROR: NodeUpdate: Trying to add NULL property.");
OSL_PRECOND( _aProp->getParent() == this, "ERROR: NodeUpdate: Property being added has wrong parent.");
@@ -114,7 +114,7 @@ bool NodeUpdate::addPropertyUpdate(ElementUpdateRef const & _aProp)
}
// -----------------------------------------------------------------------------
-void NodeUpdate::removeNodeByName(OUString const & _aName)
+void NodeUpdate::removeNodeByName(rtl::OUString const & _aName)
{
ElementList::iterator it = m_aNodes.find(_aName);
OSL_ENSURE(it != m_aNodes.end(),
@@ -128,7 +128,7 @@ void NodeUpdate::removeNodeByName(OUString const & _aName)
}
// -----------------------------------------------------------------------------
-void NodeUpdate::removePropertyByName (OUString const & _aName)
+void NodeUpdate::removePropertyByName (rtl::OUString const & _aName)
{
ElementList::iterator it = m_aProperties.find(_aName);
OSL_ENSURE(it != m_aProperties.end(),
@@ -142,35 +142,35 @@ void NodeUpdate::removePropertyByName (OUString const & _aName)
}
// -----------------------------------------------------------------------------
-ElementUpdateRef NodeUpdate::getNodeByName(OUString const & _aName) const
+rtl::Reference<ElementUpdate> NodeUpdate::getNodeByName(rtl::OUString const & _aName) const
{
- Iterator it = m_aNodes.find(_aName);
+ ElementList::const_iterator it = m_aNodes.find(_aName);
- return it != m_aNodes.end() ? it->second : ElementUpdateRef();
+ return it != m_aNodes.end() ? it->second : rtl::Reference<ElementUpdate>();
}
// -----------------------------------------------------------------------------
-ElementUpdateRef NodeUpdate::getPropertyByName (OUString const & _aName) const
+rtl::Reference<ElementUpdate> NodeUpdate::getPropertyByName (rtl::OUString const & _aName) const
{
- Iterator it = m_aProperties.find(_aName);
+ ElementList::const_iterator it = m_aProperties.find(_aName);
- return it != m_aProperties.end() ? it->second : ElementUpdateRef();
+ return it != m_aProperties.end() ? it->second : rtl::Reference<ElementUpdate>();
}
// -----------------------------------------------------------------------------
void NodeUpdate::writeChildrenToLayer(backenduno::XLayerHandler * _pLayer)
{
OSL_ASSERT(_pLayer);
- for (Iterator itP = beginProperties(); itP != endProperties(); ++itP)
+ for (ElementList::const_iterator itP = beginProperties(); itP != endProperties(); ++itP)
itP->second->writeToLayer(_pLayer);
- for (Iterator itN = beginNodes(); itN != endNodes(); ++itN)
+ for (ElementList::const_iterator itN = beginNodes(); itN != endNodes(); ++itN)
itN->second->writeToLayer(_pLayer);
}
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
-NodeModification::NodeModification(NodeUpdate * _pParent, OUString const & _aName, sal_Int16 _nFlags, sal_Int16 _nFlagsMask, sal_Bool _bReset)
+NodeModification::NodeModification(NodeUpdate * _pParent, rtl::OUString const & _aName, sal_Int16 _nFlags, sal_Int16 _nFlagsMask, sal_Bool _bReset)
: NodeUpdate(_pParent,_aName,_nFlags, _nFlagsMask, _bReset ? reset : modify)
{
}
@@ -192,7 +192,7 @@ void NodeModification::writeToLayer(backenduno::XLayerHandler * _pLayer)
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
-NodeReplace::NodeReplace(NodeUpdate * _pParent, OUString const & _aName, sal_Int16 _nFlags)
+NodeReplace::NodeReplace(NodeUpdate * _pParent, rtl::OUString const & _aName, sal_Int16 _nFlags)
: NodeUpdate(_pParent,_aName,_nFlags, _nFlags, replace)
, m_aTemplateName()
, m_aTemplateComponent()
@@ -200,7 +200,7 @@ NodeReplace::NodeReplace(NodeUpdate * _pParent, OUString const & _aName, sal_Int
}
// -----------------------------------------------------------------------------
-NodeReplace::NodeReplace(NodeUpdate * _pParent, OUString const & _aName, sal_Int16 _nFlags, OUString const & _aTemplateName, OUString const & _aTemplateComponent)
+NodeReplace::NodeReplace(NodeUpdate * _pParent, rtl::OUString const & _aName, sal_Int16 _nFlags, rtl::OUString const & _aTemplateName, rtl::OUString const & _aTemplateComponent)
: NodeUpdate(_pParent,_aName,_nFlags, _nFlags, replace)
, m_aTemplateName(_aTemplateName)
, m_aTemplateComponent(_aTemplateComponent)
@@ -232,7 +232,7 @@ void NodeReplace::writeToLayer(backenduno::XLayerHandler * _pLayer)
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
-NodeDrop::NodeDrop(NodeUpdate * _pParent, OUString const & _aName)
+NodeDrop::NodeDrop(NodeUpdate * _pParent, rtl::OUString const & _aName)
: ElementUpdate(_pParent,_aName,0,0)
{
}
@@ -246,7 +246,7 @@ void NodeDrop::writeToLayer(backenduno::XLayerHandler * _pLayer)
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
-PropertyUpdate::PropertyUpdate(NodeUpdate * _pParent, OUString const & _aName, sal_Int16 _nFlags, sal_Int16 _nFlagsMask, uno::Type const & _aType)
+PropertyUpdate::PropertyUpdate(NodeUpdate * _pParent, rtl::OUString const & _aName, sal_Int16 _nFlags, sal_Int16 _nFlagsMask, uno::Type const & _aType)
: ElementUpdate(_pParent,_aName,_nFlags,_nFlagsMask)
, m_aValues()
, m_aType(_aType)
@@ -286,7 +286,7 @@ uno::Any const & PropertyUpdate::getResetMarker()
}
// -----------------------------------------------------------------------------
-bool PropertyUpdate::setValueFor(OUString const & _aLocale, uno::Any const & _aValueUpdate)
+bool PropertyUpdate::setValueFor(rtl::OUString const & _aLocale, uno::Any const & _aValueUpdate)
{
OSL_PRECOND( !isResetMarker(_aValueUpdate), "PropertyUpdate: ERROR: Trying to set a reset marker as regular value" );
@@ -307,7 +307,7 @@ bool PropertyUpdate::setValueFor(OUString const & _aLocale, uno::Any const & _aV
}
// -----------------------------------------------------------------------------
-bool PropertyUpdate::resetValueFor(OUString const & _aLocale)
+bool PropertyUpdate::resetValueFor(rtl::OUString const & _aLocale)
{
OSL_ENSURE(m_aValues.find(_aLocale) == m_aValues.end(),
"PropertyUpdate: Locale being reset already has a value in this property.");
@@ -316,7 +316,7 @@ bool PropertyUpdate::resetValueFor(OUString const & _aLocale)
}
// -----------------------------------------------------------------------------
-void PropertyUpdate::removeValueFor(OUString const & _aLocale)
+void PropertyUpdate::removeValueFor(rtl::OUString const & _aLocale)
{
OSL_ENSURE(m_aValues.find(_aLocale) != m_aValues.end(),
"PropertyUpdate: Locale being removed is not in this node.");
@@ -332,33 +332,33 @@ void PropertyUpdate::finishValue()
}
// -----------------------------------------------------------------------------
-bool PropertyUpdate::hasValueFor(OUString const & _aLocale) const
+bool PropertyUpdate::hasValueFor(rtl::OUString const & _aLocale) const
{
- Iterator it = m_aValues.find(_aLocale);
+ ValueList::const_iterator it = m_aValues.find(_aLocale);
return it != m_aValues.end() && ! isResetMarker(it->second);
}
// -----------------------------------------------------------------------------
-bool PropertyUpdate::hasResetFor(OUString const & _aLocale) const
+bool PropertyUpdate::hasResetFor(rtl::OUString const & _aLocale) const
{
- Iterator it = m_aValues.find(_aLocale);
+ ValueList::const_iterator it = m_aValues.find(_aLocale);
return it != m_aValues.end() && isResetMarker(it->second);
}
// -----------------------------------------------------------------------------
-bool PropertyUpdate::hasChangeFor(OUString const & _aLocale) const
+bool PropertyUpdate::hasChangeFor(rtl::OUString const & _aLocale) const
{
- Iterator it = m_aValues.find(_aLocale);
+ ValueList::const_iterator it = m_aValues.find(_aLocale);
return it != m_aValues.end();
}
// -----------------------------------------------------------------------------
-uno::Any PropertyUpdate::getValueFor(OUString const & _aLocale) const
+uno::Any PropertyUpdate::getValueFor(rtl::OUString const & _aLocale) const
{
- Iterator it = m_aValues.find(_aLocale);
+ ValueList::const_iterator it = m_aValues.find(_aLocale);
OSL_ENSURE(it != m_aValues.end() && !isResetMarker(it->second),
"PropertyUpdate: Should not call getValue() unless hasValue() returns true" );
@@ -377,7 +377,7 @@ void PropertyUpdate::writeValueToLayer(backenduno::XLayerHandler * _pLayer, uno:
}
// -----------------------------------------------------------------------------
-void PropertyUpdate::writeValueToLayerFor(backenduno::XLayerHandler * _pLayer, uno::Any const & _aValue, OUString const & _aLocale)
+void PropertyUpdate::writeValueToLayerFor(backenduno::XLayerHandler * _pLayer, uno::Any const & _aValue, rtl::OUString const & _aLocale)
{
OSL_ASSERT(_pLayer);
if (_aLocale == this->primarySlot())
@@ -393,7 +393,7 @@ void PropertyUpdate::writeValueToLayerFor(backenduno::XLayerHandler * _pLayer, u
void PropertyUpdate::writeValuesToLayer(backenduno::XLayerHandler * _pLayer)
{
OSL_ASSERT(_pLayer);
- for (Iterator itV = beginValues(); itV != endValues(); ++itV)
+ for (ValueList::const_iterator itV = beginValues(); itV != endValues(); ++itV)
this->writeValueToLayerFor(_pLayer, itV->second, itV->first);
}
// -----------------------------------------------------------------------------
@@ -410,7 +410,7 @@ void PropertyUpdate::writeToLayer(backenduno::XLayerHandler * _pLayer)
// -----------------------------------------------------------------------------
-PropertyAdd::PropertyAdd(NodeUpdate * _pParent, OUString const & _aName, sal_Int16 _nFlags, uno::Type const & _aType)
+PropertyAdd::PropertyAdd(NodeUpdate * _pParent, rtl::OUString const & _aName, sal_Int16 _nFlags, uno::Type const & _aType)
: ElementUpdate(_pParent,_aName,_nFlags,_nFlags)
, m_aValueType(_aType)
, m_aValue()
@@ -419,7 +419,7 @@ PropertyAdd::PropertyAdd(NodeUpdate * _pParent, OUString const & _aName, sal_Int
}
// -----------------------------------------------------------------------------
-PropertyAdd::PropertyAdd(NodeUpdate * _pParent, OUString const & _aName, sal_Int16 _nFlags, uno::Any const & _aValue)
+PropertyAdd::PropertyAdd(NodeUpdate * _pParent, rtl::OUString const & _aName, sal_Int16 _nFlags, uno::Any const & _aValue)
: ElementUpdate(_pParent,_aName,_nFlags,_nFlags)
, m_aValueType(_aValue.getValueType())
, m_aValue(_aValue)
@@ -438,7 +438,7 @@ void PropertyAdd::writeToLayer(backenduno::XLayerHandler * _pLayer)
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
-PropertyReset::PropertyReset(NodeUpdate * _pParent, OUString const & _aName)
+PropertyReset::PropertyReset(NodeUpdate * _pParent, rtl::OUString const & _aName)
: ElementUpdate(_pParent,_aName,0,0)
{
}
diff --git a/configmgr/source/backend/updatedata.hxx b/configmgr/source/backend/updatedata.hxx
index d94c877c9d..e3785e3781 100644
--- a/configmgr/source/backend/updatedata.hxx
+++ b/configmgr/source/backend/updatedata.hxx
@@ -35,6 +35,7 @@
#include <com/sun/star/uno/Type.hxx>
#include <rtl/ref.hxx>
#include <rtl/ustring.hxx>
+#include <salhelper/simplereferenceobject.hxx>
#include "utility.hxx"
#ifndef INCLUDED_SET
@@ -57,7 +58,6 @@ namespace configmgr
namespace backend
{
// -----------------------------------------------------------------------------
- using rtl::OUString;
namespace uno = ::com::sun::star::uno;
namespace backenduno = ::com::sun::star::configuration::backend;
// -----------------------------------------------------------------------------
@@ -70,24 +70,22 @@ namespace configmgr
class PropertyAdd;
class PropertyReset;
- typedef rtl::Reference<ElementUpdate> ElementUpdateRef;
-
// -----------------------------------------------------------------------------
- class NamedUpdate : public configmgr::SimpleReferenceObject
+ class NamedUpdate : public salhelper::SimpleReferenceObject
{
- OUString const m_aName;
+ rtl::OUString const m_aName;
protected:
explicit
- NamedUpdate(OUString const & _aName)
+ NamedUpdate(rtl::OUString const & _aName)
: m_aName(_aName)
{}
~NamedUpdate() {};
public:
- OUString const & getName() const { return m_aName; }
+ rtl::OUString const & getName() const { return m_aName; }
};
// -----------------------------------------------------------------------------
class ElementUpdate : public NamedUpdate
@@ -96,7 +94,7 @@ namespace configmgr
sal_Int16 m_nFlags;
sal_Int16 m_nFlagsMask;
protected:
- ElementUpdate(NodeUpdate * _pParent, OUString const & _aName, sal_Int16 _nFlags, sal_Int16 _nFlagsMask);
+ ElementUpdate(NodeUpdate * _pParent, rtl::OUString const & _aName, sal_Int16 _nFlags, sal_Int16 _nFlagsMask);
public:
virtual NodeUpdate * asNodeUpdate(bool _bMerged = false);
@@ -115,31 +113,30 @@ namespace configmgr
class NodeUpdate : public ElementUpdate
{
- typedef std::map< OUString, ElementUpdateRef > ElementList;
+ typedef std::map< rtl::OUString, rtl::Reference<ElementUpdate> > ElementList;
public:
enum Op { modify, reset, replace };
protected:
- NodeUpdate(NodeUpdate * _pParent, OUString const & _aName, sal_Int16 _nFlags, sal_Int16 _nFlagsMask, Op _op);
+ NodeUpdate(NodeUpdate * _pParent, rtl::OUString const & _aName, sal_Int16 _nFlags, sal_Int16 _nFlagsMask, Op _op);
virtual NodeUpdate * asNodeUpdate(bool _bMerged);
public:
- bool addNodeUpdate (ElementUpdateRef const & _aNode);
- bool addPropertyUpdate (ElementUpdateRef const & _aProp);
- void removeNodeByName (OUString const & _aName);
- void removePropertyByName (OUString const & _aName);
+ bool addNodeUpdate (rtl::Reference<ElementUpdate> const & _aNode);
+ bool addPropertyUpdate (rtl::Reference<ElementUpdate> const & _aProp);
+ void removeNodeByName (rtl::OUString const & _aName);
+ void removePropertyByName (rtl::OUString const & _aName);
Op getOperation() const { return m_op; }
- ElementUpdateRef getNodeByName (OUString const & _aName) const;
- ElementUpdateRef getPropertyByName (OUString const & _aName) const;
+ rtl::Reference<ElementUpdate> getNodeByName (rtl::OUString const & _aName) const;
+ rtl::Reference<ElementUpdate> getPropertyByName (rtl::OUString const & _aName) const;
- typedef ElementList::const_iterator Iterator;
- Iterator beginNodes() const { return m_aNodes.begin(); }
- Iterator endNodes() const { return m_aNodes.end(); };
- Iterator beginProperties() const { return m_aProperties.begin(); };
- Iterator endProperties() const { return m_aProperties.end(); };
+ ElementList::const_iterator beginNodes() const { return m_aNodes.begin(); }
+ ElementList::const_iterator endNodes() const { return m_aNodes.end(); };
+ ElementList::const_iterator beginProperties() const { return m_aProperties.begin(); };
+ ElementList::const_iterator endProperties() const { return m_aProperties.end(); };
bool hasChildren() const { return !m_aNodes.empty() || !m_aProperties.empty(); }
@@ -155,7 +152,7 @@ namespace configmgr
class NodeModification : public NodeUpdate
{
public:
- NodeModification(NodeUpdate * _pParent, OUString const & _aName, sal_Int16 _nFlags, sal_Int16 _nFlagsMask, sal_Bool _bReset);
+ NodeModification(NodeUpdate * _pParent, rtl::OUString const & _aName, sal_Int16 _nFlags, sal_Int16 _nFlagsMask, sal_Bool _bReset);
virtual void writeToLayer(backenduno::XLayerHandler * _pLayer);
};
// -----------------------------------------------------------------------------
@@ -163,24 +160,24 @@ namespace configmgr
class NodeReplace : public NodeUpdate
{
public:
- NodeReplace(NodeUpdate * _pParent, OUString const & _aName, sal_Int16 _nFlags);
- NodeReplace(NodeUpdate * _pParent, OUString const & _aName, sal_Int16 _nFlags, OUString const & _aTemplateName, OUString const & _aTemplateComponent);
+ NodeReplace(NodeUpdate * _pParent, rtl::OUString const & _aName, sal_Int16 _nFlags);
+ NodeReplace(NodeUpdate * _pParent, rtl::OUString const & _aName, sal_Int16 _nFlags, rtl::OUString const & _aTemplateName, rtl::OUString const & _aTemplateComponent);
bool hasTemplate() const;
- OUString getTemplateName() const { return m_aTemplateName; }
- OUString getTemplateComponent() const { return m_aTemplateComponent; }
+ rtl::OUString getTemplateName() const { return m_aTemplateName; }
+ rtl::OUString getTemplateComponent() const { return m_aTemplateComponent; }
virtual void writeToLayer(backenduno::XLayerHandler * _pLayer);
private:
- OUString m_aTemplateName;
- OUString m_aTemplateComponent;
+ rtl::OUString m_aTemplateName;
+ rtl::OUString m_aTemplateComponent;
};
// -----------------------------------------------------------------------------
class NodeDrop : public ElementUpdate
{
public:
- NodeDrop(NodeUpdate * _pParent, OUString const & _aName);
+ NodeDrop(NodeUpdate * _pParent, rtl::OUString const & _aName);
virtual void writeToLayer(backenduno::XLayerHandler * _pLayer);
};
@@ -188,19 +185,18 @@ namespace configmgr
class PropertyUpdate : public ElementUpdate
{
- typedef uno::Any ValueUpdate;
- typedef std::map< OUString, ValueUpdate > ValueList;
+ typedef std::map< rtl::OUString, uno::Any > ValueList;
ValueList m_aValues;
uno::Type m_aType;
public:
- PropertyUpdate(NodeUpdate * _pParent, OUString const & _aName, sal_Int16 _nFlags, sal_Int16 _nFlagsMask, uno::Type const & _aType);
+ PropertyUpdate(NodeUpdate * _pParent, rtl::OUString const & _aName, sal_Int16 _nFlags, sal_Int16 _nFlagsMask, uno::Type const & _aType);
- bool setValueFor(OUString const & _aLocale, ValueUpdate const & _aValueUpdate);
- bool resetValueFor(OUString const & _aLocale);
- void removeValueFor(OUString const & _aLocale);
+ bool setValueFor(rtl::OUString const & _aLocale, uno::Any const & _aValueUpdate);
+ bool resetValueFor(rtl::OUString const & _aLocale);
+ void removeValueFor(rtl::OUString const & _aLocale);
- bool setValue(ValueUpdate const & _aValueUpdate) { return setValueFor(primarySlot(), _aValueUpdate); }
+ bool setValue(uno::Any const & _aValueUpdate) { return setValueFor(primarySlot(), _aValueUpdate); }
bool resetValue() { return resetValueFor(primarySlot()); }
void removeValue() { removeValueFor(primarySlot()); }
@@ -208,28 +204,27 @@ namespace configmgr
uno::Type const & getValueType() const { return m_aType; }
- bool hasValueFor(OUString const & _aLocale) const;
+ bool hasValueFor(rtl::OUString const & _aLocale) const;
bool hasValue() const { return hasValueFor(primarySlot()); }
- bool hasResetFor(OUString const & _aLocale) const;
+ bool hasResetFor(rtl::OUString const & _aLocale) const;
bool hasReset() const { return hasResetFor(primarySlot()); }
- bool hasChangeFor(OUString const & _aLocale) const;
+ bool hasChangeFor(rtl::OUString const & _aLocale) const;
bool hasChange() const { return hasChangeFor(primarySlot()); }
- ValueUpdate getValueFor(OUString const & _aLocale) const;
- ValueUpdate getValue() const { return getValueFor(primarySlot()); }
+ uno::Any getValueFor(rtl::OUString const & _aLocale) const;
+ uno::Any getValue() const { return getValueFor(primarySlot()); }
- typedef ValueList::const_iterator Iterator;
- Iterator beginValues() const { return m_aValues.begin(); }
- Iterator endValues() const { return m_aValues.end(); }
+ ValueList::const_iterator beginValues() const { return m_aValues.begin(); }
+ ValueList::const_iterator endValues() const { return m_aValues.end(); }
- void writeValueToLayerFor(backenduno::XLayerHandler * _pLayer, ValueUpdate const & _aValue, OUString const & _aLocale);
- void writeValueToLayer(backenduno::XLayerHandler * _pLayer, ValueUpdate const & _aValue);
+ void writeValueToLayerFor(backenduno::XLayerHandler * _pLayer, uno::Any const & _aValue, rtl::OUString const & _aLocale);
+ void writeValueToLayer(backenduno::XLayerHandler * _pLayer, uno::Any const & _aValue);
void writeValuesToLayer(backenduno::XLayerHandler * _pLayer);
virtual void writeToLayer(backenduno::XLayerHandler * _pLayer);
private:
- OUString primarySlot() const { return OUString(); }
+ rtl::OUString primarySlot() const { return rtl::OUString(); }
static uno::Any const & getResetMarker();
static inline bool isResetMarker(uno::Any const & _aValue);
@@ -243,8 +238,8 @@ namespace configmgr
uno::Type m_aValueType;
uno::Any m_aValue;
public:
- PropertyAdd(NodeUpdate * _pParent, OUString const & _aName, sal_Int16 _nFlags, uno::Type const & _aType);
- PropertyAdd(NodeUpdate * _pParent, OUString const & _aName, sal_Int16 _nFlags, uno::Any const & _aValue);
+ PropertyAdd(NodeUpdate * _pParent, rtl::OUString const & _aName, sal_Int16 _nFlags, uno::Type const & _aType);
+ PropertyAdd(NodeUpdate * _pParent, rtl::OUString const & _aName, sal_Int16 _nFlags, uno::Any const & _aValue);
bool hasValue() const { return !! m_aValue.hasValue(); }
uno::Any const & getValue() const { return m_aValue; }
@@ -257,7 +252,7 @@ namespace configmgr
class PropertyReset : public ElementUpdate
{
public:
- PropertyReset(NodeUpdate * _pParent, OUString const & _aName);
+ PropertyReset(NodeUpdate * _pParent, rtl::OUString const & _aName);
virtual void writeToLayer(backenduno::XLayerHandler * _pLayer);
};
diff --git a/configmgr/source/backend/updatedispatch.cxx b/configmgr/source/backend/updatedispatch.cxx
index bd456ae969..d4c44846cc 100644
--- a/configmgr/source/backend/updatedispatch.cxx
+++ b/configmgr/source/backend/updatedispatch.cxx
@@ -31,13 +31,10 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_configmgr.hxx"
+#include "treefragment.hxx"
#include "updatedispatch.hxx"
#include "configpath.hxx"
#include "node.hxx"
-#include "treeaccessor.hxx"
-#include "valuenodeaccess.hxx"
-#include "groupnodeaccess.hxx"
-#include "setnodeaccess.hxx"
#include "matchlocale.hxx"
#include <com/sun/star/configuration/backend/XUpdateHandler.hpp>
@@ -50,7 +47,7 @@ namespace configmgr
{
// -----------------------------------------------------------------------------
-UpdateDispatcher::UpdateDispatcher(UpdateHandler const & _xUpdateHandler, OUString const & _aLocale)
+UpdateDispatcher::UpdateDispatcher(uno::Reference< backenduno::XUpdateHandler > const & _xUpdateHandler, rtl::OUString const & _aLocale)
: m_pContextPath(NULL)
, m_xUpdateHandler(_xUpdateHandler)
, m_aLocale(_aLocale)
@@ -70,7 +67,7 @@ void UpdateDispatcher::dispatchUpdate(configuration::AbsolutePath const & _aRoot
{
if (!m_xUpdateHandler.is())
{
- OUString sMsg( RTL_CONSTASCII_USTRINGPARAM("ERROR: Cannot dispatch update - no handler found") );
+ rtl::OUString sMsg( RTL_CONSTASCII_USTRINGPARAM("ERROR: Cannot dispatch update - no handler found") );
throw uno::RuntimeException(sMsg,NULL);
}
@@ -96,19 +93,19 @@ void UpdateDispatcher::startUpdate()
m_xUpdateHandler->startUpdate();
m_bInValueSet = false;
m_bInLocalizedValues = false;
- m_aElementName = OUString();
+ m_aElementName = rtl::OUString();
if (m_pContextPath)
{
- configuration::AbsolutePath::Iterator it = m_pContextPath->begin();
- configuration::AbsolutePath::Iterator stop = m_pContextPath->end();
+ std::vector<configuration::Path::Component>::const_reverse_iterator it = m_pContextPath->begin();
+ std::vector<configuration::Path::Component>::const_reverse_iterator stop = m_pContextPath->end();
OSL_ASSERT(it != stop);
--stop;
for ( ; it != stop; ++it)
{
- m_xUpdateHandler->modifyNode(it->getName().toString(),0,0,false);
+ m_xUpdateHandler->modifyNode(it->getName(),0,0,false);
}
}
}
@@ -118,8 +115,8 @@ void UpdateDispatcher::endUpdate()
{
if (m_pContextPath)
{
- configuration::AbsolutePath::Iterator it = m_pContextPath->begin();
- configuration::AbsolutePath::Iterator stop = m_pContextPath->end();
+ std::vector<configuration::Path::Component>::const_reverse_iterator it = m_pContextPath->begin();
+ std::vector<configuration::Path::Component>::const_reverse_iterator stop = m_pContextPath->end();
OSL_ASSERT(it != stop);
--stop;
@@ -138,7 +135,7 @@ void UpdateDispatcher::handle(ValueChange const& aValueNode)
// special case: doing members of a localized property (as set)
if (m_bInLocalizedValues)
{
- OUString aLocale = aValueNode.getNodeName();
+ rtl::OUString aLocale = aValueNode.getNodeName();
if (aLocale.getLength())
{
@@ -225,15 +222,14 @@ void UpdateDispatcher::handle(ValueChange const& aValueNode)
void UpdateDispatcher::handle(AddNode const& aAddNode)
{
- data::TreeSegment aAddedTree = aAddNode.getNewTree();
+ rtl::Reference< data::TreeSegment > aAddedTree = aAddNode.getNewTree();
OSL_ENSURE(aAddedTree.is(), "AddNode has no new data -> cannot add anything");
- OSL_ENSURE( !aAddedTree.is() ||
- ((m_bInValueSet||m_bInLocalizedValues) == aAddedTree.getSegmentRootNode()->isValue()),
+ OSL_ENSURE( ((m_bInValueSet||m_bInLocalizedValues) == aAddedTree->fragment->nodes[0].isValue()),
"Found added subtree in value set (extensible group)\n" );
- this->visitTree( aAddedTree.getTreeAccess() );
+ this->visitTree(aAddedTree->fragment);
}
// -----------------------------------------------------------------------------
@@ -241,10 +237,10 @@ void UpdateDispatcher::handle(RemoveNode const& aRemoveNode)
{
OSL_ENSURE( !m_bInLocalizedValues, "UpdateDispatcher: Removing values for a specific locale is currently not supported");
- data::TreeSegment aRemovedTree = aRemoveNode.getRemovedTree();
+ rtl::Reference< data::TreeSegment > aRemovedTree = aRemoveNode.getRemovedTree();
- OSL_ENSURE( !aRemovedTree.is() ||
- ((m_bInValueSet||m_bInLocalizedValues) == aRemovedTree.getSegmentRootNode()->isValue()),
+ OSL_ENSURE( !aRemovedTree.is() ||
+ ((m_bInValueSet||m_bInLocalizedValues) == aRemovedTree->fragment->nodes[0].isValue()),
"Found removed subtree in value set (extensible group)\n" );
if (m_bInLocalizedValues)
@@ -294,128 +290,128 @@ void UpdateDispatcher::handle(SubtreeChange const& aSubtree)
}
// -----------------------------------------------------------------------------
-data::SetVisitor::Result UpdateDispatcher::handle(data::ValueNodeAccess const& _aNode)
+bool UpdateDispatcher::handle(sharable::ValueNode * node)
{
- OUString aName;
+ rtl::OUString aName;
// special case: doing members of a localized property (as set)
if (m_bInLocalizedValues)
{
// the node name is the locale
- OUString aLocale;
- OSL_VERIFY(testReplacedAndGetName(_aNode,aLocale)); // "Adding a localized subvalue but not as root of element tree"
+ rtl::OUString aLocale;
+ OSL_VERIFY(testReplacedAndGetName(sharable::node(node), aLocale)); // "Adding a localized subvalue but not as root of element tree"
if (aLocale.getLength() && ! localehelper::isDefaultLanguage(aLocale))
{
- m_xUpdateHandler->setPropertyValueForLocale( _aNode.getValue(), aLocale );
+ m_xUpdateHandler->setPropertyValueForLocale(node->getValue(), aLocale);
}
else
{
- m_xUpdateHandler->setPropertyValue( _aNode.getValue() );
+ m_xUpdateHandler->setPropertyValue(node->getValue());
}
}
- else if (testReplacedAndGetName(_aNode,aName)&& (_aNode.getAttributes().isRemovable()) ) // we must be inside a set of values
+ else if (testReplacedAndGetName(sharable::node(node), aName) && sharable::node(node)->getAttributes().isRemovable()) // we must be inside a set of values
{
- OSL_ENSURE(!_aNode.isLocalized(), "UpdateDispatcher: Cannot add a localized value in a layer .");
+ OSL_ENSURE(!node->info.isLocalized(), "UpdateDispatcher: Cannot add a localized value in a layer .");
- sal_Int16 nAttr = getUpdateAttributes(_aNode.getAttributes(),true);
+ sal_Int16 nAttr = getUpdateAttributes(sharable::node(node)->getAttributes(),true);
- if (!_aNode.isNull())
+ if (!node->isNull())
{
m_xUpdateHandler->addOrReplacePropertyWithValue( aName,
nAttr,
- _aNode.getValue());
+ node->getValue());
}
else
{
m_xUpdateHandler->addOrReplaceProperty( aName,
nAttr,
- _aNode.getValueType());
+ node->getValueType());
}
}
else // normal case: updating a single property //Inserting set
{
- sal_Int16 nAttr = getUpdateAttributes(_aNode.getAttributes(),false);
- sal_Int16 nAttrMask = getUpdateAttributeMask(_aNode.getAttributes());
+ sal_Int16 nAttr = getUpdateAttributes(sharable::node(node)->getAttributes(),false);
+ sal_Int16 nAttrMask = getUpdateAttributeMask(sharable::node(node)->getAttributes());
- m_xUpdateHandler->modifyProperty( aName, nAttr, nAttrMask, _aNode.getValueType() );
+ m_xUpdateHandler->modifyProperty( aName, nAttr, nAttrMask, node->getValueType() );
- if (_aNode.isLocalized() && m_aLocale.getLength())
+ if (node->info.isLocalized() && m_aLocale.getLength())
{
- m_xUpdateHandler->setPropertyValueForLocale( _aNode.getValue(), m_aLocale );
+ m_xUpdateHandler->setPropertyValueForLocale(node->getValue(), m_aLocale);
}
else
{
- m_xUpdateHandler->setPropertyValue( _aNode.getValue() );
+ m_xUpdateHandler->setPropertyValue(node->getValue());
}
m_xUpdateHandler->endProperty();
}
- return CONTINUE;
+ return false;
}
// -----------------------------------------------------------------------------
-data::SetVisitor::Result UpdateDispatcher::handle(data::GroupNodeAccess const& _aNode)
+bool UpdateDispatcher::handle(sharable::GroupNode * node)
{
OSL_ENSURE( !m_bInLocalizedValues, "UpdateDispatcher: A localized value cannot be a complete group");
- OUString aName;
+ rtl::OUString aName;
- if ( testReplacedAndGetName(_aNode,aName) )
+ if ( testReplacedAndGetName(sharable::node(node), aName) )
{
- sal_Int16 nAttr = getUpdateAttributes(_aNode.getAttributes(),true);
+ sal_Int16 nAttr = getUpdateAttributes(sharable::node(node)->getAttributes(),true);
m_xUpdateHandler->addOrReplaceNode( aName, nAttr );
- this->visitChildren(_aNode);
+ this->visitChildren(node);
m_xUpdateHandler->endNode();
}
else
{
- sal_Int16 nAttr = getUpdateAttributes(_aNode.getAttributes(),false);
- sal_Int16 nAttrMask = getUpdateAttributeMask(_aNode.getAttributes());
+ sal_Int16 nAttr = getUpdateAttributes(sharable::node(node)->getAttributes(),false);
+ sal_Int16 nAttrMask = getUpdateAttributeMask(sharable::node(node)->getAttributes());
m_xUpdateHandler->modifyNode( aName, nAttr, nAttrMask, false );
- this->visitChildren(_aNode);
+ this->visitChildren(node);
m_xUpdateHandler->endNode();
}
- return CONTINUE;
+ return false;
}
// -----------------------------------------------------------------------------
-data::SetVisitor::Result UpdateDispatcher::handle(data::SetNodeAccess const& _aNode)
+bool UpdateDispatcher::handle(sharable::SetNode * node)
{
OSL_ENSURE( !m_bInLocalizedValues, "UpdateDispatcher: A localized value cannot be a complete set");
- OUString aName;
+ rtl::OUString aName;
- if ( testReplacedAndGetName(_aNode,aName) )
+ if ( testReplacedAndGetName(sharable::node(node), aName) )
{
- OSL_ENSURE( !_aNode.isLocalizedValueSetNode(), "UpdateDispatcher: Cannot add a localized value in a layer." );
+ OSL_ENSURE( !node->info.isLocalized(), "UpdateDispatcher: Cannot add a localized value in a layer." );
- sal_Int16 nAttr = getUpdateAttributes(_aNode.getAttributes(),true);
+ sal_Int16 nAttr = getUpdateAttributes(sharable::node(node)->getAttributes(),true);
m_xUpdateHandler->addOrReplaceNode( aName, nAttr );
- this->visitElements(_aNode);
+ this->visitElements(node);
m_xUpdateHandler->endNode();
}
else
{
- sal_Int16 nAttr = getUpdateAttributes(_aNode.getAttributes(),false);
- sal_Int16 nAttrMask = getUpdateAttributeMask(_aNode.getAttributes());
+ sal_Int16 nAttr = getUpdateAttributes(sharable::node(node)->getAttributes(),false);
+ sal_Int16 nAttrMask = getUpdateAttributeMask(sharable::node(node)->getAttributes());
- if (_aNode.isLocalizedValueSetNode())
+ if (node->info.isLocalized())
{
m_xUpdateHandler->modifyProperty( aName, nAttr, nAttrMask, uno::Type() );
m_bInLocalizedValues = true;
- this->visitElements(_aNode);
+ this->visitElements(node);
m_bInLocalizedValues = false;
m_xUpdateHandler->endProperty();
@@ -425,39 +421,39 @@ data::SetVisitor::Result UpdateDispatcher::handle(data::SetNodeAccess const& _aN
{
m_xUpdateHandler->modifyNode( aName, nAttr, nAttrMask, false );
- this->visitElements(_aNode);
+ this->visitElements(node);
m_xUpdateHandler->endNode();
}
}
- return CONTINUE;
+ return false;
}
// -----------------------------------------------------------------------------
-bool UpdateDispatcher::testReplacedAndGetName(data::NodeAccess const & _aNode, OUString & _aName)
+bool UpdateDispatcher::testReplacedAndGetName(sharable::Node * node, rtl::OUString & _aName)
{
if (m_aElementName.getLength())
{
- OSL_ENSURE( _aNode->isFragmentRoot(), "ERROR - UpdateDispatcher: Found orphaned 'element' name for inner node");
+ OSL_ENSURE( node->isFragmentRoot(), "ERROR - UpdateDispatcher: Found orphaned 'element' name for inner node");
_aName = m_aElementName;
- m_aElementName = OUString();
+ m_aElementName = rtl::OUString();
return true;
}
else
{
- OSL_ENSURE(!_aNode->isFragmentRoot(), "ERROR - UpdateDispatcher: Found no 'element' name for fragment root node");
- _aName = _aNode.getName().toString();
+ OSL_ENSURE(!node->isFragmentRoot(), "ERROR - UpdateDispatcher: Found no 'element' name for fragment root node");
+ _aName = node->getName();
return false;
}
}
// -----------------------------------------------------------------------------
-data::SetVisitor::Result UpdateDispatcher::handle(data::TreeAccessor const& _aElement)
+bool UpdateDispatcher::handle(sharable::TreeFragment * tree)
{
- m_aElementName = _aElement.getName().toString();
- Result aRes = SetVisitor::handle(_aElement); // dispatch to root node
- m_aElementName = OUString(); // clear - just to be safe
- return aRes;
+ m_aElementName = tree->getName();
+ bool done = SetVisitor::handle(tree); // dispatch to root node
+ m_aElementName = rtl::OUString(); // clear - just to be safe
+ return done;
}
// -----------------------------------------------------------------------------
diff --git a/configmgr/source/backend/updatedispatch.hxx b/configmgr/source/backend/updatedispatch.hxx
index c5c4bd1cb7..642f8e1a9c 100644
--- a/configmgr/source/backend/updatedispatch.hxx
+++ b/configmgr/source/backend/updatedispatch.hxx
@@ -34,6 +34,7 @@
#include "change.hxx"
#include "nodevisitor.hxx"
#include "utility.hxx"
+#include <boost/utility.hpp>
#include <com/sun/star/uno/Reference.hxx>
namespace com { namespace sun { namespace star { namespace configuration { namespace backend {
@@ -56,11 +57,10 @@ namespace configmgr
// -----------------------------------------------------------------------------
- class UpdateDispatcher : ChangeTreeAction, data::SetVisitor, Noncopyable
+ class UpdateDispatcher: private boost::noncopyable, private ChangeTreeAction, private data::SetVisitor
{
public:
- typedef uno::Reference< backenduno::XUpdateHandler > UpdateHandler;
- UpdateDispatcher(UpdateHandler const & _xUpdateHandler, OUString const & _aLocale);
+ UpdateDispatcher(uno::Reference< backenduno::XUpdateHandler > const & _xUpdateHandler, rtl::OUString const & _aLocale);
~UpdateDispatcher();
void dispatchUpdate(configuration::AbsolutePath const & _aRootPath, SubtreeChange const& _anUpdate);
@@ -77,20 +77,20 @@ namespace configmgr
virtual void handle(RemoveNode const& aRemoveNode);
virtual void handle(SubtreeChange const& aSubtree) ;
- virtual Result handle(data::ValueNodeAccess const& _aNode);
- virtual Result handle(data::GroupNodeAccess const& _aNode);
- virtual Result handle(data::SetNodeAccess const& _aNode);
- virtual Result handle(data::TreeAccessor const& _aElement);
+ virtual bool handle(sharable::ValueNode * node);
+ virtual bool handle(sharable::GroupNode * node);
+ virtual bool handle(sharable::SetNode * node);
+ virtual bool handle(sharable::TreeFragment * tree);
private:
sal_Int16 getUpdateAttributes(node::Attributes const & _aAttributes, bool bAdded);
sal_Int16 getUpdateAttributeMask(node::Attributes const & _aAttributes);
- bool testReplacedAndGetName(data::NodeAccess const & _aNode, OUString & _aName);
+ bool testReplacedAndGetName(sharable::Node * node, rtl::OUString & _aName);
private:
configuration::AbsolutePath const * m_pContextPath;
- UpdateHandler m_xUpdateHandler;
- OUString m_aLocale;
- OUString m_aElementName;
+ uno::Reference< backenduno::XUpdateHandler > m_xUpdateHandler;
+ rtl::OUString m_aLocale;
+ rtl::OUString m_aElementName;
bool m_bInValueSet;
bool m_bInLocalizedValues;
};
diff --git a/configmgr/source/backend/updatesvc.cxx b/configmgr/source/backend/updatesvc.cxx
index 44194079d2..ed042dc37d 100644
--- a/configmgr/source/backend/updatesvc.cxx
+++ b/configmgr/source/backend/updatesvc.cxx
@@ -56,7 +56,7 @@ namespace configmgr
namespace backenduno = ::com::sun::star::configuration::backend;
// -----------------------------------------------------------------------------
-AsciiServiceName const aUpdateMergerServices[] =
+sal_Char const * const aUpdateMergerServices[] =
{
"com.sun.star.configuration.backend.LayerUpdateMerger",
0
@@ -81,13 +81,13 @@ ServiceInfoHelper UpdateService::getServiceInfo()
// -----------------------------------------------------------------------------
-UpdateService::UpdateService(CreationArg _xContext)
+UpdateService::UpdateService(uno::Reference< uno::XComponentContext > const & _xContext)
: m_xServiceFactory(_xContext->getServiceManager(),uno::UNO_QUERY)
, m_aSourceMode(merge)
{
if (!m_xServiceFactory.is())
{
- OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Configuration Update Merger: Context has no service manager (or missing interface)"));
+ rtl::OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Configuration Update Merger: Context has no service manager (or missing interface)"));
throw uno::RuntimeException(sMessage,NULL);
}
}
@@ -103,7 +103,7 @@ void SAL_CALL
if (sal_Int32(nCount) != aArguments.getLength())
{
- OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Too many arguments to initialize a Configuration Update Merger"));
+ rtl::OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Too many arguments to initialize a Configuration Update Merger"));
throw lang::IllegalArgumentException(sMessage,*this,0);
}
@@ -134,7 +134,7 @@ void SAL_CALL
continue;
}
- OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Cannot use argument to initialize a Configuration Update Merger"
+ rtl::OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Cannot use argument to initialize a Configuration Update Merger"
"- XLayer, XLayerHandler or XUpdatableLayer expected"));
throw lang::IllegalArgumentException(sMessage,*this,i);
}
@@ -142,7 +142,7 @@ void SAL_CALL
// -----------------------------------------------------------------------------
-sal_Bool UpdateService::setImplementationProperty(OUString const & aName, uno::Any const & aValue)
+sal_Bool UpdateService::setImplementationProperty(rtl::OUString const & aName, uno::Any const & aValue)
{
if (aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("Overwrite")))
{
@@ -197,7 +197,7 @@ bool UpdateService::validateSourceLayerAndCheckNotEmpty() SAL_THROW( (lang::Ille
}
// -----------------------------------------------------------------------------
-UpdateService::Layer UpdateService::getSourceLayer() SAL_THROW( (lang::IllegalAccessException) )
+uno::Reference< backenduno::XLayer > UpdateService::getSourceLayer() SAL_THROW( (lang::IllegalAccessException) )
{
if ( validateSourceLayerAndCheckNotEmpty() )
return m_xSourceLayer;
@@ -209,18 +209,18 @@ UpdateService::Layer UpdateService::getSourceLayer() SAL_THROW( (lang::IllegalAc
void UpdateService::raiseIllegalAccessException(sal_Char const * pMsg)
SAL_THROW( (lang::IllegalAccessException) )
{
- OUString sMsg = OUString::createFromAscii(pMsg);
+ rtl::OUString sMsg = rtl::OUString::createFromAscii(pMsg);
throw lang::IllegalAccessException(sMsg,*this);
}
// -----------------------------------------------------------------------------
-void UpdateService::writeUpdatedLayer(Layer const & _xLayer)
+void UpdateService::writeUpdatedLayer(uno::Reference< backenduno::XLayer > const & _xLayer)
{
OSL_ENSURE( _xLayer.is(), "UpdateService: Trying to write NULL XLayer");
if (!_xLayer.is())
{
- OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Update Merger - Internal error: trying to write a NULL Layer"));
+ rtl::OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Update Merger - Internal error: trying to write a NULL Layer"));
throw uno::RuntimeException(sMessage,*this);
}
@@ -239,7 +239,7 @@ void UpdateService::writeUpdatedLayer(Layer const & _xLayer)
return;
}
- OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Update Merger: Cannot write merge results - no recipient available."));
+ rtl::OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Update Merger: Cannot write merge results - no recipient available."));
throw uno::RuntimeException(sMessage,*this);
}
// -----------------------------------------------------------------------------
diff --git a/configmgr/source/backend/updatesvc.hxx b/configmgr/source/backend/updatesvc.hxx
index e0d0c619e7..cf40e25e5f 100644
--- a/configmgr/source/backend/updatesvc.hxx
+++ b/configmgr/source/backend/updatesvc.hxx
@@ -53,7 +53,6 @@ namespace configmgr
namespace backend
{
// -----------------------------------------------------------------------------
- using rtl::OUString;
namespace uno = ::com::sun::star::uno;
namespace lang = ::com::sun::star::lang;
namespace backenduno = ::com::sun::star::configuration::backend;
@@ -66,10 +65,8 @@ namespace configmgr
>
{
public:
- typedef uno::Reference< uno::XComponentContext > const & CreationArg;
-
explicit
- UpdateService(CreationArg _xContext);
+ UpdateService(uno::Reference< uno::XComponentContext > const & _xContext);
// XInitialization
virtual void SAL_CALL
@@ -90,20 +87,17 @@ namespace configmgr
throw (uno::RuntimeException);
protected:
- typedef uno::Reference< lang::XMultiServiceFactory > ServiceFactory;
- typedef uno::Reference< backenduno::XLayer > Layer;
-
- ServiceFactory getServiceFactory() const
+ uno::Reference< lang::XMultiServiceFactory > getServiceFactory() const
{ return m_xServiceFactory; }
void checkSourceLayer() SAL_THROW( (lang::IllegalAccessException) )
{ validateSourceLayerAndCheckNotEmpty(); }
- Layer getSourceLayer() SAL_THROW( (lang::IllegalAccessException) );
+ uno::Reference< backenduno::XLayer > getSourceLayer() SAL_THROW( (lang::IllegalAccessException) );
- void writeUpdatedLayer(Layer const & _xLayer);
+ void writeUpdatedLayer(uno::Reference< backenduno::XLayer > const & _xLayer);
- virtual sal_Bool setImplementationProperty(OUString const & aName, uno::Any const & aValue);
+ virtual sal_Bool setImplementationProperty(rtl::OUString const & aName, uno::Any const & aValue);
void raiseIllegalAccessException(sal_Char const * pMsg)
SAL_THROW( (lang::IllegalAccessException) );
@@ -112,11 +106,9 @@ namespace configmgr
bool validateSourceLayerAndCheckNotEmpty() SAL_THROW( (lang::IllegalAccessException) );
private:
- typedef uno::Reference< backenduno::XLayerHandler > LayerWriter;
-
- ServiceFactory m_xServiceFactory;
- Layer m_xSourceLayer;
- LayerWriter m_xLayerWriter;
+ uno::Reference< lang::XMultiServiceFactory > m_xServiceFactory;
+ uno::Reference< backenduno::XLayer > m_xSourceLayer;
+ uno::Reference< backenduno::XLayerHandler > m_xLayerWriter;
enum { merge, truncate, protect } m_aSourceMode;
static ServiceInfoHelper getServiceInfo();
diff --git a/configmgr/source/backendhelper/backendlayerhelper.cxx b/configmgr/source/backendhelper/backendlayerhelper.cxx
index 6fe30b2d55..f58f187ecb 100644
--- a/configmgr/source/backendhelper/backendlayerhelper.cxx
+++ b/configmgr/source/backendhelper/backendlayerhelper.cxx
@@ -279,7 +279,7 @@ void buildNodeTree(
//------------------------------------------------------------------------------
BackendLayerHelper::BackendLayerHelper(
const uno::Reference<uno::XComponentContext>& /*xContext*/)
- :BackendBase(mMutex)
+ :cppu::WeakComponentImplHelper2<backend::XLayerContentDescriber, lang::XServiceInfo>(mMutex)
{
}
//------------------------------------------------------------------------------
diff --git a/configmgr/source/backendhelper/backendlayerhelper.hxx b/configmgr/source/backendhelper/backendlayerhelper.hxx
index 0242aa1613..785293d147 100644
--- a/configmgr/source/backendhelper/backendlayerhelper.hxx
+++ b/configmgr/source/backendhelper/backendlayerhelper.hxx
@@ -46,15 +46,12 @@ namespace lang = css::lang ;
namespace backend = css::configuration::backend ;
//------------------------------------------------------------------------------
-typedef cppu::WeakComponentImplHelper2<backend::XLayerContentDescriber,
- lang::XServiceInfo> BackendBase ;
-
/**
* Implements the LayerContentDescriber service.
* Describes a set of configuration data to an XLayerHandler
* Object
*/
-class BackendLayerHelper : public BackendBase {
+class BackendLayerHelper : public cppu::WeakComponentImplHelper2<backend::XLayerContentDescriber, lang::XServiceInfo> {
public :
/**
Service constructor from a service factory.
@@ -139,8 +136,7 @@ public:
IOONode* getChild(const rtl::OUString& aChildName);
private:
- typedef std::vector<IOONode*> ChildList;
- ChildList mChildList;
+ std::vector<IOONode*> mChildList;
};
//------------------------------------------------------------------------------
class OOProperty :public IOONode
diff --git a/configmgr/source/backendhelper/componentdf.cxx b/configmgr/source/backendhelper/componentdf.cxx
index 3ecf66c08c..21aaf76795 100644
--- a/configmgr/source/backendhelper/componentdf.cxx
+++ b/configmgr/source/backendhelper/componentdf.cxx
@@ -36,14 +36,11 @@
#include <cppuhelper/implementationentry.hxx>
#endif // _CPPUHELPER_IMPLEMENTATIONENTRY_HXX_
-
-using namespace configmgr::backendhelper ;
-
//==============================================================================
-static uno::Reference<uno::XInterface> SAL_CALL createBackendLayerHelper(
- const uno::Reference<uno::XComponentContext>& aContext) {
- return * new BackendLayerHelper(aContext) ;
+static com::sun::star::uno::Reference<com::sun::star::uno::XInterface> SAL_CALL createBackendLayerHelper(
+ const com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext>& aContext) {
+ return * new configmgr::backendhelper::BackendLayerHelper(aContext) ;
}
//==============================================================================
@@ -53,8 +50,8 @@ static const cppu::ImplementationEntry kImplementations_entries[] =
{
{
createBackendLayerHelper,
- BackendLayerHelper::getBackendLayerHelperName,
- BackendLayerHelper::getBackendLayerHelperServiceNames,
+ configmgr::backendhelper::BackendLayerHelper::getBackendLayerHelperName,
+ configmgr::backendhelper::BackendLayerHelper::getBackendLayerHelperServiceNames,
cppu::createSingleComponentFactory,
NULL,
0
diff --git a/configmgr/source/data/anydata.cxx b/configmgr/source/data/anydata.cxx
index cf652a43c8..e92b59faf3 100644
--- a/configmgr/source/data/anydata.cxx
+++ b/configmgr/source/data/anydata.cxx
@@ -44,10 +44,9 @@ namespace configmgr
//-----------------------------------------------------------------------------
namespace Type = data::Type;
namespace uno = ::com::sun::star::uno;
- typedef AnyData::TypeCode TypeCode;
//-----------------------------------------------------------------------------
-TypeCode getTypeCode(uno::Type const & _aType)
+sal_uInt8 getTypeCode(uno::Type const & _aType)
{
switch (_aType.getTypeClass())
{
@@ -82,14 +81,14 @@ TypeCode getTypeCode(uno::Type const & _aType)
return Type::value_binary;
OSL_ASSERT(aElementType != _aType); // would cause infinite recursion
- TypeCode aElementTC = getTypeCode(aElementType);
+ sal_uInt8 aElementTC = getTypeCode(aElementType);
OSL_ASSERT(Type::value_invalid & Type::flag_sequence); // ensure check works for invalid types
if (aElementTC & Type::flag_sequence) // no sequence of sequence
return Type::value_invalid;
- return TypeCode( aElementTC | Type::flag_sequence );
+ return sal_uInt8( aElementTC | Type::flag_sequence );
}
default:
return Type::value_invalid;
@@ -97,7 +96,7 @@ TypeCode getTypeCode(uno::Type const & _aType)
}
//-----------------------------------------------------------------------------
-static uno::Type getUnoSimpleType( TypeCode _aSimpleType)
+static uno::Type getUnoSimpleType( sal_uInt8 _aSimpleType)
{
OSL_ENSURE( _aSimpleType == (_aSimpleType & Type::mask_basetype), "Invalid type code" );
@@ -135,7 +134,7 @@ static uno::Type getUnoSimpleType( TypeCode _aSimpleType)
}
//-----------------------------------------------------------------------------
-static uno::Type getUnoSequenceType( TypeCode _aSimpleType)
+static uno::Type getUnoSequenceType( sal_uInt8 _aSimpleType)
{
OSL_ENSURE( _aSimpleType == (_aSimpleType & Type::mask_basetype), "Invalid type code" );
@@ -170,12 +169,12 @@ static uno::Type getUnoSequenceType( TypeCode _aSimpleType)
}
//-----------------------------------------------------------------------------
-uno::Type getUnoType( TypeCode _aType)
+uno::Type getUnoType( sal_uInt8 _aType)
{
OSL_ENSURE( _aType == (_aType & Type::mask_valuetype), "Invalid type code" );
if (_aType & Type::flag_sequence)
- return getUnoSequenceType( TypeCode(_aType & Type::mask_basetype));
+ return getUnoSequenceType( sal_uInt8(_aType & Type::mask_basetype));
else
return getUnoSimpleType(_aType);
@@ -183,7 +182,7 @@ uno::Type getUnoType( TypeCode _aType)
//-----------------------------------------------------------------------------
static
-AnyData allocSimpleData(TypeCode _aSimpleType, uno::Any const & _aAny)
+AnyData allocSimpleData(sal_uInt8 _aSimpleType, uno::Any const & _aAny)
{
OSL_ENSURE( _aSimpleType == (_aSimpleType & Type::mask_basetype), "Invalid type code" );
@@ -196,7 +195,7 @@ AnyData allocSimpleData(TypeCode _aSimpleType, uno::Any const & _aAny)
{
rtl::OUString sValue;
OSL_VERIFY(_aAny >>= sValue );
- aResult.stringValue = allocString(sValue);
+ aResult.stringValue = acquireString(sValue);
}
break;
@@ -269,11 +268,11 @@ sal_Sequence const * extractSequenceData(uno::Sequence< E > & _rSeq, uno::Any co
//-----------------------------------------------------------------------------
static
-AnyData allocSequenceData(TypeCode _aSimpleType, uno::Any const & _aAny)
+AnyData allocSequenceData(sal_uInt8 _aSimpleType, uno::Any const & _aAny)
{
OSL_ENSURE( _aSimpleType == (_aSimpleType & Type::mask_basetype), "Invalid type code" );
- Sequence aSequence = 0;
+ sal_uInt8 * aSequence = 0;
switch (_aSimpleType)
{
@@ -345,27 +344,27 @@ AnyData allocSequenceData(TypeCode _aSimpleType, uno::Any const & _aAny)
}
//-----------------------------------------------------------------------------
-AnyData allocData(TypeCode _aType, uno::Any const & _aAny)
+AnyData allocData(sal_uInt8 _aType, uno::Any const & _aAny)
{
OSL_ENSURE( _aType == (_aType & Type::mask_valuetype), "Invalid type code" );
OSL_ENSURE( _aType == getTypeCode(_aAny.getValueType()), "Type code does not match value" );
if (_aType & Type::flag_sequence)
- return allocSequenceData(TypeCode( _aType & Type::mask_basetype),_aAny);
+ return allocSequenceData(sal_uInt8( _aType & Type::mask_basetype),_aAny);
else
return allocSimpleData(_aType,_aAny);
}
//-----------------------------------------------------------------------------
static
-void freeSimpleData(TypeCode _aSimpleType, AnyData const & _aData)
+void freeSimpleData(sal_uInt8 _aSimpleType, AnyData const & _aData)
{
OSL_ENSURE( _aSimpleType == (_aSimpleType & Type::mask_basetype), "Invalid type code" );
switch (_aSimpleType)
{
case Type::value_string:
- freeString(_aData.stringValue);
+ rtl_uString_release(_aData.stringValue);
break;
case Type::value_boolean:
@@ -398,12 +397,12 @@ void freeSimpleData(TypeCode _aSimpleType, AnyData const & _aData)
}
//-----------------------------------------------------------------------------
-void freeData(TypeCode _aType, AnyData _aData)
+void freeData(sal_uInt8 _aType, AnyData _aData)
{
OSL_ENSURE( _aType == (_aType & Type::mask_valuetype), "Invalid type code" );
if (_aType & Type::flag_sequence)
- freeSequence(TypeCode(_aType & Type::mask_basetype),_aData.sequenceValue);
+ freeSequence(sal_uInt8(_aType & Type::mask_basetype),_aData.sequenceValue);
else
freeSimpleData(_aType,_aData);
@@ -411,7 +410,7 @@ void freeData(TypeCode _aType, AnyData _aData)
//-----------------------------------------------------------------------------
static
-uno::Any readSimpleData(TypeCode _aSimpleType, AnyData const & _aData)
+uno::Any readSimpleData(sal_uInt8 _aSimpleType, AnyData const & _aData)
{
OSL_ENSURE( _aSimpleType == (_aSimpleType & Type::mask_basetype), "Invalid type code" );
@@ -419,7 +418,7 @@ uno::Any readSimpleData(TypeCode _aSimpleType, AnyData const & _aData)
{
case Type::value_string:
{
- rtl::OUString sValue = readString(_aData.stringValue);
+ rtl::OUString sValue = rtl::OUString(_aData.stringValue);
return uno::makeAny(sValue);
}
@@ -454,12 +453,12 @@ uno::Any readSimpleData(TypeCode _aSimpleType, AnyData const & _aData)
}
//-----------------------------------------------------------------------------
-uno::Any readData(TypeCode _aType, AnyData _aData)
+uno::Any readData(sal_uInt8 _aType, AnyData _aData)
{
OSL_ENSURE( _aType == (_aType & Type::mask_valuetype), "Invalid type code" );
if (_aType & Type::flag_sequence)
- return readAnySequence(TypeCode(_aType & Type::mask_basetype),_aData.sequenceValue);
+ return readAnySequence(sal_uInt8(_aType & Type::mask_basetype),_aData.sequenceValue);
else
return readSimpleData(_aType,_aData);
diff --git a/configmgr/source/data/makefile.mk b/configmgr/source/data/makefile.mk
index 4c88e6c0ed..83e55e27ef 100644
--- a/configmgr/source/data/makefile.mk
+++ b/configmgr/source/data/makefile.mk
@@ -30,7 +30,7 @@
#*************************************************************************
PRJ=..$/..
-PRJINC=$(PRJ)$/source
+PRJINC=$(PRJ)$/source$/inc
PRJNAME=configmgr
TARGET=data
diff --git a/configmgr/source/data/sequence.cxx b/configmgr/source/data/sequence.cxx
index 11b5d6988b..dfcd4c39b8 100644
--- a/configmgr/source/data/sequence.cxx
+++ b/configmgr/source/data/sequence.cxx
@@ -31,6 +31,7 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_configmgr.hxx"
+#include "datalock.hxx"
#include "sequence.hxx"
#include "flags.hxx"
@@ -58,10 +59,9 @@ namespace configmgr
//-----------------------------------------------------------------------------
namespace Type = data::Type;
namespace uno = ::com::sun::star::uno;
- typedef AnyData::TypeCode TypeCode;
//-----------------------------------------------------------------------------
static
-sal_uInt32 implGetElementSize(TypeCode _aElementType)
+sal_uInt32 implGetElementSize(sal_uInt8 _aElementType)
{
OSL_ASSERT(_aElementType == (_aElementType & Type::mask_basetype));
switch (_aElementType)
@@ -77,9 +77,9 @@ sal_uInt32 implGetElementSize(TypeCode _aElementType)
case Type::value_double: return sizeof(double);
- case Type::value_string: return sizeof(String);
+ case Type::value_string: return sizeof(rtl_uString *);
- case Type::value_binary: return sizeof(Vector);
+ case Type::value_binary: return sizeof(sal_uInt8 *);
case Type::value_any: // results from value_invalid
default:
@@ -100,18 +100,18 @@ sal_uInt32 implGetHeaderSize(sal_uInt32 _nElemSize)
//-----------------------------------------------------------------------------
static
inline
-sal_Int32& implGetSize(Sequence _aSeq)
+sal_Int32& implGetSize(sal_uInt8 * _aSeq)
{
return * (sal_Int32 *) _aSeq;
}
//-----------------------------------------------------------------------------
static
-Sequence implSeqAlloc(sal_Int32 _nElements, sal_uInt32 _nElemSize)
+sal_uInt8 * implSeqAlloc(sal_Int32 _nElements, sal_uInt32 _nElemSize)
{
sal_uInt32 nTotalSize = implGetHeaderSize(_nElemSize) + _nElements * _nElemSize;
- Sequence aResult = (Sequence) (new sal_uInt8[nTotalSize]);
+ sal_uInt8 * aResult = (sal_uInt8 *) (new sal_uInt8[nTotalSize]);
implGetSize(aResult) = _nElements;
@@ -122,7 +122,7 @@ Sequence implSeqAlloc(sal_Int32 _nElements, sal_uInt32 _nElemSize)
static
void allocSeqData(sal_uInt8 *_pDestAddr,
- TypeCode _aElementType,
+ sal_uInt8 _aElementType,
sal_Int32 _nElements, sal_uInt32 _nElementSize,
void const * _pSourceData)
{
@@ -140,15 +140,15 @@ void allocSeqData(sal_uInt8 *_pDestAddr,
case Type::value_string:
{
- OSL_ASSERT(_nElementSize == sizeof(String));
+ OSL_ASSERT(_nElementSize == sizeof(rtl_uString *));
rtl::OUString const * pSource = static_cast<rtl::OUString const *>(_pSourceData);
while (--_nElements >= 0)
{
- String aElement = allocString(*pSource);
+ rtl_uString * aElement = acquireString(*pSource);
- String * pDest = reinterpret_cast<String*>(_pDestAddr);
+ rtl_uString * * pDest = reinterpret_cast<rtl_uString **>(_pDestAddr);
*pDest = aElement;
++pSource;
@@ -159,16 +159,15 @@ void allocSeqData(sal_uInt8 *_pDestAddr,
case Type::value_binary:
{
- OSL_ASSERT(_nElementSize == sizeof(Vector));
+ OSL_ASSERT(_nElementSize == sizeof(sal_uInt8 *));
- typedef uno::Sequence< sal_Int8 > BinSequence;
- BinSequence const * pSource = static_cast<BinSequence const *>(_pSourceData);
+ uno::Sequence< sal_Int8 > const * pSource = static_cast<uno::Sequence< sal_Int8 > const *>(_pSourceData);
while (--_nElements >= 0)
{
- Vector aElement = allocBinary(*pSource);
+ sal_uInt8 * aElement = allocBinary(*pSource);
- Vector * pDest = (Vector *) _pDestAddr;
+ sal_uInt8 * * pDest = (sal_uInt8 * *) _pDestAddr;
*pDest = aElement;
++pSource;
@@ -185,7 +184,7 @@ void allocSeqData(sal_uInt8 *_pDestAddr,
}
//-----------------------------------------------------------------------------
-Sequence allocSequence(TypeCode _aElementType, ::sal_Sequence const * _pSeqData)
+sal_uInt8 * allocSequence(sal_uInt8 _aElementType, ::sal_Sequence const * _pSeqData)
{
OSL_ENSURE(_aElementType == (_aElementType & Type::mask_valuetype), "Invalid type code");
@@ -198,7 +197,7 @@ Sequence allocSequence(TypeCode _aElementType, ::sal_Sequence const * _pSeqData)
sal_uInt32 const nElementSize = implGetElementSize(_aElementType);
sal_Int32 const nElements = _pSeqData->nElements;
- Sequence aResult = implSeqAlloc(nElements,nElementSize);
+ sal_uInt8 * aResult = implSeqAlloc(nElements,nElementSize);
if (aResult)
allocSeqData( aResult + implGetHeaderSize(nElementSize),
@@ -209,12 +208,12 @@ Sequence allocSequence(TypeCode _aElementType, ::sal_Sequence const * _pSeqData)
}
//-----------------------------------------------------------------------------
-Sequence allocBinary(uno::Sequence<sal_Int8> const & _aBinaryValue)
+sal_uInt8 * allocBinary(uno::Sequence<sal_Int8> const & _aBinaryValue)
{
sal_uInt32 const nElementSize = 1;
sal_Int32 const nLength = _aBinaryValue.getLength();
- Sequence aResult = implSeqAlloc(nLength,nElementSize);
+ sal_uInt8 * aResult = implSeqAlloc(nLength,nElementSize);
if (aResult)
{
@@ -228,7 +227,7 @@ Sequence allocBinary(uno::Sequence<sal_Int8> const & _aBinaryValue)
//-----------------------------------------------------------------------------
static
void freeSeqData(sal_uInt8 *_pDataAddr,
- TypeCode _aElementType, sal_Int32 _nElements)
+ sal_uInt8 _aElementType, sal_Int32 _nElements)
{
OSL_ASSERT(_aElementType == (_aElementType & Type::mask_basetype));
@@ -244,18 +243,18 @@ void freeSeqData(sal_uInt8 *_pDataAddr,
case Type::value_string:
{
- String * pElements = reinterpret_cast<String*>( _pDataAddr );
+ rtl_uString * * pElements = reinterpret_cast<rtl_uString **>( _pDataAddr );
for (sal_Int32 i = 0; i < _nElements; ++i)
{
- freeString(pElements[i]);
+ rtl_uString_release(pElements[i]);
}
}
break;
case Type::value_binary:
{
- Vector * pElements = reinterpret_cast<Vector*>( _pDataAddr );
+ sal_uInt8 * * pElements = reinterpret_cast<sal_uInt8 **>( _pDataAddr );
for (sal_Int32 i = 0; i < _nElements; ++i)
{
@@ -272,7 +271,7 @@ void freeSeqData(sal_uInt8 *_pDataAddr,
}
//-----------------------------------------------------------------------------
-void freeSequence(TypeCode _aElementType, Sequence _aSeq)
+void freeSequence(sal_uInt8 _aElementType, sal_uInt8 * _aSeq)
{
OSL_ENSURE(_aElementType == (_aElementType & Type::mask_valuetype), "Invalid type code");
@@ -290,7 +289,7 @@ void freeSequence(TypeCode _aElementType, Sequence _aSeq)
}
//-----------------------------------------------------------------------------
-void freeBinary(Sequence _aSeq)
+void freeBinary(sal_uInt8 * _aSeq)
{
OSL_ENSURE(_aSeq, "ERROR: Trying to free a NULL sequence");
if (_aSeq == 0) return;
@@ -301,9 +300,9 @@ void freeBinary(Sequence _aSeq)
//-----------------------------------------------------------------------------
static inline
-sal_Sequence * implCreateSequence(void const * _pElements, TypeCode _aElementType, sal_Int32 _nElements)
+sal_Sequence * implCreateSequence(void const * _pElements, sal_uInt8 _aElementType, sal_Int32 _nElements)
{
- uno::Type aUnoType = getUnoType( TypeCode( _aElementType | Type::flag_sequence ));
+ uno::Type aUnoType = getUnoType( sal_uInt8( _aElementType | Type::flag_sequence ));
sal_Sequence * pResult = NULL;
::uno_type_sequence_construct( &pResult, aUnoType.getTypeLibType(),
@@ -316,7 +315,7 @@ sal_Sequence * implCreateSequence(void const * _pElements, TypeCode _aElementTyp
//-----------------------------------------------------------------------------
static
-sal_Sequence * readSeqData(sal_uInt8 *_pDataAddr, TypeCode _aElementType, sal_Int32 _nElements)
+sal_Sequence * readSeqData(sal_uInt8 *_pDataAddr, sal_uInt8 _aElementType, sal_Int32 _nElements)
{
OSL_ASSERT(_aElementType == (_aElementType & Type::mask_basetype));
@@ -335,11 +334,11 @@ sal_Sequence * readSeqData(sal_uInt8 *_pDataAddr, TypeCode _aElementType, sal_In
uno::Sequence<rtl::OUString> aResult(_nElements);
rtl::OUString * pResult = aResult.getArray();
- String const * pElements = static_cast<String const *>( pElementData );
+ rtl_uString * const * pElements = static_cast<rtl_uString * const *>( pElementData );
for (sal_Int32 i = 0; i < _nElements; ++i)
{
- pResult[i] = readString(pElements[i]);
+ pResult[i] = rtl::OUString(pElements[i]);
}
sal_Sequence * pRet = aResult.get();
@@ -349,12 +348,10 @@ sal_Sequence * readSeqData(sal_uInt8 *_pDataAddr, TypeCode _aElementType, sal_In
case Type::value_binary:
{
- typedef uno::Sequence< sal_Int8 > BinSequence;
+ uno::Sequence< uno::Sequence< sal_Int8 > > aResult(_nElements);
+ uno::Sequence< sal_Int8 > * pResult = aResult.getArray();
- uno::Sequence<BinSequence> aResult(_nElements);
- BinSequence * pResult = aResult.getArray();
-
- Vector const * pElements = static_cast<Vector const *>( pElementData );
+ sal_uInt8 * const * pElements = static_cast<sal_uInt8 * const *>( pElementData );
for (sal_Int32 i = 0; i < _nElements; ++i)
{
@@ -375,7 +372,7 @@ sal_Sequence * readSeqData(sal_uInt8 *_pDataAddr, TypeCode _aElementType, sal_In
//-----------------------------------------------------------------------------
-::sal_Sequence * readSequence(TypeCode _aElementType, Sequence _aSeq)
+::sal_Sequence * readSequence(sal_uInt8 _aElementType, sal_uInt8 * _aSeq)
{
OSL_ENSURE(_aElementType == (_aElementType & Type::mask_valuetype), "Invalid type code");
@@ -391,7 +388,7 @@ sal_Sequence * readSeqData(sal_uInt8 *_pDataAddr, TypeCode _aElementType, sal_In
}
//-----------------------------------------------------------------------------
-uno::Any readAnySequence(TypeCode _aElementType, Sequence _aSeq)
+uno::Any readAnySequence(sal_uInt8 _aElementType, sal_uInt8 * _aSeq)
{
sal_Sequence * pRawSequence = readSequence(_aElementType, _aSeq);
@@ -455,13 +452,13 @@ uno::Any readAnySequence(TypeCode _aElementType, Sequence _aSeq)
break;
}
- OSL_ASSERT(!aResult.hasValue() || aResult.getValueType() == getUnoType(TypeCode(_aElementType | Type::flag_sequence)));
+ OSL_ASSERT(!aResult.hasValue() || aResult.getValueType() == getUnoType(sal_uInt8(_aElementType | Type::flag_sequence)));
return aResult;
}
//-----------------------------------------------------------------------------
-uno::Sequence<sal_Int8> readBinary(Sequence _aSeq)
+uno::Sequence<sal_Int8> readBinary(sal_uInt8 * _aSeq)
{
OSL_ENSURE(_aSeq, "ERROR: Trying to read from a NULL sequence");
if (_aSeq == 0) return uno::Sequence<sal_Int8>();
@@ -493,30 +490,4 @@ namespace configmgr
for (oslInterlockedCount i = 0; i < mnCount; i++)
UnoApiLock::acquire();
}
-
-#ifndef SIMPLE_REFERENCE_FAST
- void SimpleReferenceObject::acquire() SAL_THROW(())
- {
- if (!UnoApiLock::isHeld())
- {
- fprintf (stderr, "Locking disaster\n");
- fscanf (stdin, "");
- }
- m_nCount++;
- }
- void SimpleReferenceObject::release() SAL_THROW(())
- {
- if (!UnoApiLock::isHeld())
- {
- fprintf (stderr, "Locking disaster\n");
- fscanf (stdin, "");
- }
- if (--m_nCount == 0)
- delete this;
- }
-#endif
- SimpleReferenceObject::~SimpleReferenceObject() SAL_THROW(())
- {
- OSL_ASSERT(m_nCount == 0);
- }
} // namespace configmgr
diff --git a/configmgr/source/inc/anydata.hxx b/configmgr/source/inc/anydata.hxx
index 8f53866601..cc971949ff 100644
--- a/configmgr/source/inc/anydata.hxx
+++ b/configmgr/source/inc/anydata.hxx
@@ -31,7 +31,8 @@
#ifndef INCLUDED_SHARABLE_ANYDATA_HXX
#define INCLUDED_SHARABLE_ANYDATA_HXX
-#include "types.hxx"
+#include "rtl/ustring.h"
+#include "sal/types.h"
//-----------------------------------------------------------------------------
namespace com { namespace sun { namespace star { namespace uno {
@@ -50,27 +51,25 @@ namespace configmgr
union AnyData
{
- typedef sal_uInt8 TypeCode;
-
sal_Bool boolValue;
sal_Int16 shortValue;
sal_Int32 intValue;
sal_Int64 *longValue;
double *doubleValue;
- Vector binaryValue; // points to counted sal_(u)Int8 []
- String stringValue; // points to counted sal_Unicode []
- Vector sequenceValue; // points to counted AnyData [] (or SomeType [] ?)
+ sal_uInt8 * binaryValue; // points to counted sal_(u)Int8 []
+ rtl_uString * stringValue; // points to counted sal_Unicode []
+ sal_uInt8 * sequenceValue; // points to counted AnyData [] (or SomeType [] ?)
void *data; // used to initialize to 0
};
//-----------------------------------------------------------------------------
- AnyData::TypeCode getTypeCode(::com::sun::star::uno::Type const & _aType);
- ::com::sun::star::uno::Type getUnoType( AnyData::TypeCode _aType);
+ sal_uInt8 getTypeCode(::com::sun::star::uno::Type const & _aType);
+ ::com::sun::star::uno::Type getUnoType( sal_uInt8 _aType);
- AnyData allocData(AnyData::TypeCode _aType, ::com::sun::star::uno::Any const & _aAny);
- void freeData(AnyData::TypeCode _aType, AnyData _aData);
- ::com::sun::star::uno::Any readData(AnyData::TypeCode _aType, AnyData _aData);
+ AnyData allocData(sal_uInt8 _aType, ::com::sun::star::uno::Any const & _aAny);
+ void freeData(sal_uInt8 _aType, AnyData _aData);
+ ::com::sun::star::uno::Any readData(sal_uInt8 _aType, AnyData _aData);
//-----------------------------------------------------------------------------
}
diff --git a/configmgr/source/inc/anynoderef.hxx b/configmgr/source/inc/anynoderef.hxx
index 764d08278e..29683dad19 100644
--- a/configmgr/source/inc/anynoderef.hxx
+++ b/configmgr/source/inc/anynoderef.hxx
@@ -41,26 +41,11 @@ namespace configmgr
namespace configuration
{
//-------------------------------------------------------------------------
- class Name;
- //-------------------------------------------------------------------------
-
- namespace argument { struct NoValidate; }
-
- typedef com::sun::star::uno::Type UnoType;
- typedef com::sun::star::uno::Any UnoAny;
- //-------------------------------------------------------------------------
-
class NodeRef;
class ValueRef;
class AnyNodeRef;
class NodeID;
-
class Tree;
-
- class TreeImpl;
-
- typedef unsigned int NodeOffset;
- typedef unsigned int TreeDepth;
//-------------------------------------------------------------------------
/// represents any node in some tree
@@ -70,6 +55,9 @@ namespace configmgr
/// constructs an empty (invalid) node
AnyNodeRef();
+ AnyNodeRef(unsigned int nParentPos, unsigned int m_nDepth);
+ AnyNodeRef(rtl::OUString const& aName, unsigned int nParentPos);
+
/// converts an inner node
explicit AnyNodeRef(NodeRef const& aInnerNode);
/// converts a value node
@@ -96,18 +84,13 @@ namespace configmgr
/// converts this, if it is a inner node
NodeRef toNode() const;
- private:
- friend class Tree;
- friend class TreeImplHelper;
- AnyNodeRef(NodeOffset nParentPos, TreeDepth m_nDepth);
- AnyNodeRef(Name const& aName, NodeOffset nParentPos);
#if OSL_DEBUG_LEVEL > 0
bool checkValidState() const;
#endif
- private:
- Name m_sNodeName;
- NodeOffset m_nUsedPos;
- TreeDepth m_nDepth;
+
+ rtl::OUString m_sNodeName;
+ unsigned int m_nUsedPos;
+ unsigned int m_nDepth;
};
//-------------------------------------------------------------------------
@@ -119,7 +102,7 @@ namespace configmgr
<FALSE/> otherwise
*/
inline
- bool hasChildOrElement(Tree const& aTree, AnyNodeRef const& aNode, Name const& aName)
+ bool hasChildOrElement(rtl::Reference< Tree > const& aTree, AnyNodeRef const& aNode, rtl::OUString const& aName)
{ return aNode.isNode() && hasChildOrElement(aTree,aNode.toNode(),aName); }
/** tries to find the immediate child of <var>aNode</var> (which is in <var>aTree</var>)
@@ -131,7 +114,7 @@ namespace configmgr
@return The requested child node, if it exists
(then <var>aTree</var> refers to the tree containing the desired node),
*/
- AnyNodeRef getChildOrElement(Tree& aTree, NodeRef const& aParentNode, Name const& aName);
+ AnyNodeRef getChildOrElement(rtl::Reference< Tree > & aTree, NodeRef const& aParentNode, rtl::OUString const& aName);
/** tries to find the descendant of <var>aNode</var> specified by <var>aPath</var> within <var>aTree</var>
<p> This function follows the given path stepwise, until a requested node is missing in the tree.</p>
@@ -146,7 +129,7 @@ namespace configmgr
and <var>aPath</var> is empty)<BR/>
an invalid node otherwise
*/
- AnyNodeRef getLocalDescendant(Tree const& aTree, NodeRef const& aNode, RelativePath const& aPath);
+ AnyNodeRef getLocalDescendant(rtl::Reference< Tree > const& aTree, NodeRef const& aNode, RelativePath const& aPath);
/** tries to find the descendant of <var>aNode</var> (which is in <var>aTree</var>) specified by <var>aPath</var>
<p> This function follows the given path stepwise, until a requested node is missing in the tree.</p>
@@ -161,7 +144,7 @@ namespace configmgr
and <var>aPath</var> is empty)<BR/>
an invalid node otherwise
*/
- AnyNodeRef getDeepDescendant(Tree& aTree, NodeRef& aNode, RelativePath& aPath);
+ AnyNodeRef getDeepDescendant(rtl::Reference< Tree > & aTree, NodeRef& aNode, RelativePath& aPath);
//-------------------------------------------------------------------------
inline bool AnyNodeRef::isValid() const
diff --git a/configmgr/source/inc/anypair.hxx b/configmgr/source/inc/anypair.hxx
index 3329f59ade..3694076385 100644
--- a/configmgr/source/inc/anypair.hxx
+++ b/configmgr/source/inc/anypair.hxx
@@ -12,12 +12,6 @@ namespace configmgr
namespace lang = css::lang;
//==========================================================================
- //= Basic (POD) data structure for representing a single value in an AnyPair
- //==========================================================================
-
- typedef const void * cfgmgr_AnyPair_Data;
-
- //==========================================================================
//= flags for handling the state of an Anypair
//==========================================================================
enum {
@@ -25,7 +19,6 @@ namespace configmgr
cfgmgr_SELECT_SECOND = 0x02,
cfgmgr_SELECT_BOTH = cfgmgr_SELECT_FIRST | cfgmgr_SELECT_SECOND
};
- typedef sal_uInt8 cfgmgr_SelectorType;
//==========================================================================
//= data structure for descriptive data for an AnyPair
@@ -33,10 +26,10 @@ namespace configmgr
struct cfgmgr_AnyPair_Desc
{
typelib_TypeDescriptionReference * pType;
- cfgmgr_SelectorType nState;
+ sal_uInt8 nState;
};
- inline bool cfgmgr_AnyPair_isNull(cfgmgr_AnyPair_Desc const* _pDesc, cfgmgr_SelectorType nSelect)
+ inline bool cfgmgr_AnyPair_isNull(cfgmgr_AnyPair_Desc const* _pDesc, sal_uInt8 nSelect)
{ return (_pDesc->nState & nSelect) == 0; }
inline bool cfgmgr_AnyPair_isEmpty(cfgmgr_AnyPair_Desc const* _pDesc)
@@ -48,12 +41,9 @@ namespace configmgr
struct cfgmgr_AnyPair
{
- typedef cfgmgr_AnyPair_Data Data;
- typedef cfgmgr_AnyPair_Desc Desc;
-
- Desc desc;
- cfgmgr_AnyPair_Data first;
- cfgmgr_AnyPair_Data second;
+ cfgmgr_AnyPair_Desc desc;
+ const void * first;
+ const void * second;
};
// -----------------------------------------------------------------------------
@@ -101,7 +91,7 @@ namespace configmgr
bool hasValue(SelectMember _select = SELECT_BOTH) const
{
- return !cfgmgr_AnyPair_isNull(&m_aAnyPair.desc, (cfgmgr_SelectorType)_select);
+ return !cfgmgr_AnyPair_isNull(&m_aAnyPair.desc, (sal_uInt8)_select);
}
bool hasFirst() const
{
diff --git a/configmgr/source/inc/autoobject.hxx b/configmgr/source/inc/autoobject.hxx
index ba25050c5c..f3b459a716 100644
--- a/configmgr/source/inc/autoobject.hxx
+++ b/configmgr/source/inc/autoobject.hxx
@@ -31,32 +31,30 @@
#ifndef CONFIGMGR_AUTOOBJECT_HXX
#define CONFIGMGR_AUTOOBJECT_HXX
+#include "sal/config.h"
+
+#include "boost/utility.hpp"
+
#include "utility.hxx"
namespace configmgr
{
-////////////////////////////////////////////////////////////////////////////////
- using ::rtl::OUString;
-
//-----------------------------------------------------------------------------
template < class Object >
- class AutoObject : Noncopyable
+ class AutoObject: private boost::noncopyable
{
public:
- typedef Object object_type;
- typedef Object * Ptr;
- public:
AutoObject() : m_pObject(NULL) {}
AutoObject(Object * _obj) : m_pObject(_obj) {}
~AutoObject() { delete m_pObject; }
bool is() const;
- Ptr get() const;
- Ptr getOrCreate();
+ Object * get() const;
+ Object * getOrCreate();
private:
- Ptr internalCreate();
+ Object * internalCreate();
private:
- Ptr m_pObject;
+ Object * m_pObject;
};
//-----------------------------------------------------------------------------
diff --git a/configmgr/source/inc/autoreferencemap.hxx b/configmgr/source/inc/autoreferencemap.hxx
index 439259efc4..220ca2257b 100644
--- a/configmgr/source/inc/autoreferencemap.hxx
+++ b/configmgr/source/inc/autoreferencemap.hxx
@@ -39,23 +39,13 @@
namespace configmgr
{
-////////////////////////////////////////////////////////////////////////////////
- using ::rtl::OUString;
-
//-----------------------------------------------------------------------------
template < class Key, class Object, class KeyCompare = std::less<Key> >
class AutoReferenceMap
{
public:
- typedef rtl::Reference<Object> Ref;
- typedef std::map<Key,Ref,KeyCompare> Map;
-
- typedef Object object_type;
- typedef Key key_type;
- typedef KeyCompare key_compare;
-
- typedef typename Map::value_type value_type;
+ typedef std::map<Key,rtl::Reference<Object>,KeyCompare> Map;
public:
AutoReferenceMap() {}
~AutoReferenceMap() {}
@@ -75,20 +65,20 @@ namespace configmgr
bool has(Key const & _aKey) const;
- Ref get(Key const & _aKey) const;
+ rtl::Reference<Object> get(Key const & _aKey) const;
- Ref insert(Key const & _aKey, Ref const & _anEntry);
- Ref remove(Key const & _aKey);
+ rtl::Reference<Object> insert(Key const & _aKey, rtl::Reference<Object> const & _anEntry);
+ rtl::Reference<Object> remove(Key const & _aKey);
private:
- Ref internalGet(Key const & _aKey) const
+ rtl::Reference<Object> internalGet(Key const & _aKey) const
{
typename Map::const_iterator it = m_aMap.find(_aKey);
- return it != m_aMap.end() ? it->second : Ref();
+ return it != m_aMap.end() ? it->second : rtl::Reference<Object>();
}
- Ref internalAdd(Key const & _aKey, Ref const & _aNewRef)
+ rtl::Reference<Object> internalAdd(Key const & _aKey, rtl::Reference<Object> const & _aNewRef)
{
return m_aMap[_aKey] = _aNewRef;
}
@@ -117,9 +107,9 @@ namespace configmgr
//-----------------------------------------------------------------------------
template < class Key, class Object, class KeyCompare >
- rtl::Reference<Object> AutoReferenceMap<Key,Object,KeyCompare>::insert(Key const & _aKey, Ref const & _anEntry)
+ rtl::Reference<Object> AutoReferenceMap<Key,Object,KeyCompare>::insert(Key const & _aKey, rtl::Reference<Object> const & _anEntry)
{
- Ref aRef = internalAdd(_aKey,_anEntry);
+ rtl::Reference<Object> aRef = internalAdd(_aKey,_anEntry);
return aRef;
}
@@ -128,7 +118,7 @@ namespace configmgr
template < class Key, class Object, class KeyCompare >
rtl::Reference<Object> AutoReferenceMap<Key,Object,KeyCompare>::remove(Key const & _aKey)
{
- Ref aRef = internalGet(_aKey);
+ rtl::Reference<Object> aRef = internalGet(_aKey);
internalDrop(_aKey);
return aRef;
}
diff --git a/configmgr/source/inc/backendfactory.hxx b/configmgr/source/inc/backendfactory.hxx
index 29cdd33f34..82b6cccdb0 100644
--- a/configmgr/source/inc/backendfactory.hxx
+++ b/configmgr/source/inc/backendfactory.hxx
@@ -47,25 +47,19 @@ namespace configmgr
class BackendFactory
{
public:
- typedef com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >
- CreationContext;
-
- typedef com::sun::star::uno::Reference< com::sun::star::configuration::backend::XBackend >
- UnoBackend;
-
rtl::Reference<IMergedDataProvider> createBackend();
- UnoBackend getUnoBackend();
+ com::sun::star::uno::Reference< com::sun::star::configuration::backend::XBackend > getUnoBackend();
- static BackendFactory instance(CreationContext const & _xCtx);
+ static BackendFactory instance(com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > const & _xCtx);
private:
explicit
- BackendFactory(CreationContext const & _xCtx)
+ BackendFactory(com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > const & _xCtx)
: m_xCtx(_xCtx)
{}
- CreationContext m_xCtx;
+ com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > m_xCtx;
};
//-----------------------------------------------------------------------------
}
diff --git a/configmgr/source/inc/bootstrap.hxx b/configmgr/source/inc/bootstrap.hxx
index dc54371396..2dceb7ab3f 100644
--- a/configmgr/source/inc/bootstrap.hxx
+++ b/configmgr/source/inc/bootstrap.hxx
@@ -75,7 +75,6 @@ namespace configmgr
namespace uno = ::com::sun::star::uno;
namespace lang = ::com::sun::star::lang;
namespace beans = ::com::sun::star::beans;
- using ::rtl::OUString;
// -----------------------------------------------------------------------------------
/** Customized ComponentContext for configuration bootstrap data and runtime arguments
@@ -85,10 +84,10 @@ namespace configmgr
// creation and destruction
private:
friend uno::Reference<uno::XInterface> SAL_CALL
- instantiateBootstrapContext( Context const& xContext );
+ instantiateBootstrapContext( uno::Reference< uno::XComponentContext > const& xContext );
// constructor
- BootstrapContext(Context const & _xContext);
+ BootstrapContext(uno::Reference< uno::XComponentContext > const & _xContext);
// two-phase construct
void initialize();
@@ -107,7 +106,6 @@ namespace configmgr
getSupportedServiceNames(void) throw (uno::RuntimeException) ;
- typedef uno::Sequence < beans::NamedValue > Overrides;
/** Constructs a Context based on the given arguments and context.
@param _xContext
The base context of this component context.
@@ -115,33 +113,33 @@ namespace configmgr
@param _aArguments
The arguments used to create this component context.
*/
- static Context createWrapper(Context const & _xContext, Overrides const & _aOverrides);
+ static uno::Reference< uno::XComponentContext > createWrapper(uno::Reference< uno::XComponentContext > const & _xContext, uno::Sequence < beans::NamedValue > const & _aOverrides);
/** Checks, if the given context is a wrapper.
@param _xContext
The context that is checked.
*/
- static sal_Bool isWrapper(Context const & _xContext);
+ static sal_Bool isWrapper(uno::Reference< uno::XComponentContext > const & _xContext);
/** Retrieves the BootstrapContext for the given non-bootstrap context.
@param _xContext
The context from which the bootstrap context should be retrieved.
*/
- static Context get(Context const & _xContext);
+ static uno::Reference< uno::XComponentContext > get(uno::Reference< uno::XComponentContext > const & _xContext);
/// Destroys this BootstrapContext
~BootstrapContext();
// gets the INI that should be used for bootstrap data by default
- static OUString getDefaultConfigurationBootstrapURL();
+ static rtl::OUString getDefaultConfigurationBootstrapURL();
// interface implementations
public:
// XComponentContext
/** Retrieves a value from this context.
- @param Name
+ @param name
The name of the value to retrieve.
A prefix of "com.sun.star.configuration.bootstrap." is stripped/ignored
@@ -149,29 +147,28 @@ namespace configmgr
The requested value, or <VOID/> if the value is not found.
*/
virtual uno::Any SAL_CALL
- getValueByName( const OUString& Name )
+ getValueByName( const rtl::OUString& name )
throw (uno::RuntimeException);
public: // used by ArgumentHelper
- static OUString makeContextName (OUString const & _aShortName);
+ static rtl::OUString makeContextName (rtl::OUString const & _aShortName);
private:
- static OUString makeBootstrapName(OUString const & _aLongName);
+ static rtl::OUString makeBootstrapName(rtl::OUString const & _aLongName);
uno::Any makeBootstrapException();
};
// -----------------------------------------------------------------------------
class ContextReader
{
public:
- typedef uno::Reference< uno::XComponentContext > Context;
explicit
- ContextReader(Context const & context);
+ ContextReader(uno::Reference< uno::XComponentContext > const & context);
// the underlying contexts
sal_Bool hasBootstrapContext() const { return m_fullcontext.is(); }
- Context const & getBootstrapContext() const { return m_fullcontext; }
- Context const & getBaseContext() const { return m_basecontext; }
- Context const & getBestContext() const { return m_fullcontext.is() ? m_fullcontext : m_basecontext; }
+ uno::Reference< uno::XComponentContext > const & getBootstrapContext() const { return m_fullcontext; }
+ uno::Reference< uno::XComponentContext > const & getBaseContext() const { return m_basecontext; }
+ uno::Reference< uno::XComponentContext > const & getBestContext() const { return m_fullcontext.is() ? m_fullcontext : m_basecontext; }
uno::Reference< lang::XMultiComponentFactory > getServiceManager() const;
@@ -179,7 +176,7 @@ namespace configmgr
@param _xContext
The context that is checked.
*/
- static bool testAdminService(Context const & context, bool bAdmin);
+ static bool testAdminService(uno::Reference< uno::XComponentContext > const & context, bool bAdmin);
// general settings
sal_Bool isUnoBackend() const;
@@ -191,10 +188,10 @@ namespace configmgr
sal_Bool hasAsyncSetting() const;
sal_Bool hasOfflineSetting() const;
- OUString getUnoBackendService() const;
- OUString getUnoBackendWrapper() const;
+ rtl::OUString getUnoBackendService() const;
+ rtl::OUString getUnoBackendWrapper() const;
- OUString getLocale() const;
+ rtl::OUString getLocale() const;
sal_Bool getAsyncSetting() const;
sal_Bool getOfflineSetting() const;
@@ -206,23 +203,21 @@ namespace configmgr
sal_Bool isBootstrapValid() const;
uno::Any getBootstrapError() const;
private:
- sal_Bool hasSetting(OUString const & _aSetting) const;
- sal_Bool getBoolSetting(OUString const & _aSetting, sal_Bool bValue) const;
- OUString getStringSetting(OUString const & _aSetting, OUString aValue) const;
- uno::Any getSetting(OUString const & _aSetting) const;
+ sal_Bool hasSetting(rtl::OUString const & _aSetting) const;
+ sal_Bool getBoolSetting(rtl::OUString const & _aSetting, sal_Bool bValue) const;
+ rtl::OUString getStringSetting(rtl::OUString const & _aSetting, rtl::OUString aValue) const;
+ uno::Any getSetting(rtl::OUString const & _aSetting) const;
private:
- Context m_basecontext;
- Context m_fullcontext;
+ uno::Reference< uno::XComponentContext > m_basecontext;
+ uno::Reference< uno::XComponentContext > m_fullcontext;
};
//------------------------------------------------------------------------
class ArgumentHelper
{
public:
- typedef uno::Reference< uno::XComponentContext > Context;
-
explicit
- ArgumentHelper(Context const & context)
+ ArgumentHelper(uno::Reference< uno::XComponentContext > const & context)
: m_context(context)
, m_bHasBackendArguments(false)
{}
@@ -237,7 +232,7 @@ namespace configmgr
static beans::NamedValue makeAdminServiceOverride(sal_Bool bAdmin);
private:
- Context m_context; // context used to strip identical arguments
+ uno::Reference< uno::XComponentContext > m_context; // context used to strip identical arguments
bool m_bHasBackendArguments;
};
// -----------------------------------------------------------------------------------
diff --git a/configmgr/source/inc/bootstrapcontext.hxx b/configmgr/source/inc/bootstrapcontext.hxx
index 606c929488..5b54e86ab6 100644
--- a/configmgr/source/inc/bootstrapcontext.hxx
+++ b/configmgr/source/inc/bootstrapcontext.hxx
@@ -48,7 +48,7 @@ namespace com { namespace sun { namespace star { namespace uno {
// -----------------------------------------------------------------------------
#define SINGLETON_ "/singletons/"
-#define SINGLETON( NAME ) OUString( RTL_CONSTASCII_USTRINGPARAM( SINGLETON_ NAME ) )
+#define SINGLETON( NAME ) rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SINGLETON_ NAME ) )
// -----------------------------------------------------------------------------
namespace configmgr
{
@@ -56,21 +56,11 @@ namespace configmgr
namespace uno = ::com::sun::star::uno;
namespace lang = ::com::sun::star::lang;
namespace beans = ::com::sun::star::beans;
- using ::rtl::OUString;
// -----------------------------------------------------------------------------
- typedef ::cppu::WeakComponentImplHelper3 <
- uno::XComponentContext,
- uno::XCurrentContext,
- lang::XServiceInfo
- > ComponentContext_Base;
/** Base class for customized ComponentContext using bootstrap data and overrides
*/
- class ComponentContext : public ComponentContext_Base
+ class ComponentContext : public cppu::WeakComponentImplHelper3 < uno::XComponentContext, uno::XCurrentContext, lang::XServiceInfo >
{
- public:
- typedef uno::Reference< uno::XComponentContext > Context;
- typedef uno::Reference< lang::XMultiComponentFactory > ServiceManager;
-
// creation and destruction
public:
/** Constructs a ComponentContext based on the given overrides and context.
@@ -85,22 +75,22 @@ namespace configmgr
These values take precedence over values from the base context or bootstrap data.
*/
explicit
- ComponentContext(Context const & _xContext);
+ ComponentContext(uno::Reference< uno::XComponentContext > const & _xContext);
/// Destroys this BootstrapContext
~ComponentContext();
// gets the INI in use for getting bootstrap data
- OUString getBootstrapURL() const;
+ rtl::OUString getBootstrapURL() const;
- static sal_Bool isPassthrough(Context const & _xContext);
+ static sal_Bool isPassthrough(uno::Reference< uno::XComponentContext > const & _xContext);
static beans::NamedValue makePassthroughMarker(sal_Bool bPassthrough = true);
// interface implementations
public:
// XComponentContext only
- virtual ServiceManager SAL_CALL
+ virtual uno::Reference< lang::XMultiComponentFactory > SAL_CALL
getServiceManager( )
throw (uno::RuntimeException);
@@ -110,41 +100,37 @@ namespace configmgr
protected:
// two phase construct - also initialized the bootstrap data
- void initialize(const OUString& _aBootstrapURL);
+ void initialize(const rtl::OUString& _aBootstrapURL);
- bool lookupInContext ( uno::Any & _rValue, const OUString& _aName ) const;
- bool lookupInBootstrap( uno::Any & _rValue, const OUString& _aName ) const;
+ bool lookupInContext ( uno::Any & _rValue, const rtl::OUString& _aName ) const;
+ bool lookupInBootstrap( uno::Any & _rValue, const rtl::OUString& _aName ) const;
- Context const & basecontext() const { return m_xContext; }
+ uno::Reference< uno::XComponentContext > const & basecontext() const { return m_xContext; }
private:
/// The context that most requests are delegated to
- Context m_xContext;
+ uno::Reference< uno::XComponentContext > m_xContext;
/// The bootstrap data consulted as fallback
rtlBootstrapHandle m_hBootstrapData;
/// The service manager associated with this context
- ServiceManager m_xServiceManager;
+ uno::Reference< lang::XMultiComponentFactory > m_xServiceManager;
};
// -----------------------------------------------------------------------------
class UnoContextTunnel
{
public:
- typedef uno::Reference< uno::XCurrentContext > CurrentContext;
- typedef uno::Reference< lang::XUnoTunnel > FailureTunnel;
- typedef uno::Reference< uno::XComponentContext > Context;
- public:
UnoContextTunnel();
~UnoContextTunnel();
- void tunnel(Context const & xContext);
- void passthru(Context const & xContext);
+ void tunnel(uno::Reference< uno::XComponentContext > const & xContext);
+ void passthru(uno::Reference< uno::XComponentContext > const & xContext);
uno::Any recoverFailure(bool bRaise); // true, if there is a failure
- static Context recoverContext(Context const & xFallback = Context());
+ static uno::Reference< uno::XComponentContext > recoverContext(uno::Reference< uno::XComponentContext > const & xFallback = uno::Reference< uno::XComponentContext >());
static bool tunnelFailure(uno::Any const & aException, bool bRaise = false);
private:
- CurrentContext m_xOldContext;
- FailureTunnel m_xActiveTunnel;
+ uno::Reference< uno::XCurrentContext > m_xOldContext;
+ uno::Reference< lang::XUnoTunnel > m_xActiveTunnel;
class Tunnel;
};
// -----------------------------------------------------------------------------
diff --git a/configmgr/source/inc/bufferedfile.hxx b/configmgr/source/inc/bufferedfile.hxx
index 7bd13f3889..a49fbce6f2 100644
--- a/configmgr/source/inc/bufferedfile.hxx
+++ b/configmgr/source/inc/bufferedfile.hxx
@@ -32,6 +32,7 @@
#define CONFIGMGR_BUFFEREDFILE_HXX
#include "utility.hxx"
+#include <boost/utility.hpp>
#include <osl/file.hxx>
#include <com/sun/star/io/IOException.hpp>
@@ -45,12 +46,10 @@ namespace configmgr
namespace io = com::sun::star::io;
- class BufferedOutputFile : public osl::FileBase, Noncopyable
+ class BufferedOutputFile: private boost::noncopyable, public osl::FileBase
{
- typedef std::vector<sal_uInt8> Buffer;
-
osl::File * m_pFile;
- Buffer m_buffer;
+ std::vector<sal_uInt8> m_buffer;
public:
BufferedOutputFile( rtl::OUString const& aFileURL, sal_uInt32 nBufferSizeHint = 0 );
~BufferedOutputFile ();
diff --git a/configmgr/source/inc/builddata.hxx b/configmgr/source/inc/builddata.hxx
index 1c43df7dba..232aec06a4 100644
--- a/configmgr/source/inc/builddata.hxx
+++ b/configmgr/source/inc/builddata.hxx
@@ -50,19 +50,17 @@ namespace configmgr
namespace data
{
//-----------------------------------------------------------------------------
- class TreeAccessor;
+ sharable::TreeFragment * buildTree(sharable::TreeFragment * tree);
//-----------------------------------------------------------------------------
- TreeAddress buildTree(TreeAccessor const& _aTree);
+ sharable::TreeFragment * buildTree(rtl::OUString const & _aTreeName, INode const& _aNode, bool _bWithDefaults);
//-----------------------------------------------------------------------------
- TreeAddress buildTree(rtl::OUString const & _aTreeName, INode const& _aNode, bool _bWithDefaults);
+ sharable::TreeFragment * buildElementTree(INode const& _aNode, rtl::OUString const & _aTypeName, bool _bWithDefaults);
//-----------------------------------------------------------------------------
- TreeAddress buildElementTree(INode const& _aNode, rtl::OUString const & _aTypeName, bool _bWithDefaults);
+ void mergeDefaults(sharable::TreeFragment * _aBaseAddress, INode const& _aDefaultNode);
//-----------------------------------------------------------------------------
- void mergeDefaults(TreeAddress _aBaseAddress, INode const& _aDefaultNode);
+ void destroyTree(sharable::TreeFragment * _aBaseAddress);
//-----------------------------------------------------------------------------
- void destroyTree(TreeAddress _aBaseAddress);
-//-----------------------------------------------------------------------------
- std::auto_ptr<INode> convertTree(TreeAccessor const & _aTree, bool _bUseTreeName);
+ std::auto_ptr<INode> convertTree(sharable::TreeFragment * tree, bool _bUseTreeName);
//-----------------------------------------------------------------------------
}
//-----------------------------------------------------------------------------
diff --git a/configmgr/source/inc/cacheddataprovider.hxx b/configmgr/source/inc/cacheddataprovider.hxx
deleted file mode 100644
index d5c52d9df3..0000000000
--- a/configmgr/source/inc/cacheddataprovider.hxx
+++ /dev/null
@@ -1,264 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: cacheddataprovider.hxx,v $
- * $Revision: 1.7 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-/* PLEASE DON'T DELETE ANY COMMENT LINES, ALSO IT'S UNNECESSARY. */
-
-
-#ifndef CONFIGMGR_BACKEND_CACHEDDATAPROVIDER_HXX
-#define CONFIGMGR_BACKEND_CACHEDDATAPROVIDER_HXX
-
-#include "request.hxx"
-#include "requesttypes.hxx"
-#include "utility.hxx"
-#include "treefragment.hxx"
-#include <rtl/ref.hxx>
-
-namespace configmgr
-{
-// ---------------------------------------------------------------------------
- namespace backend
- {
-// ---------------------------------------------------------------------------
- typedef data::TreeAddress CacheLocation;
-// ---------------------------------------------------------------------------
- struct IDirectDataProvider;
- struct ICachedDataNotifier;
-// ---------------------------------------------------------------------------
-
- /** Interface providing access to configuration data from some backend,
- which is cached in a shared data cache.
- */
- struct SAL_NO_VTABLE ICachedDataProvider : Refcounted
- {
- /** locates data of a component in the cache.
-
- <p> If the data isn't in the cache it is loaded from the backend. </p>
- <p> When the caller is done with the data, <method>freeComponent</method>
- should be called. </p>
-
- @param _aRequest
- identifies the component to be loaded.
-
- @returns
- data that can be used to locate the loaded data in the cache.
-
- @throws com::sun::star::uno::Exception
- if loading the data fails.
- The exact exception being thrown may depend on the underlying backend.
- */
- virtual CacheLocation loadComponent(ComponentRequest const & _aRequest)
- CFG_UNO_THROW_ALL() = 0;
-
- /** releases data of a component from the cache.
-
- <p> Should be called when a client is done with a component.
- Each calls to <method>loadComponent</method> should
- be balanced by exactly one call to <method>freeComponent</method>.
- </p>
-
- @param _aRequest
- identifies a component previously loaded via <method>loadComponent</method>.
-
- @returns
- data that can be used to locate the loaded data in the cache.
- */
- virtual void freeComponent(ComponentRequest const & _aRequest)
- CFG_NOTHROW() = 0;
-
- /** refreshes data of an existing component from the backend
-
- <p> If the data is in the cache already, it is refreshed from the
- backend and the change are notified to all registered listeners.
- </p>
- <p> If the data isn't in the cache nothing is done and
- a NULL location is returned.
- </p>
-
- <p>Note: the caller <strong>must not</strong> hold any lock on the cache line affected.</p>
-
- @param _aRequest
- identifies the component to be refreshed.
-
- @returns
- data that can be used to locate the refreshed data in the cache.
-
- <p>If there is no data to refresh a NULL location is returned.</p>
-
- @throws com::sun::star::uno::Exception
- if loading the data fails.
- The exact exception being thrown may depend on the underlying backend.
- */
- virtual CacheLocation refreshComponent(ComponentRequest const & _aRequest)
- CFG_UNO_THROW_ALL() = 0;
-
- /** refreshes data of all existing components from the backend
-
- <p> If the data is in the cache already, it is refreshed from the
- backend and the changes are notified to all registered listeners.
- </p>
- <p> If the data isn't in the cache nothing is done and
- a NULL location is returned.
- </p>
-
- <p>Note: the caller <strong>must not</strong> hold any lock on the cache line affected.</p>
-
- @throws com::sun::star::uno::Exception
- if loading the data fails.
- The exact exception being thrown may depend on the underlying backend.
- */
- virtual void refreshAllComponents()
- CFG_UNO_THROW_ALL() = 0;
- /** flushes data of all pending updates from cache to the backend(s)
- @throws com::sun::star::uno::Exception
- if flushing the data fails.
- The exact exception being thrown may depend on the underlying backend.
- */
- virtual void flushPendingUpdates()
- CFG_UNO_THROW_ALL() = 0;
-
- /** locates a template in the cache.
-
- <p> If the data isn't in the cache it is loaded from the backend. </p>
-
- <p>Note: the caller <strong>must not</strong> hold any lock on the cache line affected.</p>
-
- @param _aRequest
- identifies the template to be loaded.
-
- @returns
- data that can be used to locate the template data in the cache.
-
- @throws com::sun::star::uno::Exception
- if loading the template data fails.
- The exact exception being thrown may depend on the underlying backend.
- */
- virtual CacheLocation loadTemplate(TemplateRequest const & _aRequest)
- CFG_UNO_THROW_ALL() = 0;
-
- /** saves changes to the backend and notifies them to registered listeners.
-
- <p> Must be called after the changes have been applied to the cache
- and before any subsequent changes to the same component.
- </p>
-
- <p> Notifications are guaranteed to be delivered
- before any subsequent changes to the same component are possible.
- </p>
-
- <p> Note: the caller <strong>must</strong> hold a read lock (but no write lock)
- on the cache line affected during the call.</p>
-
- @param _anUpdate
- identifies the node that changed and describes the changes.
-
- @throws com::sun::star::uno::Exception
- if saving the changes to the backend fails.
- The exact exception being thrown may depend on the underlying backend.
- */
- virtual void saveAndNotify(UpdateRequest const & _anUpdate)
- CFG_UNO_THROW_ALL() = 0;
-
- /** dispose this object and its cache and close the backend
-
- <p> discards the cache and flushes the backend.
- </p>
- */
- virtual void dispose()
- CFG_UNO_THROW_RTE() = 0;
-
- /** @returns
- an object that can used to broadcast changes done through this object.
- <p> The object returned is guaranteed to live as long
- as this ICachedDataProvider lives.
- </p>
- */
- virtual ICachedDataNotifier & getNotifier() CFG_NOTHROW() = 0;
-
- /** @returns
- an object that can be used to retrieve owned copies of the data,
- defaults and templates.
- <p> The object returned is guaranteed to live as long
- as this ICachedDataProvider lives.
- </p>
- */
- virtual IDirectDataProvider & getDirectDataProvider() CFG_NOTHROW() = 0;
- };
-// ---------------------------------------------------------------------------
-
- /** Listener interface for observing changes in the cache
- managed by a <type>ICachedDataProvider</type>
- */
- struct SAL_NO_VTABLE ICachedDataListener : Refcounted
- {
- /// is called when the provider is closing down
- virtual void disposing(ICachedDataProvider & _rProvider) CFG_NOTHROW() = 0;
- /// is called when a new component was loaded into the cache.
- virtual void componentCreated(ComponentRequest const & _aComponent) CFG_NOTHROW() = 0;
- /// is called when data of an already loaded component changed in the cache.
- virtual void componentChanged(UpdateRequest const & _anUpdate) CFG_NOTHROW() = 0;
- };
-// ---------------------------------------------------------------------------
-
- /** Interface providing a multicasting service for changes to the cache
- managed by a <type>ICachedDataProvider</type>
- */
- struct SAL_NO_VTABLE ICachedDataNotifier
- {
- // firing notifications.
- /// notify all registered listeners and close down this notifier
- virtual void dispose(ICachedDataProvider & _rProvider) CFG_NOTHROW() = 0;
-
- /** notify a new component to all registered listeners.
- <p> Must be called after the component has been created in the cache.</p>
- */
- virtual void notifyCreated(ComponentRequest const & _aComponent) CFG_NOTHROW() = 0;
-
- /** notify changed data to all registered listeners.
- <p> Must be called after the change has been applied to the cache
- and before any subsequent changes to the same component.</p>
- */
- virtual void notifyChanged(UpdateRequest const & _anUpdate) CFG_NOTHROW() = 0;
-
- // listener registration.
- typedef rtl::Reference<ICachedDataListener> ListenerRef;
-
- /// register a listener for observing changes to the cached data
- virtual void addListener(ListenerRef _xListener) CFG_NOTHROW() = 0;
- /// unregister a listener previously registered
- virtual void removeListener(ListenerRef _xListener) CFG_NOTHROW() = 0;
- };
-// ---------------------------------------------------------------------------
- } // namespace backend
-
-// ---------------------------------------------------------------------------
-} // namespace configmgr
-
-#endif
-
diff --git a/configmgr/source/inc/cachefactory.hxx b/configmgr/source/inc/cachefactory.hxx
index 5e34cea245..7d4c4c7ba4 100644
--- a/configmgr/source/inc/cachefactory.hxx
+++ b/configmgr/source/inc/cachefactory.hxx
@@ -41,11 +41,8 @@ namespace configmgr
//-----------------------------------------------------------------------------
struct CacheFactory
{
- typedef ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >
- CreationContext;
-
rtl::Reference<TreeManager>
- createCacheManager(CreationContext const & _xContext);
+ createCacheManager(::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & _xContext);
static CacheFactory & instance();
};
diff --git a/configmgr/source/inc/change.hxx b/configmgr/source/inc/change.hxx
index 5aa6a47ecd..00f8d01cbc 100644
--- a/configmgr/source/inc/change.hxx
+++ b/configmgr/source/inc/change.hxx
@@ -121,8 +121,6 @@ namespace configmgr
virtual void dispatch(ChangeTreeAction& anAction) const = 0;
virtual void dispatch(ChangeTreeModification& anAction) = 0;
- // some kind of simple rtti
- RTTI_BASE(Change);
virtual std::auto_ptr<Change> clone() const = 0;
private:
@@ -176,9 +174,6 @@ namespace configmgr
virtual void dispatch(ChangeTreeAction& anAction) const { anAction.handle(*this); }
virtual void dispatch(ChangeTreeModification& anAction) { anAction.handle(*this); }
-
- // "rtti"
- RTTI(ValueChange, Change);
friend class ApplyValueChange;
};
@@ -188,9 +183,9 @@ namespace configmgr
//==========================================================================
class AddNode : public Change
{
- data::TreeSegment m_aOwnNewNode;
- data::TreeSegment m_aOwnOldNode;
- data::TreeAddress m_aInsertedTree;
+ rtl::Reference< data::TreeSegment > m_aOwnNewNode;
+ rtl::Reference< data::TreeSegment > m_aOwnOldNode;
+ sharable::TreeFragment * m_aInsertedTree;
bool m_bReplacing;
private:
@@ -199,7 +194,7 @@ namespace configmgr
// needed for clone()
AddNode(AddNode const&);
public:
- AddNode(data::TreeSegment const & _aAddedTree, rtl::OUString const& _rName, bool _bToDefault);
+ AddNode(rtl::Reference< data::TreeSegment > const & _aAddedTree, rtl::OUString const& _rName, bool _bToDefault);
~AddNode();
virtual std::auto_ptr<Change> clone() const;
@@ -217,17 +212,17 @@ namespace configmgr
In this case all calls to this method will return nonsense. This case can be detected by testing
whether <method>getAddedNode</method> returns NULL.
*/
- data::TreeAddress getInsertedTree() const { return m_aInsertedTree; }
+ sharable::TreeFragment * getInsertedTree() const { return m_aInsertedTree; }
/** returns the node this change represents; The Node object is owned by this change until
<method>releaseAddedNode</method> is called.<BR>
After ownership is lost this method returns NULL.
*/
- data::TreeSegment::TreeDataPtr getNewTreeData() const { return m_aOwnNewNode.getTreeData(); }
+ sharable::TreeFragment const * getNewTreeData() const { return m_aOwnNewNode.is() ? m_aOwnNewNode->fragment : 0; }
/** returns the node the change represents. .
*/
- data::TreeSegment getNewTree() const { return m_aOwnNewNode; }
+ rtl::Reference< data::TreeSegment > getNewTree() const { return m_aOwnNewNode; }
/** returns the node the change represents, and releases ownership of it. This means that
afterwards <method>getAddedNode</method> will return NULL. This change object keeps a reference
@@ -237,29 +232,26 @@ namespace configmgr
/** .
*/
- void setInsertedAddress(data::TreeAddress const & _aInsertedAddress);
+ void setInsertedAddress(sharable::TreeFragment * const & _aInsertedAddress);
/** returns the node this change replaces, ihe Node object is owned by this change.
After ownership is lost this method returns NULL.
*/
- data::TreeSegment::TreeDataPtr getReplacedTreeData() const { return m_aOwnOldNode.getTreeData(); }
+ sharable::TreeFragment const * getReplacedTreeData() const { return m_aOwnOldNode.is() ? m_aOwnOldNode->fragment : 0; }
/** returns the node the change replaces.
*/
- data::TreeSegment getReplacedTree() const { return m_aOwnOldNode; }
+ rtl::Reference< data::TreeSegment > getReplacedTree() const { return m_aOwnOldNode; }
/** forgets about the node the change replaces
*/
void clearReplacedTree() { m_aOwnOldNode.clear(); }
- void takeReplacedTree(data::TreeSegment const& _aTree);
+ void takeReplacedTree(rtl::Reference< data::TreeSegment > const& _aTree);
virtual void dispatch(ChangeTreeAction& anAction) const { anAction.handle(*this); }
virtual void dispatch(ChangeTreeModification& anAction) { anAction.handle(*this); }
-
- // "rtti"
- RTTI(AddNode, Change);
};
//==========================================================================
@@ -268,7 +260,7 @@ namespace configmgr
class RemoveNode : public Change
{
protected:
- data::TreeSegment m_aOwnOldNode;
+ rtl::Reference< data::TreeSegment > m_aOwnOldNode;
bool m_bIsToDefault;
private:
@@ -288,19 +280,16 @@ namespace configmgr
/** returns the node this change removes, ihe Node object is owned by this change.
After ownership is lost this method returns NULL.
*/
- data::TreeSegment::TreeDataPtr getRemovedTreeData() const { return m_aOwnOldNode.getTreeData(); }
+ sharable::TreeFragment const * getRemovedTreeData() const { return m_aOwnOldNode.is() ? m_aOwnOldNode->fragment : 0; }
/** returns the node the change removes.
*/
- data::TreeSegment getRemovedTree() const { return m_aOwnOldNode; }
+ rtl::Reference< data::TreeSegment > getRemovedTree() const { return m_aOwnOldNode; }
/** forgets about the node the change removes, returning the previous setting with ownership
*/
void clearRemovedTree() { m_aOwnOldNode.clear(); }
- void takeRemovedTree(data::TreeSegment const & _aTree);
-
- // "rtti"
- RTTI(RemoveNode, Change);
+ void takeRemovedTree(rtl::Reference< data::TreeSegment > const & _aTree);
};
//==========================================================================
@@ -332,10 +321,6 @@ namespace configmgr
friend class MutatingChildIterator;
public:
- /// A parameter for disabling copying of children
- typedef treeop::NoChildCopy NoChildCopy;
- typedef treeop::DeepChildCopy DeepChildCopy;
-
SubtreeChange(const rtl::OUString& _rName,
const node::Attributes& _rAttr,
bool _bToDefault = false)
@@ -367,7 +352,7 @@ namespace configmgr
m_aAttributes.markAsDefault(_bToDefault);
}
- SubtreeChange(const SubtreeChange& _rChange, NoChildCopy)
+ SubtreeChange(const SubtreeChange& _rChange, treeop::NoChildCopy)
: Change(_rChange)
, m_sTemplateName(_rChange.getElementTemplateName())
, m_sTemplateModule(_rChange.getElementTemplateModule())
@@ -376,7 +361,7 @@ namespace configmgr
~SubtreeChange();
- SubtreeChange(const SubtreeChange&, DeepChildCopy);
+ SubtreeChange(const SubtreeChange&, treeop::DeepChildCopy);
virtual std::auto_ptr<Change> clone() const;
@@ -410,9 +395,6 @@ namespace configmgr
void forEachChange(ChangeTreeAction& _anAction) const;
void forEachChange(ChangeTreeModification& _anAction);
- // "rtti"
- RTTI(SubtreeChange, Change);
-
private:
virtual Change* doGetChild(rtl::OUString const& _rName) const;
};
@@ -459,11 +441,10 @@ namespace configmgr
class SubtreeChange::MutatingChildIterator
{
protected:
- typedef SubtreeChange::Children::iterator Base;
- Base m_aBaseIter;
+ SubtreeChange::Children::iterator m_aBaseIter;
friend class SubtreeChange;
- MutatingChildIterator(Base aBase) : m_aBaseIter(aBase) {};
+ MutatingChildIterator(SubtreeChange::Children::iterator aBase) : m_aBaseIter(aBase) {};
public:
Change& current() const { return *m_aBaseIter->second; }
@@ -498,8 +479,6 @@ namespace configmgr
public:
SubtreeChangeReferrer(const SubtreeChange& _rSource);
~SubtreeChangeReferrer();
-
- RTTI(SubtreeChangeReferrer, SubtreeChange);
};
////////////////////////////////////////////////////////////////////////////////
diff --git a/configmgr/source/inc/commontypes.hxx b/configmgr/source/inc/commontypes.hxx
deleted file mode 100644
index 9709b52e85..0000000000
--- a/configmgr/source/inc/commontypes.hxx
+++ /dev/null
@@ -1,68 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: commontypes.hxx,v $
- * $Revision: 1.7 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _CONFIGMGR_COMMONTYPES_HXX_
-#define _CONFIGMGR_COMMONTYPES_HXX_
-
-#include <rtl/ustring.hxx>
-#include <com/sun/star/container/XNamed.hpp>
-#include <com/sun/star/uno/Any.hxx>
-
-#ifndef INCLUDED_FUNCTIONAL
-#include <functional>
-#define INCLUDED_FUNCTIONAL
-#endif
-
-//..........................................................................
-namespace configmgr
-{
-//..........................................................................
-
-//==========================================================================
-//= IInterface
-//==========================================================================
-/** abstract base class for objects which may be aquired by ORef's
- (in opposite to the IReference, classes deriving from this IInterface can be
- derived from XInterface, too)
-*/
-class IInterface
-{
-public:
- virtual void SAL_CALL acquire( ) throw () = 0;
- virtual void SAL_CALL release( ) throw () = 0;
-};
-
-//..........................................................................
-} // namespace configmgr
-//..........................................................................
-
-#endif // _CONFIGMGR_COMMONTYPES_HXX_
-
-
diff --git a/configmgr/source/inc/confapifactory.hxx b/configmgr/source/inc/confapifactory.hxx
index d8b34a538e..1ca7f09818 100644
--- a/configmgr/source/inc/confapifactory.hxx
+++ b/configmgr/source/inc/confapifactory.hxx
@@ -63,14 +63,12 @@ namespace configmgr
struct ServiceRegistrationInfo;
struct SingletonRegistrationInfo;
- typedef uno::Reference< uno::XComponentContext > CreationContext;
-
// provider instantiation
uno::Reference<uno::XInterface> SAL_CALL
- getDefaultConfigProviderSingleton( CreationContext const& xContext );
+ getDefaultConfigProviderSingleton( uno::Reference< uno::XComponentContext > const& xContext );
uno::Reference<uno::XInterface> SAL_CALL
- instantiateDefaultProvider( CreationContext const& xContext );
+ instantiateDefaultProvider( uno::Reference< uno::XComponentContext > const& xContext );
// provider service info
const SingletonRegistrationInfo * getDefaultProviderSingletonInfo();
@@ -80,13 +78,13 @@ namespace configmgr
// other services - instantiation and info
uno::Reference< uno::XInterface > SAL_CALL
- instantiateConfigRegistry( CreationContext const& xContext );
+ instantiateConfigRegistry( uno::Reference< uno::XComponentContext > const& xContext );
const ServiceRegistrationInfo* getConfigurationRegistryServiceInfo();
// bootstrap context support
uno::Reference<uno::XInterface> SAL_CALL
- instantiateBootstrapContext( CreationContext const& xContext );
+ instantiateBootstrapContext( uno::Reference< uno::XComponentContext > const& xContext );
const SingletonRegistrationInfo * getBootstrapContextSingletonInfo();
const ServiceRegistrationInfo * getBootstrapContextServiceInfo();
@@ -94,11 +92,11 @@ namespace configmgr
namespace xml
{
uno::Reference< uno::XInterface > SAL_CALL instantiateSchemaParser
- ( CreationContext const& xContext );
+ ( uno::Reference< uno::XComponentContext > const& xContext );
uno::Reference< uno::XInterface > SAL_CALL instantiateLayerParser
- ( CreationContext const& xContext );
+ ( uno::Reference< uno::XComponentContext > const& xContext );
uno::Reference< uno::XInterface > SAL_CALL instantiateLayerWriter
- ( CreationContext const& xContext );
+ ( uno::Reference< uno::XComponentContext > const& xContext );
const ServiceRegistrationInfo* getSchemaParserServiceInfo();
const ServiceRegistrationInfo* getLayerParserServiceInfo();
@@ -107,25 +105,25 @@ namespace configmgr
namespace backend
{
uno::Reference<uno::XInterface> SAL_CALL
- getDefaultBackendSingleton( CreationContext const& xContext );
+ getDefaultBackendSingleton( uno::Reference< uno::XComponentContext > const& xContext );
uno::Reference<uno::XInterface> SAL_CALL
- instantiateDefaultBackend( CreationContext const& xContext );
+ instantiateDefaultBackend( uno::Reference< uno::XComponentContext > const& xContext );
uno::Reference< uno::XInterface > SAL_CALL
- instantiateUpdateMerger( CreationContext const& xContext );
+ instantiateUpdateMerger( uno::Reference< uno::XComponentContext > const& xContext );
uno::Reference<uno::XInterface> SAL_CALL
- instantiateSingleBackendAdapter( CreationContext const& xContext );
+ instantiateSingleBackendAdapter( uno::Reference< uno::XComponentContext > const& xContext );
uno::Reference< uno::XInterface > SAL_CALL
- instantiateMergeImporter( CreationContext const& xContext );
+ instantiateMergeImporter( uno::Reference< uno::XComponentContext > const& xContext );
uno::Reference< uno::XInterface > SAL_CALL
- instantiateCopyImporter( CreationContext const& xContext );
+ instantiateCopyImporter( uno::Reference< uno::XComponentContext > const& xContext );
uno::Reference<uno::XInterface> SAL_CALL
- instantiateMultiStratumBackend( CreationContext const& xContext );
+ instantiateMultiStratumBackend( uno::Reference< uno::XComponentContext > const& xContext );
const SingletonRegistrationInfo * getDefaultBackendSingletonInfo();
const ServiceRegistrationInfo * getDefaultBackendServiceInfo();
@@ -139,31 +137,31 @@ namespace configmgr
namespace localbe
{
uno::Reference<uno::XInterface> SAL_CALL
- instantiateLocalBackend( CreationContext const& xContext );
+ instantiateLocalBackend( uno::Reference< uno::XComponentContext > const& xContext );
uno::Reference<uno::XInterface> SAL_CALL
- instantiateLocalDataImporter( CreationContext const& xContext );
+ instantiateLocalDataImporter( uno::Reference< uno::XComponentContext > const& xContext );
uno::Reference<uno::XInterface> SAL_CALL
- instantiateLocalHierarchyBrowser( CreationContext const& xContext );
+ instantiateLocalHierarchyBrowser( uno::Reference< uno::XComponentContext > const& xContext );
uno::Reference<uno::XInterface> SAL_CALL
- instantiateLocalSchemaSupplier( CreationContext const& xContext );
+ instantiateLocalSchemaSupplier( uno::Reference< uno::XComponentContext > const& xContext );
uno::Reference<uno::XInterface> SAL_CALL
- instantiateLocalLegacyStratum( CreationContext const& xContext );
+ instantiateLocalLegacyStratum( uno::Reference< uno::XComponentContext > const& xContext );
uno::Reference<uno::XInterface> SAL_CALL
- instantiateLocalDataStratum( CreationContext const& xContext );
+ instantiateLocalDataStratum( uno::Reference< uno::XComponentContext > const& xContext );
uno::Reference<uno::XInterface> SAL_CALL
- instantiateLocalReadonlyStratum( CreationContext const& xContext );
+ instantiateLocalReadonlyStratum( uno::Reference< uno::XComponentContext > const& xContext );
uno::Reference<uno::XInterface> SAL_CALL
- instantiateLocalResourceStratum( CreationContext const& xContext );
+ instantiateLocalResourceStratum( uno::Reference< uno::XComponentContext > const& xContext );
uno::Reference<uno::XInterface> SAL_CALL
- instantiateLocalMultiStratum( CreationContext const& xContext );
+ instantiateLocalMultiStratum( uno::Reference< uno::XComponentContext > const& xContext );
const ServiceRegistrationInfo * getLocalBackendServiceInfo();
const ServiceRegistrationInfo * getLocalDataImportServiceInfo();
diff --git a/configmgr/source/inc/confevents.hxx b/configmgr/source/inc/confevents.hxx
index dd5c971d9b..6b1376213a 100644
--- a/configmgr/source/inc/confevents.hxx
+++ b/configmgr/source/inc/confevents.hxx
@@ -31,8 +31,16 @@
#ifndef CONFIGMGR_API_EVENTS_HXX_
#define CONFIGMGR_API_EVENTS_HXX_
+#include <hash_set>
+#include <map>
+#include <set>
+
+#include "osl/mutex.hxx"
+#include "rtl/ref.hxx"
+#include "salhelper/simplereferenceobject.hxx"
+
+#include "configpath.hxx"
#include "utility.hxx"
-#include <rtl/ref.hxx>
namespace rtl { class OUString; }
@@ -40,52 +48,166 @@ namespace configmgr
{
class Change;
struct TreeChangeList;
- class RequestOptions;
+ class TreeManager;
namespace configuration { class AbsolutePath; }
- using configuration::AbsolutePath;
- struct IConfigBroadcaster;
- struct IConfigListener : public virtual configmgr::SimpleReferenceObject
+ struct IConfigListener : public salhelper::SimpleReferenceObject
{
- virtual void disposing(IConfigBroadcaster* pSource) = 0;
+ virtual void disposing(TreeManager * pSource) = 0;
};
struct INodeListener : IConfigListener
{
- virtual void nodeChanged(Change const& aChange, AbsolutePath const& aPath, IConfigBroadcaster* pSource) = 0;
- virtual void nodeDeleted(AbsolutePath const& aPath, IConfigBroadcaster* pSource) = 0;
+ virtual void nodeChanged(Change const& aChange, configuration::AbsolutePath const& aPath, TreeManager * pSource) = 0;
+ virtual void nodeDeleted(configuration::AbsolutePath const& aPath, TreeManager * pSource) = 0;
};
- typedef rtl::Reference<INodeListener> INodeListenerRef;
- struct IConfigBroadcaster
+ namespace internal
{
- protected:
- IConfigBroadcaster() {}
- virtual ~IConfigBroadcaster() {}
- public:
- virtual void addListener(AbsolutePath const& aPath, const RequestOptions& _aOptions, INodeListenerRef const& pListener) = 0;
- virtual void removeListener(const RequestOptions& _aOptions, INodeListenerRef const& pListener) = 0;
- };
+ ////////////////////////////////////////////////////////////////////////
+ template <class ListenerRef>
+ class BroadcastImplHelper
+ {
+ public:
+ osl::Mutex mutex;
+
+ public:
+ BroadcastImplHelper()
+ {}
+
+ ~BroadcastImplHelper()
+ {
+ OSL_ENSURE(m_aInterfaces.empty(), "Configuration Broadcaster was not disposed properly");
+ }
+
+ public:
+ typedef std::set<ListenerRef> Interfaces;
+
+ public:
+ typename Interfaces::iterator addListener(ListenerRef aListener)
+ {
+ return m_aInterfaces.insert(aListener).first;
+ }
+ void removeListener(ListenerRef aListener)
+ {
+ m_aInterfaces.erase(aListener);
+ }
+
+ void disposing(TreeManager * pSource);
+
+ public:
+ typename Interfaces::const_iterator begin() const { return m_aInterfaces.begin(); }
+ typename Interfaces::const_iterator end() const { return m_aInterfaces.end(); }
+
+ typename Interfaces::const_iterator find(ListenerRef aListener) const { return m_aInterfaces.find(aListener); }
+ typename Interfaces::iterator findFull(ListenerRef aListener) { return m_aInterfaces.find(aListener); }
+ private:
+ Interfaces m_aInterfaces;
+
+ // no implementation - not copyable
+ BroadcastImplHelper(BroadcastImplHelper&);
+ void operator=(BroadcastImplHelper&);
+ };
+
+ ////////////////////////////////////////////////////////////////////////
+ template <class Listener>
+ void BroadcastImplHelper<Listener>::disposing(TreeManager * pSource)
+ {
+ osl::ClearableMutexGuard aGuard(this->mutex); // ensure that no notifications are running
+
+ Interfaces aTargets;
+ aTargets.swap(m_aInterfaces);
+
+ aGuard.clear();
+ for(typename Interfaces::iterator it = aTargets.begin(); it != aTargets.end(); )
+ {
+ typename Interfaces::iterator cur = it++;
+ if (*cur)
+ (*cur)->disposing(pSource);
+ }
+ }
+
+
+ /////////////////////////////////////////////////////////////////////////
+
+ class NodeListenerInfo
+ {
+ public:
+ typedef std::hash_set<configuration::AbsolutePath, configuration::Path::Hash, configuration::Path::Equiv> Pathes;
- class ConfigChangeBroadcastHelper; // broadcasts changes for a given set of options
- class ConfigChangeBroadcaster : public IConfigBroadcaster
+ public:
+ NodeListenerInfo(rtl::Reference<INodeListener> const& pListener)
+ : m_pListener(pListener)
+ {
+ }
+
+ // path handling
+ Pathes const& pathList() const { return m_aPathes; }
+
+ void addPath(configuration::AbsolutePath const& sPath) const { m_aPathes.insert(sPath); }
+ void removePath(configuration::AbsolutePath const& sPath) const { m_aPathes.erase(sPath); }
+ //void removeChildPathes(OUString const& sPath);
+
+ // behave as pointer for use as a 'reference' class
+ rtl::Reference<INodeListener> get() const { return m_pListener; }
+ rtl::Reference<INodeListener> operator->() const { return get(); }
+ INodeListener& operator*() const { return *m_pListener; }
+ // needed to allow if (info) ...
+ struct HasListener;
+ operator HasListener const*() const { return reinterpret_cast<HasListener*>(m_pListener.get()); }
+
+ bool operator < (NodeListenerInfo const& aInfo) const
+ { return std::less<INodeListener*>()(m_pListener.get(), aInfo.m_pListener.get()); }
+
+ bool operator == (NodeListenerInfo const& aInfo) const
+ { return !!( m_pListener == aInfo.m_pListener); }
+
+ bool operator > (NodeListenerInfo const& aInfo) const
+ { return aInfo.operator < (*this); }
+ bool operator >= (NodeListenerInfo const& aInfo) const
+ { return !operator<(aInfo); }
+ bool operator <= (NodeListenerInfo const& aInfo) const
+ { return !operator>(aInfo); }
+
+ bool operator != (NodeListenerInfo const& aInfo) const
+ { return !operator==(aInfo); }
+
+ private:
+ rtl::Reference<INodeListener> m_pListener;
+ mutable Pathes m_aPathes; // hack to be mutable even as set element
+ };
+ } // namespace
+
+ /////////////////////////////////////////////////////////////////////////
+ class ConfigChangeBroadcastHelper // broadcasts changes for a given set of options
{
public:
- ConfigChangeBroadcaster();
- virtual ~ConfigChangeBroadcaster();
-
- virtual void addListener(AbsolutePath const& aName, const RequestOptions& _aOptions, INodeListenerRef const& pListener);
- virtual void removeListener(const RequestOptions& _aOptions, INodeListenerRef const& pListener);
-
- protected:
- virtual void fireChanges(TreeChangeList const& _aChanges, sal_Bool _bError);
- protected:
- virtual ConfigChangeBroadcastHelper* getBroadcastHelper(const RequestOptions& _aOptions, bool bCreate) = 0;
- ConfigChangeBroadcastHelper* newBroadcastHelper(); // needed to implement the preceding
- void disposeBroadcastHelper(ConfigChangeBroadcastHelper* pHelper); // needed to discard the preceding
- };
+ ConfigChangeBroadcastHelper();
+ ~ConfigChangeBroadcastHelper();
+ void broadcast(TreeChangeList const& anUpdate, sal_Bool bError, TreeManager * pSource);
+
+ void addListener(configuration::AbsolutePath const& aName, rtl::Reference<INodeListener> const& );
+ void removeListener(rtl::Reference<INodeListener> const&);
+
+ void dispose(TreeManager * pSource);
+
+ private:
+ void add(configuration::AbsolutePath const& aPath, rtl::Reference<INodeListener> const& pListener);
+ void remove(rtl::Reference<INodeListener> const& pListener);
+
+ void dispatch(Change const& rBaseChange, configuration::AbsolutePath const& sChangeLocation, sal_Bool _bError, TreeManager * pSource);
+ void dispatch(TreeChangeList const& rList_, sal_Bool _bError, TreeManager * pSource);
+ void disposing(TreeManager * pSource);
+
+ void dispatchInner(rtl::Reference<INodeListener> const& pTarget, configuration::AbsolutePath const& sTargetPath, Change const& rBaseChange, configuration::AbsolutePath const& sChangeLocation, sal_Bool _bError, TreeManager * pSource);
+ void dispatchOuter(rtl::Reference<INodeListener> const& pTarget, configuration::AbsolutePath const& sTargetPath, Change const& rBaseChange, configuration::AbsolutePath const& sChangeLocation, sal_Bool _bError, TreeManager * pSource);
+
+ typedef std::multimap<configuration::AbsolutePath, internal::BroadcastImplHelper<internal::NodeListenerInfo>::Interfaces::iterator, configuration::Path::Before> PathMap;
+ internal::BroadcastImplHelper<internal::NodeListenerInfo> m_aListeners;
+ PathMap m_aPathMap;
+ };
} // namespace
#endif // CONFIGMGR_API_EVENTS_HXX_
diff --git a/configmgr/source/inc/configdefaultprovider.hxx b/configmgr/source/inc/configdefaultprovider.hxx
index 645f8ac0b4..c8eff20009 100644
--- a/configmgr/source/inc/configdefaultprovider.hxx
+++ b/configmgr/source/inc/configdefaultprovider.hxx
@@ -44,9 +44,9 @@ namespace configmgr
{
//-----------------------------------------------------------------------------
class ISubtree;
- class IConfigDefaultProvider;
class IDefaultableTreeManager;
class RequestOptions;
+ class TreeManager;
namespace uno = com::sun::star::uno;
//-----------------------------------------------------------------------------
@@ -55,7 +55,6 @@ namespace configmgr
//-----------------------------------------------------------------------------
class Tree;
- class TreeRef;
class NodeRef;
//-----------------------------------------------------------------------------
@@ -68,9 +67,9 @@ namespace configmgr
public:
// factory methods
static DefaultProvider createEmpty();
- static DefaultProvider create(Tree const& _aRootTree,
+ static DefaultProvider create(rtl::Reference< Tree > const& _aRootTree,
RequestOptions const& _xOptions,
- rtl::Reference< IConfigDefaultProvider > const & _xDefaultProvider,
+ rtl::Reference< TreeManager > const & _xDefaultProvider,
IDefaultableTreeManager* _pDefaultableTree);
// actual c'tor
@@ -85,10 +84,10 @@ namespace configmgr
bool isValid() const { return !! m_aProxy.is(); }
/// tries to load a default instance of the specified node
- std::auto_ptr<ISubtree> getDefaultTree(Tree const& _aTree, NodeRef const& _aNode) const CFG_UNO_THROW_ALL();
+ std::auto_ptr<ISubtree> getDefaultTree(rtl::Reference< Tree > const& _aTree, NodeRef const& _aNode) const SAL_THROW((com::sun::star::uno::Exception));
/// tries to load default data into the specified tree
- bool fetchDefaultData(TreeRef const& _aTreeRef) const CFG_UNO_THROW_ALL();
+ bool fetchDefaultData(rtl::Reference< Tree > const& _aTreeRef) const SAL_THROW((com::sun::star::uno::Exception));
};
//-----------------------------------------------------------------------------
diff --git a/configmgr/source/inc/configexcept.hxx b/configmgr/source/inc/configexcept.hxx
index b5de2f88d1..c9fa1c0f38 100644
--- a/configmgr/source/inc/configexcept.hxx
+++ b/configmgr/source/inc/configexcept.hxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: configexcept.hxx,v $
- * $Revision: 1.6.4.1 $
+ * $Revision: 1.6.10.2 $
*
* This file is part of OpenOffice.org.
*
@@ -41,7 +41,6 @@ namespace configmgr
//-------------------------------------------------------------------------
namespace uno = ::com::sun::star::uno;
namespace lang = ::com::sun::star::lang;
- using rtl::OUString;
//-----------------------------------------------------------------------------
namespace configuration
{
@@ -55,7 +54,7 @@ namespace configmgr
Exception(rtl::OString const& sAsciiMessage);
virtual ~Exception() {}
- virtual OUString message() const;
+ virtual rtl::OUString message() const;
virtual char const* what() const;
};
//-------------------------------------------------------------------------
@@ -64,9 +63,9 @@ namespace configmgr
{
rtl::OUString m_sName;
public:
- InvalidName(OUString const& sName, char const* sAsciiDescription);
+ InvalidName(rtl::OUString const& sName, char const* sAsciiDescription);
- virtual OUString message() const;
+ virtual rtl::OUString message() const;
};
//-------------------------------------------------------------------------
@@ -80,13 +79,13 @@ namespace configmgr
class TypeMismatch : public Exception
{
- OUString m_sTypes;
- static OUString describe(OUString const& sFoundType, OUString const& sExpectedType);
+ rtl::OUString m_sTypes;
+ static rtl::OUString describe(rtl::OUString const& sFoundType, rtl::OUString const& sExpectedType);
public:
- TypeMismatch(OUString const& sFoundType, OUString const& sExpectedType);
- TypeMismatch(OUString const& sFoundType, OUString const& sExpectedType, char const* sAsciiDescription);
+ TypeMismatch(rtl::OUString const& sFoundType, rtl::OUString const& sExpectedType);
+ TypeMismatch(rtl::OUString const& sFoundType, rtl::OUString const& sExpectedType, char const* sAsciiDescription);
- virtual OUString message() const;
+ virtual rtl::OUString message() const;
};
//-------------------------------------------------------------------------
}
@@ -100,14 +99,14 @@ namespace configmgr
{
configuration::Exception& m_eOriginal;
uno::Reference<uno::XInterface> m_xContext;
- OUString m_sMessage;
+ rtl::OUString m_sMessage;
public:
ExceptionMapper(configuration::Exception& e);
~ExceptionMapper();
void setContext(uno::XInterface* pContext);
- OUString message() const;
+ rtl::OUString message() const;
uno::Reference<uno::XInterface> context() const;
void illegalArgument(sal_Int16 nArgument = -1) throw(lang::IllegalArgumentException);
diff --git a/configmgr/source/inc/configgroup.hxx b/configmgr/source/inc/configgroup.hxx
index bbe80c1cfe..99be0b0a18 100644
--- a/configmgr/source/inc/configgroup.hxx
+++ b/configmgr/source/inc/configgroup.hxx
@@ -46,11 +46,6 @@ namespace configmgr
{
//-----------------------------------------------------------------------------
- typedef com::sun::star::uno::Type UnoType;
- typedef com::sun::star::uno::Any UnoAny;
- typedef com::sun::star::uno::Reference<com::sun::star::script::XTypeConverter> UnoTypeConverter;
-//-----------------------------------------------------------------------------
-
class NodeChange;
class RelativePath;
//-----------------------------------------------------------------------------
@@ -58,35 +53,35 @@ namespace configmgr
/// helper for updating a <type>NodeRef</type> that refers to a Group
class GroupUpdateHelper
{
- Tree m_aTree;
+ rtl::Reference< Tree > m_aTree;
NodeRef m_aNode;
public:
- GroupUpdateHelper(Tree const& aParentTree, NodeRef const& aGroupNode);
+ GroupUpdateHelper(rtl::Reference< Tree > const& aParentTree, NodeRef const& aGroupNode);
~GroupUpdateHelper() {}
void validateNode(ValueRef const& aNode) const;
void validateNode(NodeRef const& aNode) const;
- Tree const& tree() const { return m_aTree; }
+ rtl::Reference< Tree > const& tree() const { return m_aTree; }
NodeRef const& node() const { return m_aNode; }
private:
- void implValidateTree(Tree const& aTree) const;
- void implValidateNode(Tree const& aTree, NodeRef const& aNode) const;
- void implValidateNode(Tree const& aTree, ValueRef const& aNode) const;
+ void implValidateTree(rtl::Reference< Tree > const& aTree) const;
+ void implValidateNode(rtl::Reference< Tree > const& aTree, NodeRef const& aNode) const;
+ void implValidateNode(rtl::Reference< Tree > const& aTree, ValueRef const& aNode) const;
};
//-----------------------------------------------------------------------------
/// allows to update values of a simple type within a <type>NodeRef</type> that refers to a Group
class GroupUpdater
{
GroupUpdateHelper m_aHelper;
- UnoTypeConverter m_xTypeConverter;
+ com::sun::star::uno::Reference<com::sun::star::script::XTypeConverter> m_xTypeConverter;
public:
- GroupUpdater(Tree const& aParentTree, NodeRef const& aGroupNode, UnoTypeConverter const& xConverter);
+ GroupUpdater(rtl::Reference< Tree > const& aParentTree, NodeRef const& aGroupNode, com::sun::star::uno::Reference<com::sun::star::script::XTypeConverter> const& xConverter);
- NodeChange validateSetValue(ValueRef const& aValueNode, UnoAny const& newValue );
+ NodeChange validateSetValue(ValueRef const& aValueNode, com::sun::star::uno::Any const& newValue );
private:
- UnoAny implValidateValue(Tree const& aTree, ValueRef const& aNode, UnoAny const& aValue) const;
+ com::sun::star::uno::Any implValidateValue(rtl::Reference< Tree > const& aTree, ValueRef const& aNode, com::sun::star::uno::Any const& aValue) const;
};
//-----------------------------------------------------------------------------
@@ -97,7 +92,7 @@ namespace configmgr
DefaultProvider m_aDefaultProvider;
bool m_bHasDoneSet;
public:
- GroupDefaulter(Tree const& _aParentTree, NodeRef const& _aGroupNode, DefaultProvider const& _aProvider);
+ GroupDefaulter(rtl::Reference< Tree > const& _aParentTree, NodeRef const& _aGroupNode, DefaultProvider const& _aProvider);
bool hasDoneSet() const { return m_bHasDoneSet; }
@@ -109,14 +104,14 @@ namespace configmgr
NodeChanges validateSetAllToDefault();
- static bool isDataAvailable(TreeRef const& _aParentTree, NodeRef const& _aGroupNode);
- static bool ensureDataAvailable(TreeRef const& _aParentTree, NodeRef const& _aGroupNode, DefaultProvider const& _aSource);
+ static bool isDataAvailable(rtl::Reference< Tree > const& _aParentTree, NodeRef const& _aGroupNode);
+ static bool ensureDataAvailable(rtl::Reference< Tree > const& _aParentTree, NodeRef const& _aGroupNode, DefaultProvider const& _aSource);
};
//-----------------------------------------------------------------------------
- bool isPossibleValueType(UnoType const& aValueType);
+ bool isPossibleValueType(com::sun::star::uno::Type const& aValueType);
//-----------------------------------------------------------------------------
- bool convertCompatibleValue(UnoTypeConverter const& xConverter, uno::Any& rConverted,
- UnoAny const& rNewValue, UnoType const& rTargetType);
+ bool convertCompatibleValue(com::sun::star::uno::Reference<com::sun::star::script::XTypeConverter> const& xConverter, uno::Any& rConverted,
+ com::sun::star::uno::Any const& rNewValue, com::sun::star::uno::Type const& rTargetType);
//-----------------------------------------------------------------------------
}
}
diff --git a/configmgr/source/inc/configpath.hxx b/configmgr/source/inc/configpath.hxx
index a91264ebd1..05b09337f8 100644
--- a/configmgr/source/inc/configpath.hxx
+++ b/configmgr/source/inc/configpath.hxx
@@ -42,136 +42,60 @@ namespace configmgr
{
namespace configuration
{
- //------------------------------------------------------------------------
- using rtl::OUString;
- //------------------------------------------------------------------------
- /// A tag struct for disabling validity checking on arguments
- namespace argument { struct NoValidate {}; }
-
- class Name;
- class AbsolutePath;
- class RelativePath;
- //------------------------------------------------------------------------
- namespace Path { struct PackageOnly; }
-
- /// represents a name for a node in the configuration
- class Name
- {
- public:
- /// A dummy parameter for disabling validity checking on arguments
- typedef argument::NoValidate NoValidate;
-
- /// construct a Name from a String (internal use only - use creation wrapper functions)
- explicit Name(OUString const& aString, Path::PackageOnly) SAL_THROW(());
-
- public:
- /// construct an empty Name
- Name() SAL_THROW(()) : m_sRep() {}
-
- /// check whether this is an empty Name
- bool isEmpty() const SAL_THROW(()) { return m_sRep.getLength() == 0; }
-
- /// get a string representation of this Name
- const OUString& toString() const SAL_THROW(()) { return m_sRep; }
-
- public:
- // comparison operators
- // equality (== is primary)
- friend bool operator==(Name const& lhs, Name const& rhs) SAL_THROW(())
- { return !!(lhs.m_sRep == rhs.m_sRep); }
-
- // comparison operators
- // ordering (< is primary)
- friend bool operator< (Name const& lhs, Name const& rhs) SAL_THROW(())
- { return !!(lhs.m_sRep < rhs.m_sRep); }
-
- // hashing support
- size_t hashCode() const SAL_THROW(()) { return m_sRep.hashCode(); }
- private:
- OUString m_sRep;
- };
//--------------------------------------------------------------------
/** check if this is a well-formed name for a
config Node (excluding set elements)
*/
- bool isSimpleName(OUString const& sName) SAL_THROW(());
+ bool isSimpleName(rtl::OUString const& sName) SAL_THROW(());
- /** check if this is a well-formed name for a
- config Node (excluding set elements)
- */
- inline
- bool isSimpleName(Name const& sName) SAL_THROW(())
- { return isSimpleName(sName.toString()); }
-
- /** make a <type>Name</type> out of <var>sName</var>
- without full Validation.
- */
- Name makeName(OUString const& sName, argument::NoValidate) SAL_THROW(());
-
- /** make a <type>Name</type> out of <var>sName</var>,
- which should be used for a config Node (excluding set elements)
- */
- Name makeNodeName(OUString const& sName, argument::NoValidate) SAL_THROW(());
-
- /** make a <type>Name</type> out of <var>sName</var>,
- which should be used for a config set elements
- */
- Name makeElementName(OUString const& sName, argument::NoValidate) SAL_THROW(());
-
- /** make a <type>Name</type> out of <var>sName</var>,
+ /** make a name out of <var>sName</var>,
validating that it can be used for a config Node (excluding set elements)
or template name.
@throws InvalidName
if the name is not valid for that purpose
*/
- Name validateNodeName(OUString const& sName);
+ rtl::OUString validateNodeName(rtl::OUString const& sName);
- /** make a <type>Name</type> out of <var>sName</var>
+ /** make a name out of <var>sName</var>
validating that it can be used for a config set element
@throws InvalidName
if the name is not valid for that purpose
*/
- Name validateElementName(OUString const& sName);
+ rtl::OUString validateElementName(rtl::OUString const& sName);
//------------------------------------------------------------------------
//------------------------------------------------------------------------
namespace Path
{
//------------------------------------------------------------------------
- /// tag for disabling validity checking on arguments
- using argument::NoValidate;
-
- //------------------------------------------------------------------------
class Component
{
/// holds the contents of this path component
- Name m_aName;
+ rtl::OUString m_aName;
public:
/// construct a path component from a string, without any validation
- Component(OUString const& _sName, PackageOnly) SAL_THROW(());
- /// construct a path component from a Name, without any validation
- Component(Name const& _aName, PackageOnly) SAL_THROW(());
+ Component(rtl::OUString const& _sName) SAL_THROW(());
/// is this component an empty name ?
- bool isEmpty() const SAL_THROW(()) { return m_aName.isEmpty(); }
+ bool isEmpty() const SAL_THROW(()) { return m_aName.getLength() == 0; }
/// is this component a simple name ?
bool isSimpleName() const SAL_THROW(());
/// get the inner name for this component
- Name getName() const SAL_THROW(());
+ rtl::OUString getName() const SAL_THROW(());
/// get the embedded type name for this component (if any)
- Name getTypeName() const SAL_THROW(());
+ rtl::OUString getTypeName() const SAL_THROW(());
/// get the contents of this as string (unparsed).
- OUString toPathString() const SAL_THROW(()) { return m_aName.toString(); }
+ rtl::OUString toPathString() const SAL_THROW(()) { return m_aName; }
// hashing - for hash maps. compatible to equiv or matches
size_t hashCode() const SAL_THROW(())
{ return this->getName().hashCode(); }
- /// get the contents of this as a Name (unparsed). Use with care !
- Name const& getInternalName() const SAL_THROW(()) { return m_aName; }
+ /// get the contents of this as a name (unparsed). Use with care !
+ rtl::OUString const& getInternalName() const SAL_THROW(()) { return m_aName; }
};
@@ -192,18 +116,11 @@ namespace configmgr
//-------------------------------------------------------------------------
/// construct a path component from a name, validating it as simple name
- Component wrapSimpleName(Name const& _aName);
+ Component wrapSimpleName(rtl::OUString const& _aName);
/// construct a path component from a type and element name, using a wildcard if no type is available
- Component makeCompositeName(Name const& _aElementName, Name const& _aTypeName);
+ Component makeCompositeName(rtl::OUString const& _aElementName, rtl::OUString const& _aTypeName);
- //-------------------------------------------------------------------------
- /// construct a path component from a string, validating it as simple name
- Component wrapSimpleName(OUString const& _sName);
-
- /// construct a path component from a type and element name as strings, using a wildcard if no type is available
- Component makeCompositeName(OUString const& _sElementName, OUString const& _sTypeName);
-
//-----------------------------------------------------------------------------
/// construct a composite path component from a element name or string, using a wildcard type
template <class NameRep>
@@ -227,16 +144,6 @@ namespace configmgr
class Rep
{
public:
- /// a sequence of element names which make up a path
- typedef std::vector<Component> Components;
- /// a (read-only) iterator to the element names which make up a path
- typedef Components::const_reverse_iterator Iterator;
- /// a (mutating) iterator to the element names which make up a path
- typedef Components::reverse_iterator MutatingIterator;
- /// type used to specify a component count
- typedef Components::size_type size_type;
-
- public:
/// construct an empty path
Rep() SAL_THROW(()) : m_aComponents() {}
@@ -244,7 +151,7 @@ namespace configmgr
explicit Rep(Component const& _aName) SAL_THROW(()) : m_aComponents(1,_aName) {}
/// construct a path consisting of a path subrange
- explicit Rep(Iterator const& _first, Iterator const& _last)
+ explicit Rep(std::vector<Component>::const_reverse_iterator const& _first, std::vector<Component>::const_reverse_iterator const& _last)
: m_aComponents(_last.base(), _first.base()) {}
/// swap contents with another instance
@@ -266,34 +173,34 @@ namespace configmgr
void dropFirstName() { check_not_empty(); m_aComponents.pop_back(); }
/// get a /-separated string representation of this
- OUString toString(bool _bAbsolute) const SAL_THROW(());
+ rtl::OUString toString(bool _bAbsolute) const SAL_THROW(());
public:
/// check if this is an empty path
bool isEmpty() const SAL_THROW(()) { return m_aComponents.empty(); }
/// Count the components of this
- size_type countComponents() const SAL_THROW(()) { return m_aComponents.size(); }
+ std::vector<Component>::size_type countComponents() const SAL_THROW(()) { return m_aComponents.size(); }
/// Insert a component into this path
- void insertComponent(MutatingIterator _it, Component _aName)
+ void insertComponent(std::vector<Component>::reverse_iterator _it, Component _aName)
{ m_aComponents.insert(_it.base(),_aName); }
/// Remove a component from this path
- void removeComponent(MutatingIterator _it) { m_aComponents.erase(_it.base()); }
+ void removeComponent(std::vector<Component>::reverse_iterator _it) { m_aComponents.erase(_it.base()); }
/// Remove all components from this path
void clearComponents() SAL_THROW(()) { m_aComponents.clear(); }
/// get a STL style iterator to the first component
- Iterator begin() const SAL_THROW(()) { return m_aComponents.rbegin(); }
+ std::vector<Component>::const_reverse_iterator begin() const SAL_THROW(()) { return m_aComponents.rbegin(); }
/// get a STL style iterator to after the last component
- Iterator end() const SAL_THROW(()) { return m_aComponents.rend(); }
+ std::vector<Component>::const_reverse_iterator end() const SAL_THROW(()) { return m_aComponents.rend(); }
/// get a STL style iterator to the first component
- MutatingIterator begin_mutate() SAL_THROW(()) { return m_aComponents.rbegin(); }
+ std::vector<Component>::reverse_iterator begin_mutate() SAL_THROW(()) { return m_aComponents.rbegin(); }
/// get a STL style iterator to after the last component
- MutatingIterator end_mutate() SAL_THROW(()) { return m_aComponents.rend(); }
+ std::vector<Component>::reverse_iterator end_mutate() SAL_THROW(()) { return m_aComponents.rend(); }
// hashing - for hash maps
size_t hashCode() const SAL_THROW(());
@@ -302,7 +209,7 @@ namespace configmgr
void check_not_empty() const;
private:
- Components m_aComponents;
+ std::vector<Component> m_aComponents;
};
//------------------------------------------------------------------------
@@ -323,16 +230,8 @@ namespace configmgr
Rep stripMatchingPrefix(Rep const& _aPath,Rep const& _aPrefix);
//------------------------------------------------------------------------
- /// a (read-only) iterator to the element names which make up a path
- typedef Rep::Iterator Iterator;
- /// a (mutating) iterator to the element names which make up a path
- typedef Rep::MutatingIterator MutatingIterator;
- /// a (mutating) iterator to the element names which make up a path
- typedef Rep::size_type size_type;
- //------------------------------------------------------------------------
-
/// distinguishes which kind of path is present in a string
- bool isAbsolutePath(OUString const& _sPath);
+ bool isAbsolutePath(rtl::OUString const& _sPath);
//------------------------------------------------------------------------
}
//------------------------------------------------------------------------
@@ -341,14 +240,9 @@ namespace configmgr
{
Path::Rep m_aRep;
public:
- /// a (read-only) iterator to the element names which make up a path
- typedef Path::Iterator Iterator;
- /// a (mutating) iterator to the element names which make up a path
- typedef Path::MutatingIterator MutatingIterator;
- public:
// Construction
/// construct a relative path from <var>aString</var> throwing InvalidName for parse errors
- static RelativePath parse(OUString const& _aString);
+ static RelativePath parse(rtl::OUString const& _aString);
/// construct an empty relative path
RelativePath() SAL_THROW(()) : m_aRep() { init(); }
@@ -367,7 +261,7 @@ namespace configmgr
bool isEmpty() const SAL_THROW(()) { return m_aRep.isEmpty(); }
/// Count the components of this
- Path::size_type getDepth() const SAL_THROW(()) { return m_aRep.countComponents(); }
+ std::vector<Path::Component>::size_type getDepth() const SAL_THROW(()) { return m_aRep.countComponents(); }
/// get the local name (the last component of this path)
Path::Component const& getLocalName() const { return m_aRep.getLocalName(); }
@@ -379,18 +273,18 @@ namespace configmgr
void dropFirstName() { m_aRep.dropFirstName(); }
/// get a /-separated string representation of this
- OUString toString() const SAL_THROW(());
+ rtl::OUString toString() const SAL_THROW(());
public:
// Iteration support
/// get a STL style iterator to the first component
- Iterator begin() const SAL_THROW(()) { return m_aRep.begin(); }
+ std::vector<Path::Component>::const_reverse_iterator begin() const SAL_THROW(()) { return m_aRep.begin(); }
/// get a STL style iterator to after the last component
- Iterator end() const SAL_THROW(()) { return m_aRep.end(); }
+ std::vector<Path::Component>::const_reverse_iterator end() const SAL_THROW(()) { return m_aRep.end(); }
/// get a STL style iterator to the first component
- MutatingIterator begin_mutate() SAL_THROW(()) { return m_aRep.begin_mutate(); }
+ std::vector<Path::Component>::reverse_iterator begin_mutate() SAL_THROW(()) { return m_aRep.begin_mutate(); }
/// get a STL style iterator to after the last component
- MutatingIterator end_mutate() SAL_THROW(()) { return m_aRep.end_mutate(); }
+ std::vector<Path::Component>::reverse_iterator end_mutate() SAL_THROW(()) { return m_aRep.end_mutate(); }
// Direct access - 'package' visible
/// Get a reference to (or copy of) the internal PathRep of this
@@ -410,27 +304,12 @@ namespace configmgr
{
Path::Rep m_aRep;
public:
- /// A dummy parameter for disabling validity checking on arguments
- typedef argument::NoValidate NoValidate;
-
- /// a (read-only) iterator to the element names which make up a path
- typedef Path::Iterator Iterator;
- /// a (mutating) iterator to the element names which make up a path
- typedef Path::MutatingIterator MutatingIterator;
- public:
// Construction
/// construct a absolute path from <var>aString</var> throwing InvalidName for parse errors
- static AbsolutePath parse(OUString const& _aString);
-
- /// construct a absolute path to a whole module (toplevel)
- static AbsolutePath makeModulePath(Name const& _aModuleName)
- { return AbsolutePath( Path::Rep( Path::wrapSimpleName(_aModuleName) ) ); }
-
- /// construct a absolute path to a whole module (toplevel)
- static AbsolutePath makeModulePath(Name const& _aModuleName, NoValidate) SAL_THROW(());
+ static AbsolutePath parse(rtl::OUString const& _aString);
/// construct a absolute path to a whole module (toplevel) without error checking
- static AbsolutePath makeModulePath(OUString const& _aString, NoValidate) SAL_THROW(());
+ static AbsolutePath makeModulePath(rtl::OUString const& _aString) SAL_THROW(());
/// construct an absolute path to the (virtual) hierarchy root
static AbsolutePath root() SAL_THROW(());
@@ -457,24 +336,24 @@ namespace configmgr
/// get the local name (the last component of this path)
Path::Component const& getLocalName() const { return m_aRep.getLocalName(); }
- Name const & getModuleName() const { return m_aRep.getFirstName().getInternalName(); }
+ rtl::OUString const & getModuleName() const { return m_aRep.getFirstName().getInternalName(); }
/// get a /-separated string representation of this
- OUString toString() const SAL_THROW(());
+ rtl::OUString toString() const SAL_THROW(());
/// Count the components of this
- Path::size_type getDepth() const SAL_THROW(()) { return m_aRep.countComponents(); }
+ std::vector<Path::Component>::size_type getDepth() const SAL_THROW(()) { return m_aRep.countComponents(); }
public:
// Iteration support
/// get a STL style iterator to the first component
- Iterator begin() const SAL_THROW(()) { return m_aRep.begin(); }
+ std::vector<Path::Component>::const_reverse_iterator begin() const SAL_THROW(()) { return m_aRep.begin(); }
/// get a STL style iterator to after the last component
- Iterator end() const SAL_THROW(()) { return m_aRep.end(); }
+ std::vector<Path::Component>::const_reverse_iterator end() const SAL_THROW(()) { return m_aRep.end(); }
/// get a STL style iterator to the first component
- MutatingIterator begin_mutate() SAL_THROW(()) { return m_aRep.begin_mutate(); }
+ std::vector<Path::Component>::reverse_iterator begin_mutate() SAL_THROW(()) { return m_aRep.begin_mutate(); }
/// get a STL style iterator to after the last component
- MutatingIterator end_mutate() SAL_THROW(()) { return m_aRep.end_mutate(); }
+ std::vector<Path::Component>::reverse_iterator end_mutate() SAL_THROW(()) { return m_aRep.end_mutate(); }
// Direct access - 'package' visible
/// Get a reference to (or copy of) the internal PathRep of this
@@ -487,20 +366,6 @@ namespace configmgr
inline bool matches(AbsolutePath const& lhs,AbsolutePath const& rhs) SAL_THROW(())
{ return Path::matches(lhs.rep(),rhs.rep()); }
- //------------------------------------------------------------------------
- // Derived comparison operator implementations
- //------------------------------------------------------------------------
- inline bool operator!=(Name const& lhs, Name const& rhs) SAL_THROW(())
- { return !(lhs == rhs); }
- //--------------------------------------------------------------------
- inline bool operator<=(Name const& lhs, Name const& rhs) SAL_THROW(())
- { return !(rhs < lhs); }
- inline bool operator> (Name const& lhs, Name const& rhs) SAL_THROW(())
- { return rhs < lhs; }
- inline bool operator>=(Name const& lhs, Name const& rhs) SAL_THROW(())
- { return !(lhs < rhs); }
- //------------------------------------------------------------------------
-
namespace Path
{
//------------------------------------------------------------------------
diff --git a/configmgr/source/inc/configset.hxx b/configmgr/source/inc/configset.hxx
index 3c1387c57b..62651a963f 100644
--- a/configmgr/source/inc/configset.hxx
+++ b/configmgr/source/inc/configset.hxx
@@ -52,109 +52,13 @@ namespace configmgr
namespace configuration
{
-//-----------------------------------------------------------------------------
-
- class ElementRef;
- class ElementTree;
- //---------------------------------------------------------------------
- class Name;
- class AbsolutePath;
namespace Path { class Component; }
//---------------------------------------------------------------------
- typedef com::sun::star::uno::Type UnoType;
- typedef com::sun::star::uno::Any UnoAny;
- typedef com::sun::star::uno::Reference<com::sun::star::script::XTypeConverter> UnoTypeConverter;
- //---------------------------------------------------------------------
-
- class ElementTreeImpl;
- typedef rtl::Reference<ElementTreeImpl> ElementTreeHolder;
+ class ElementTree;
class NodeChange;
class Template;
- typedef rtl::Reference<Template> TemplateHolder;
-//-----------------------------------------------------------------------------
- /// identifies a <type>Node</type> that is a element of a Container ("set").
- class ElementRef
- {
- ElementTreeHolder m_aTreeHolder;
- public:
- explicit ElementRef(ElementTreeImpl* pTree);
- ElementRef(ElementRef const& aOther);
- ElementRef& operator=(ElementRef const& aOther);
- ~ElementRef();
-
- bool isValid() const;
-
- Path::Component getFullName() const;
-
- TemplateHolder getTemplate() const;
-
- ElementTree getElementTree() const;
-
- TreeRef getTreeRef() const;
-
- static ElementRef extract(TreeRef const& aTree);
- };
-//-----------------------------------------------------------------------------
-
- /// provides information about a <type>Node</type> that is a element of a Container ("set").
- class ElementTree
- {
- ElementTreeHolder m_aTreeHolder;
- public:
- static ElementTree emptyElement() { return ElementTree(); }
-
- ElementTree(ElementTreeImpl* pTree);
- ElementTree(ElementTreeHolder const& pTree);
- ElementTree(ElementTree const& aOther);
- ElementTree& operator=(ElementTree const& aOther);
- ~ElementTree();
-
- bool isValid() const;
- ElementTreeHolder get() const;
- ElementTreeImpl* getImpl() const;
-
- ElementTreeImpl* operator->() const;
- ElementTreeImpl& operator*() const;
-
- Tree getTree() const;
-
- static ElementTree extract(Tree const& aTree);
- private:
- ElementTree();
- };
-//-----------------------------------------------------------------------------
-
- /// provides information about the elements of a <type>Node</type> that is a Container ("set").
- class TemplateInfo
- {
- TemplateHolder m_aTemplate;
- public:
- explicit TemplateInfo(TemplateHolder const& aTemplate);
-
- TemplateHolder getTemplate() const;
-
- UnoType getType() const;
- OUString getTemplatePathString() const;
- };
-//-----------------------------------------------------------------------------
-
- /// provides information about the elements of a <type>Node</type> that is a Container ("set").
- class SetElementInfo
- {
- TemplateInfo m_aTemplateInfo;
- public:
- SetElementInfo(TemplateHolder const& aTemplate);
-
- TemplateHolder getTemplate() const;
- TemplateInfo getTemplateInfo() const;
-
- UnoType getElementType() const { return m_aTemplateInfo.getType(); }
-
- static TemplateHolder extractElementInfo(Tree const& aTree, NodeRef const& aNode);
- };
-//-----------------------------------------------------------------------------
class SetElementFactory
{
@@ -165,10 +69,10 @@ namespace configmgr
SetElementFactory& operator=(SetElementFactory const& aOther);
~SetElementFactory();
- ElementTree instantiateTemplate(TemplateHolder const& aTemplate);
- ElementTree instantiateOnDefault(data::TreeSegment const& _aTree, TemplateHolder const& aDummyTemplate);
+ rtl::Reference< ElementTree > instantiateTemplate(rtl::Reference<Template> const& aTemplate);
+ rtl::Reference< ElementTree > instantiateOnDefault(rtl::Reference< data::TreeSegment > const& _aTree, rtl::Reference<Template> const& aDummyTemplate);
- static TemplateProvider findTemplateProvider(Tree const& aTree, NodeRef const& aNode);
+ static TemplateProvider findTemplateProvider(rtl::Reference< Tree > const& aTree, NodeRef const& aNode);
};
//-----------------------------------------------------------------------------
@@ -176,60 +80,59 @@ namespace configmgr
/// allows to insert,remove and replace an element of a <type>Node</type> that is a Container ("set") of full-fledged trees.
class TreeSetUpdater
{
- Tree m_aParentTree;
+ rtl::Reference< Tree > m_aParentTree;
NodeRef m_aSetNode;
- TemplateHolder m_aTemplate;
+ rtl::Reference<Template> m_aTemplate;
public:
- TreeSetUpdater(Tree const& aParentTree, NodeRef const& aSetNode, SetElementInfo const& aInfo);
+ TreeSetUpdater(rtl::Reference< Tree > const& aParentTree, NodeRef const& aSetNode, rtl::Reference< Template > const& aTemplate);
- NodeChange validateInsertElement (Name const& aName, ElementTree const& aNewElement);
+ NodeChange validateInsertElement (rtl::OUString const& aName, rtl::Reference< ElementTree > const& aNewElement);
- NodeChange validateReplaceElement(ElementRef const& aElement, ElementTree const& aNewElement);
+ NodeChange validateReplaceElement(rtl::Reference< ElementTree > const& aElement, rtl::Reference< ElementTree > const& aNewElement);
- NodeChange validateRemoveElement (ElementRef const& aElement);
+ NodeChange validateRemoveElement (rtl::Reference< ElementTree > const& aElement);
private:
void implValidateSet();
- Path::Component implValidateElement(ElementRef const& aElement, bool bReqRemovable);
- void implValidateTree(ElementTree const& aElementTree);
+ Path::Component implValidateElement(rtl::Reference< ElementTree > const& aElement, bool bReqRemovable);
+ void implValidateTree(rtl::Reference< ElementTree > const& aElementTree);
};
//-----------------------------------------------------------------------------
/// allows to insert,remove and replace an element of a <type>Node</type> that is a Container ("set") of simple values.
class ValueSetUpdater
{
- Tree m_aParentTree;
+ rtl::Reference< Tree > m_aParentTree;
NodeRef m_aSetNode;
- TemplateHolder m_aTemplate;
- UnoTypeConverter m_xTypeConverter;
+ rtl::Reference<Template> m_aTemplate;
+ com::sun::star::uno::Reference<com::sun::star::script::XTypeConverter> m_xTypeConverter;
public:
- ValueSetUpdater(Tree const& aParentTree, NodeRef const& aSetNode,
- SetElementInfo const& aInfo, UnoTypeConverter const& xConverter);
+ ValueSetUpdater(rtl::Reference< Tree > const& aParentTree, NodeRef const& aSetNode,
+ rtl::Reference< Template > const& aTemplate, com::sun::star::uno::Reference<com::sun::star::script::XTypeConverter> const& xConverter);
- NodeChange validateInsertElement (Name const& aName, UnoAny const& aNewValue);
+ NodeChange validateInsertElement (rtl::OUString const& aName, com::sun::star::uno::Any const& aNewValue);
- NodeChange validateReplaceElement(ElementRef const& aElement, UnoAny const& aNewValue);
+ NodeChange validateReplaceElement(rtl::Reference< ElementTree > const& aElement, com::sun::star::uno::Any const& aNewValue);
- NodeChange validateRemoveElement (ElementRef const& aElement);
+ NodeChange validateRemoveElement (rtl::Reference< ElementTree > const& aElement);
private:
- typedef Tree ElementNodeRef;
void implValidateSet();
- Path::Component implValidateElement(ElementRef const& aElement, bool bReqRemovable);
- UnoAny implValidateValue(ElementNodeRef const& aElementTree, UnoAny const& aValue);
- UnoAny implValidateValue(UnoAny const& aValue);
+ Path::Component implValidateElement(rtl::Reference< ElementTree > const& aElement, bool bReqRemovable);
+ com::sun::star::uno::Any implValidateValue(rtl::Reference< Tree > const& aElementTree, com::sun::star::uno::Any const& aValue);
+ com::sun::star::uno::Any implValidateValue(com::sun::star::uno::Any const& aValue);
- ElementTreeHolder makeValueElement(Name const& aName, ElementNodeRef const& aElementTree, UnoAny const& aValue, bool bInserting);
- ElementTreeHolder makeValueElement(Name const& aName, UnoAny const& aValue, bool bInserting);
- ElementNodeRef extractElementNode(ElementRef const& aElement);
+ rtl::Reference<ElementTree> makeValueElement(rtl::OUString const& aName, rtl::Reference< Tree > const& aElementTree, com::sun::star::uno::Any const& aValue, bool bInserting);
+ rtl::Reference<ElementTree> makeValueElement(rtl::OUString const& aName, com::sun::star::uno::Any const& aValue, bool bInserting);
+ rtl::Reference< Tree > extractElementNode(rtl::Reference< ElementTree > const& aElement);
};
//-----------------------------------------------------------------------------
/// allows to restore to its default state a <type>Node</type> that is a Container ("set") of full-fledged trees.
class SetDefaulter
{
- Tree m_aParentTree;
+ rtl::Reference< Tree > m_aParentTree;
NodeRef m_aSetNode;
DefaultProvider m_aDefaultProvider;
public:
- SetDefaulter(Tree const& aParentTree, NodeRef const& aSetNode, DefaultProvider const& aDefaultProvider);
+ SetDefaulter(rtl::Reference< Tree > const& aParentTree, NodeRef const& aSetNode, DefaultProvider const& aDefaultProvider);
NodeChange validateSetToDefaultState();
diff --git a/configmgr/source/inc/confsvccomponent.hxx b/configmgr/source/inc/confsvccomponent.hxx
index 5a25997ade..237f3a6f1f 100644
--- a/configmgr/source/inc/confsvccomponent.hxx
+++ b/configmgr/source/inc/confsvccomponent.hxx
@@ -48,14 +48,10 @@ namespace configmgr
namespace css = ::com::sun::star;
namespace uno = css::uno;
namespace lang = css::lang;
- using ::rtl::OUString;
-
-//----------------------------------------------------------------------------
- typedef ::cppu::WeakComponentImplHelper1< lang::XServiceInfo > ServiceImplBase;
//----------------------------------------------------------------------------
class ServiceComponentImpl
- : public ServiceImplBase
+ : public ::cppu::WeakComponentImplHelper1< lang::XServiceInfo >
{
protected:
ServiceImplementationInfo const*const m_info;
@@ -67,17 +63,17 @@ namespace configmgr
//virtual uno::Sequence<uno::Type> SAL_CALL getTypes( ) throw(uno::RuntimeException) = 0;
// XServiceInfo
- virtual OUString SAL_CALL getImplementationName( ) throw(uno::RuntimeException);
+ virtual rtl::OUString SAL_CALL getImplementationName( ) throw(uno::RuntimeException);
virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(uno::RuntimeException);
- virtual uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) throw(uno::RuntimeException);
+ virtual uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw(uno::RuntimeException);
// Component Helper - force override
virtual void SAL_CALL disposing() = 0;
// Component Helper - check object state
virtual void checkAlive() throw (uno::RuntimeException);
void checkAlive(char const* message) throw (uno::RuntimeException)
- { checkAlive( OUString::createFromAscii(message) ); }
- void checkAlive(OUString const& message) throw (uno::RuntimeException);
+ { checkAlive( rtl::OUString::createFromAscii(message) ); }
+ void checkAlive(rtl::OUString const& message) throw (uno::RuntimeException);
// Extra helpers
static uno::Sequence<sal_Int8> getStaticImplementationId(ServiceImplementationInfo const* pServiceInfo) throw(uno::RuntimeException);
diff --git a/configmgr/source/inc/datalock.hxx b/configmgr/source/inc/datalock.hxx
index 7199f63638..b86166139f 100644
--- a/configmgr/source/inc/datalock.hxx
+++ b/configmgr/source/inc/datalock.hxx
@@ -31,7 +31,11 @@
#ifndef CONFIGMGR_DATALOCK_HXX_
#define CONFIGMGR_DATALOCK_HXX_
-#include <osl/mutex.hxx>
+#include "sal/config.h"
+
+#include "osl/interlck.h"
+#include "osl/mutex.hxx"
+
namespace configmgr {
class UnoApiLock
@@ -64,6 +68,4 @@ namespace configmgr {
};
}
-using configmgr::UnoApiLock;
-
#endif // CONFIGMGR_DATALOCK_HXX_
diff --git a/configmgr/source/inc/defaultprovider.hxx b/configmgr/source/inc/defaultprovider.hxx
index 18c55e8c3d..8137b2ffe3 100644
--- a/configmgr/source/inc/defaultprovider.hxx
+++ b/configmgr/source/inc/defaultprovider.hxx
@@ -31,62 +31,25 @@
#ifndef CONFIGMGR_DEFAULTPROVIDER_HXX
#define CONFIGMGR_DEFAULTPROVIDER_HXX
-#include "valuenode.hxx"
-#include "utility.hxx"
-#include <com/sun/star/uno/Exception.hpp>
-#include <com/sun/star/uno/RuntimeException.hpp>
+#include "sal/config.h"
-#ifndef INCLUDED_MEMORY
-#include <memory>
-#define INCLUDED_MEMORY
-#endif
+#include "com/sun/star/uno/Exception.hpp"
+#include "sal/types.h"
+#include "utility.hxx"
namespace configmgr
{
-
- namespace uno = com::sun::star::uno;
- using ::rtl::OUString;
-
-////////////////////////////////////////////////////////////////////////////////
namespace configuration
{
class AbsolutePath;
}
//-------------------------
- class ISubtree;
class RequestOptions;
//==========================================================================
- //= IDefaultProvider
- //==========================================================================
- /* is an interface that can be implemented by an <type>ITreeProvider</type>
- or <type>ITreeManager</type>.
- <p>Supports functionality to fetch only the default data corresponding to a tree</p>
- */
- class SAL_NO_VTABLE IDefaultProvider
- {
- public:
- /** load the default version of the tree named by a path
- using certain options and requiring a specific loading depth
- @returns
- the default data tree, yielding ownership of it
- <NULL/>if no default data is available for the tree
- */
- virtual std::auto_ptr<ISubtree> requestDefaultData( configuration::AbsolutePath const& aSubtreePath,
- const RequestOptions& _aOptions
- ) CFG_UNO_THROW_ALL( ) = 0;
- };
-
- //==========================================================================
- /// a refcounted <type>IDefaultProvider</type>.
- class SAL_NO_VTABLE IConfigDefaultProvider : public Refcounted
- , public IDefaultProvider
- {
- };
- //==========================================================================
//= IDefaultableTreeManager
//==========================================================================
- /* is a supplementary interface for a <type>ITreeManager</type>.
+ /* is a supplementary interface for an <type>OProviderImpl</type>.
<p>Supports functionality to load default data into the managed tree</p>
*/
class SAL_NO_VTABLE IDefaultableTreeManager
@@ -101,7 +64,7 @@ namespace configmgr
*/
virtual sal_Bool fetchDefaultData(configuration::AbsolutePath const& aSubtreePath,
const RequestOptions& _xOptions
- ) CFG_UNO_THROW_ALL( ) = 0;
+ ) SAL_THROW((com::sun::star::uno::Exception)) = 0;
};
diff --git a/configmgr/source/inc/filehelper.hxx b/configmgr/source/inc/filehelper.hxx
index c961c87bbb..30677ed511 100644
--- a/configmgr/source/inc/filehelper.hxx
+++ b/configmgr/source/inc/filehelper.hxx
@@ -96,7 +96,7 @@ namespace configmgr
/** replaces a file specified by _aToURL with a file specified by _aFromURL.
*/
- void replaceFile(const rtl::OUString& _aToURL, const rtl::OUString &_aFromURL) CFG_THROW1(io::IOException);
+ void replaceFile(const rtl::OUString& _aToURL, const rtl::OUString &_aFromURL) SAL_THROW((io::IOException));
/** removes a file specified by _aURL. Ignores the case of a non-existing file.
*/
diff --git a/configmgr/source/inc/flags.hxx b/configmgr/source/inc/flags.hxx
index ab4ca21df0..1f39166d30 100644
--- a/configmgr/source/inc/flags.hxx
+++ b/configmgr/source/inc/flags.hxx
@@ -87,7 +87,6 @@ namespace configmgr
flag_innernode = 0x02 << nodetype_shift_, // 0x80
flag_setnode = 0x01 << nodetype_shift_ // 0x40
};
- typedef sal_uInt8 Field;
}
//-----------------------------------------------------------------------------
@@ -108,7 +107,6 @@ namespace configmgr
defaulted = 0x40, // somewhat redundant with State
defaultable = 0x80 // redundant with State (merged || defaulted)
};
- typedef sal_uInt8 Field;
}
//-----------------------------------------------------------------------------
// set element or tree state
@@ -129,7 +127,6 @@ namespace configmgr
flag_default_avail = 0x40, // marks this element as containing default values
flag_removable = 0x80 // marks this element as removable
};
- typedef sal_uInt8 Field;
}
//-----------------------------------------------------------------------------
}
diff --git a/configmgr/source/inc/groupnodeaccess.hxx b/configmgr/source/inc/groupnodeaccess.hxx
deleted file mode 100644
index 28bb7e3a3f..0000000000
--- a/configmgr/source/inc/groupnodeaccess.hxx
+++ /dev/null
@@ -1,111 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: groupnodeaccess.hxx,v $
- * $Revision: 1.9 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef CONFIGMGR_GROUPNODEACCESS_HXX
-#define CONFIGMGR_GROUPNODEACCESS_HXX
-
-#include "nodeaccess.hxx"
-
-namespace configmgr
-{
-// -----------------------------------------------------------------------------
- namespace data
- {
- // -------------------------------------------------------------------------
- class GroupNodeAccess
- {
- public:
- GroupNodeAccess(const sharable::GroupNode *_pNodeRef)
- : m_pData((GroupNodeAddress)_pNodeRef)
- {}
-
- explicit
- GroupNodeAccess(NodeAccess const & _aNode)
- : m_pData(check(_aNode))
- {}
-
- ~GroupNodeAccess() {}
-
- static bool isInstance(NodeAccess const & _aNode)
- { return check(_aNode) != NULL; }
-
- bool isValid() const { return m_pData != NULL; }
-
- configuration::Name getName() const;
- node::Attributes getAttributes() const;
-
- bool isDefault() const;
-
- bool hasChild(configuration::Name const& _aName) const
- { return implGetChild(_aName) != NULL; }
-
- bool hasChildren() const
- { return m_pData->numDescendants > 0 ? true : false; }
-
- NodeAccess getChildNode(configuration::Name const& _aName) const
- { return NodeAccess(implGetChild(_aName)); }
-
- operator NodeAccess() const { return NodeAccess(NodeAddress(m_pData)); }
-
- sharable::GroupNode& data() const { return *m_pData; }
- operator GroupNodeAddress () const { return (GroupNodeAddress)m_pData; }
-
- private:
- NodeAddress implGetChild(configuration::Name const& _aName) const;
- static GroupNodeAddress check(sharable::Node *pNode)
- { return pNode ? const_cast<GroupNodeAddress>(pNode->groupData()) : NULL; }
- static GroupNodeAddress check(NodeAccess const&aRef)
- { return check(static_cast<sharable::Node *>(aRef)); }
-
- GroupNodeAddress m_pData;
- };
-#if OSL_DEBUG_LEVEL > 0
- GroupNodeAddress toGroupNodeAddress(NodeAddress const & _aNodeAddr);
-#endif
- // -------------------------------------------------------------------------
- inline
- configuration::Name GroupNodeAccess::getName() const
- { return NodeAccess::wrapName( data().info.getName() ); }
-
- inline
- node::Attributes GroupNodeAccess::getAttributes() const
- { return sharable::node(data()).getAttributes(); }
-
- inline
- bool GroupNodeAccess::isDefault() const
- { return data().info.isDefault(); }
-
- // -------------------------------------------------------------------------
- }
-// -----------------------------------------------------------------------------
-} // namespace configmgr
-
-#endif // CONFIGMGR_GROUPNODEACCESS_HXX
-
diff --git a/configmgr/source/inc/interactionrequest.hxx b/configmgr/source/inc/interactionrequest.hxx
index 880ab4fb50..46fa906260 100644
--- a/configmgr/source/inc/interactionrequest.hxx
+++ b/configmgr/source/inc/interactionrequest.hxx
@@ -159,12 +159,6 @@ void SAL_CALL InteractionContinuation< XThisContinuation >::select()
}
//============================================================================
-typedef InteractionContinuation< task::XInteractionAbort > InteractionAbort;
-typedef InteractionContinuation< task::XInteractionRetry > InteractionRetry;
-typedef InteractionContinuation< task::XInteractionApprove > InteractionApprove;
-typedef InteractionContinuation< task::XInteractionDisapprove > InteractionDisapprove;
-//============================================================================
-
} // namespace apihelper
} // namespace configmgr
diff --git a/configmgr/source/inc/localizedtreeactions.hxx b/configmgr/source/inc/localizedtreeactions.hxx
index 55c7731df4..94fbb2c067 100644
--- a/configmgr/source/inc/localizedtreeactions.hxx
+++ b/configmgr/source/inc/localizedtreeactions.hxx
@@ -42,9 +42,9 @@ class SubtreeChange;
// Helper function to invoke the previous ones properly
// convert to the given locale format, assuming the original representation was expanded
-data::TreeSegment cloneExpandedForLocale(data::TreeAccessor const & _aTree, OUString const& _sLocale);
+rtl::Reference< data::TreeSegment > cloneExpandedForLocale(sharable::TreeFragment * tree, rtl::OUString const& _sLocale);
// convert to the given locale format, assuming the original representation was expanded
-std::auto_ptr<INode> reduceExpandedForLocale(std::auto_ptr<ISubtree> _pNode, OUString const& _sLocale);
+std::auto_ptr<INode> reduceExpandedForLocale(std::auto_ptr<ISubtree> _pNode, rtl::OUString const& _sLocale);
//..........................................................................
} // namespace configmgr
diff --git a/configmgr/source/inc/logger.hxx b/configmgr/source/inc/logger.hxx
index 2605c5e47e..9eb103ca1d 100644
--- a/configmgr/source/inc/logger.hxx
+++ b/configmgr/source/inc/logger.hxx
@@ -41,7 +41,6 @@ namespace configmgr
namespace uno = com::sun::star::uno;
namespace logging = com::sun::star::util::logging;
namespace LogLevel = logging::LogLevel;
- using rtl::OUString;
/// class providing access to a log output sink in the context
class Logger
@@ -59,49 +58,47 @@ namespace configmgr
: m_xLogger( getUnoLoggerFromContext(xContext) )
{}
- typedef sal_Int32 Level;
-
- Level level() const
+ sal_Int32 level() const
{ return m_xLogger.is() ? m_xLogger->getLevel() : LogLevel::OFF; }
- bool isLogging(Level nLogLevel) const
+ bool isLogging(sal_Int32 nLogLevel) const
{ return m_xLogger.is() && m_xLogger->isLoggable(nLogLevel); }
/// log output to the logger
- void log(Level nLevel, const OUString & msg, const char * sourceMethod = 0, const char * sourceClass = 0) const;
- void log(Level nLevel, const char * msg, const char * sourceMethod = 0, const char * sourceClass = 0) const;
+ void log(sal_Int32 nLevel, const rtl::OUString & msg, const char * sourceMethod = 0, const char * sourceClass = 0) const;
+ void log(sal_Int32 nLevel, const char * msg, const char * sourceMethod = 0, const char * sourceClass = 0) const;
- void error(const OUString & msg, const char * sourceMethod = 0, const char * sourceClass = 0) const
+ void error(const rtl::OUString & msg, const char * sourceMethod = 0, const char * sourceClass = 0) const
{ log( LogLevel::SEVERE, msg, sourceMethod, sourceClass); }
void error(const char * msg, const char * sourceMethod = 0, const char * sourceClass = 0) const
{ log( LogLevel::SEVERE, msg, sourceMethod, sourceClass); }
- void warning(const OUString & msg, const char * sourceMethod = 0, const char * sourceClass = 0) const
+ void warning(const rtl::OUString & msg, const char * sourceMethod = 0, const char * sourceClass = 0) const
{ log( LogLevel::WARNING, msg, sourceMethod, sourceClass); }
void warning(const char * msg, const char * sourceMethod = 0, const char * sourceClass = 0) const
{ log( LogLevel::WARNING, msg, sourceMethod, sourceClass); }
- void info(const OUString & msg, const char * sourceMethod = 0, const char * sourceClass = 0) const
+ void info(const rtl::OUString & msg, const char * sourceMethod = 0, const char * sourceClass = 0) const
{ log( LogLevel::INFO, msg, sourceMethod, sourceClass); }
void info(const char * msg, const char * sourceMethod = 0, const char * sourceClass = 0) const
{ log( LogLevel::INFO, msg, sourceMethod, sourceClass); }
- void config(const OUString & msg, const char * sourceMethod = 0, const char * sourceClass = 0) const
+ void config(const rtl::OUString & msg, const char * sourceMethod = 0, const char * sourceClass = 0) const
{ log( LogLevel::CONFIG, msg, sourceMethod, sourceClass); }
void config(const char * msg, const char * sourceMethod = 0, const char * sourceClass = 0) const
{ log( LogLevel::CONFIG, msg, sourceMethod, sourceClass); }
- void fine(const OUString & msg, const char * sourceMethod = 0, const char * sourceClass = 0) const
+ void fine(const rtl::OUString & msg, const char * sourceMethod = 0, const char * sourceClass = 0) const
{ log( LogLevel::FINE, msg, sourceMethod, sourceClass); }
void fine(const char * msg, const char * sourceMethod = 0, const char * sourceClass = 0) const
{ log( LogLevel::FINE, msg, sourceMethod, sourceClass); }
- void finer(const OUString & msg, const char * sourceMethod = 0, const char * sourceClass = 0) const
+ void finer(const rtl::OUString & msg, const char * sourceMethod = 0, const char * sourceClass = 0) const
{ log( LogLevel::FINER, msg, sourceMethod, sourceClass); }
void finer(const char * msg, const char * sourceMethod = 0, const char * sourceClass = 0) const
{ log( LogLevel::FINER, msg, sourceMethod, sourceClass); }
- void finest(const OUString & msg, const char * sourceMethod = 0, const char * sourceClass = 0) const
+ void finest(const rtl::OUString & msg, const char * sourceMethod = 0, const char * sourceClass = 0) const
{ log( LogLevel::FINEST, msg, sourceMethod, sourceClass); }
void finest(const char * msg, const char * sourceMethod = 0, const char * sourceClass = 0) const
{ log( LogLevel::FINEST, msg, sourceMethod, sourceClass); }
diff --git a/configmgr/source/inc/matchlocale.hxx b/configmgr/source/inc/matchlocale.hxx
index 6d1b942fc7..c6b87c5d3f 100644
--- a/configmgr/source/inc/matchlocale.hxx
+++ b/configmgr/source/inc/matchlocale.hxx
@@ -46,8 +46,6 @@ namespace configmgr
namespace localehelper
{
// -------------------------------------------------------------------------
- using ::rtl::OUString;
- using ::com::sun::star::lang::Locale;
namespace uno = ::com::sun::star::uno;
namespace lang = ::com::sun::star::lang;
@@ -55,40 +53,36 @@ namespace configmgr
extern char const * const c_sAnyLanguage;
extern char const * const c_sDefLanguage;
- extern bool isAnyLanguage(OUString const & _sLanguage);
- extern bool isDefaultLanguage(OUString const & _sLanguage);
+ extern bool isAnyLanguage(rtl::OUString const & _sLanguage);
+ extern bool isDefaultLanguage(rtl::OUString const & _sLanguage);
- extern OUString getAnyLanguage();
- extern OUString getDefaultLanguage();
+ extern rtl::OUString getAnyLanguage();
+ extern rtl::OUString getDefaultLanguage();
- extern Locale getAnyLocale();
- extern Locale getDefaultLocale();
+ extern com::sun::star::lang::Locale getAnyLocale();
+ extern com::sun::star::lang::Locale getDefaultLocale();
// -------------------------------------------------------------------------
- /// Type for storing a list of Locales
- typedef std::vector< Locale > LocaleSequence;
- typedef LocaleSequence::size_type SequencePos;
-
- // the max value of SequencePos - marks out-of-range (Value == -1 == ~0)
- SequencePos const c_noPosition = SequencePos(0)-SequencePos(1);
+ // the max value of std::vector< com::sun::star::lang::Locale >::size_type - marks out-of-range (Value == -1 == ~0)
+ std::vector< com::sun::star::lang::Locale >::size_type const c_noPosition = std::vector< com::sun::star::lang::Locale >::size_type(0)-std::vector< com::sun::star::lang::Locale >::size_type(1);
// conversion helpers
- Locale makeLocale(OUString const& sLocaleName_);
- OUString makeIsoLocale(Locale const& aUnoLocale_);
+ com::sun::star::lang::Locale makeLocale(rtl::OUString const& sLocaleName_);
+ rtl::OUString makeIsoLocale(com::sun::star::lang::Locale const& aUnoLocale_);
- LocaleSequence makeLocaleSequence(uno::Sequence<OUString> const& sLocaleNames_);
- uno::Sequence<OUString> makeIsoSequence(LocaleSequence const& aLocales_);
+ std::vector< com::sun::star::lang::Locale > makeLocaleSequence(uno::Sequence<rtl::OUString> const& sLocaleNames_);
+ uno::Sequence<rtl::OUString> makeIsoSequence(std::vector< com::sun::star::lang::Locale > const& aLocales_);
inline
- bool equalLocale(Locale const & lhs, Locale const & rhs)
+ bool equalLocale(com::sun::star::lang::Locale const & lhs, com::sun::star::lang::Locale const & rhs)
{ return lhs.Language == rhs.Language && lhs.Country == rhs.Country; }
inline
- bool equalLanguage(Locale const & lhs, Locale const & rhs)
+ bool equalLanguage(com::sun::star::lang::Locale const & lhs, com::sun::star::lang::Locale const & rhs)
{ return lhs.Language == rhs.Language; }
// -------------------------------------------------------------------------
- bool designatesAllLocales(Locale const& aLocale_);
- bool designatesAllLocales(LocaleSequence const& aLocales_);
+ bool designatesAllLocales(com::sun::star::lang::Locale const& aLocale_);
+ bool designatesAllLocales(std::vector< com::sun::star::lang::Locale > const& aLocales_);
// -------------------------------------------------------------------------
/// result of matching a locale against a target locale
@@ -102,14 +96,14 @@ namespace configmgr
};
/// compare two locales for 'nearness'
- MatchQuality match(Locale const& aLocale_, Locale const& aTarget_);
+ MatchQuality match(com::sun::star::lang::Locale const& aLocale_, com::sun::star::lang::Locale const& aTarget_);
// -------------------------------------------------------------------------
/// result of matching a Locale against a target sequence of locales
class MatchResult
{
- SequencePos m_nPos;
+ std::vector< com::sun::star::lang::Locale >::size_type m_nPos;
MatchQuality m_eQuality;
public:
@@ -118,7 +112,7 @@ namespace configmgr
{ reset(); }
/// construct a result from given parameters - use with care
- MatchResult(SequencePos nPos_, MatchQuality eQuality_)
+ MatchResult(std::vector< com::sun::star::lang::Locale >::size_type nPos_, MatchQuality eQuality_)
: m_nPos( nPos_ )
, m_eQuality(eQuality_)
{}
@@ -132,12 +126,12 @@ namespace configmgr
bool isBest() const { return m_nPos == 0 && m_eQuality == MATCH_LOCALE; }
/// retrieve the position that was matched
- SequencePos position() const { return m_nPos; }
+ std::vector< com::sun::star::lang::Locale >::size_type position() const { return m_nPos; }
/// retrieve the quality of match
MatchQuality quality() const { return m_eQuality; }
/// assign the given position and quality, if they are an improvement
- bool improve(SequencePos nPos, MatchQuality eQuality_);
+ bool improve(std::vector< com::sun::star::lang::Locale >::size_type nPos, MatchQuality eQuality_);
/// reset to no match or best match state
void reset()
@@ -177,21 +171,21 @@ namespace configmgr
{ return !(lhs < rhs); }
/// improve an existing match of a locale against a sequence of locales
- bool improveMatch(MatchResult& rMatch_, Locale const& aLocale_, LocaleSequence const& aTarget_);
+ bool improveMatch(MatchResult& rMatch_, com::sun::star::lang::Locale const& aLocale_, std::vector< com::sun::star::lang::Locale > const& aTarget_);
/// match a locale against a sequence of locales for a given quality level
- bool isMatch(Locale const& aLocales, LocaleSequence const& aTarget_, MatchQuality eRequiredQuality_);
+ bool isMatch(com::sun::star::lang::Locale const& aLocales, std::vector< com::sun::star::lang::Locale > const& aTarget_, MatchQuality eRequiredQuality_);
// -------------------------------------------------------------------------
/// add defaults to a sequence of locales
- void addFallbackLocales(LocaleSequence& aTargetList_);
+ void addFallbackLocales(std::vector< com::sun::star::lang::Locale >& aTargetList_);
// -------------------------------------------------------------------------
class FindBestLocale
{
public:
/// construct a MatchLocale with a single target locale
- FindBestLocale(Locale const& aTarget_);
+ FindBestLocale(com::sun::star::lang::Locale const& aTarget_);
/// is there any match ?
bool isMatch() const { return m_aResult.isMatch(); }
@@ -203,15 +197,15 @@ namespace configmgr
MatchQuality getMatchQuality() const { return m_aResult.quality(); }
/// check, if the given locale improves the quality. if it does, accept it
- bool accept(Locale const& aLocale_);
+ bool accept(com::sun::star::lang::Locale const& aLocale_);
/// reset the match result, indicating whether a match is needed at all
void reset(bool bNeedLocale_ = true);
private:
- void implSetTarget(LocaleSequence const& aTarget_);
+ void implSetTarget(std::vector< com::sun::star::lang::Locale > const& aTarget_);
- LocaleSequence m_aTarget;
+ std::vector< com::sun::star::lang::Locale > m_aTarget;
MatchResult m_aResult;
};
diff --git a/configmgr/source/inc/mergeddataprovider.hxx b/configmgr/source/inc/mergeddataprovider.hxx
index 6443072d08..e8378a85e1 100644
--- a/configmgr/source/inc/mergeddataprovider.hxx
+++ b/configmgr/source/inc/mergeddataprovider.hxx
@@ -31,6 +31,10 @@
#ifndef CONFIGMGR_BACKEND_MERGEDDATAPROVIDER_HXX
#define CONFIGMGR_BACKEND_MERGEDDATAPROVIDER_HXX
+#include "sal/config.h"
+
+#include "salhelper/simplereferenceobject.hxx"
+
#include "request.hxx"
#include "requesttypes.hxx"
#include "utility.hxx"
@@ -44,40 +48,15 @@ namespace configmgr
/** Listener interface for receiving notifications
about changes to previously requested data
*/
- struct SAL_NO_VTABLE INodeDataListener : Refcounted
+ struct SAL_NO_VTABLE INodeDataListener
{
/** is called to indicate changes within the data being observed.
@param _aOriginalRequest
identifies the data that changed
*/
- virtual void dataChanged(ComponentRequest const & _aOriginalRequest) CFG_NOTHROW() = 0;
- };
-// ---------------------------------------------------------------------------
- /// Interface providing access to (merged) data for whole components
- struct SAL_NO_VTABLE IComponentDataProvider
- {
- /** loads merged data for a (complete) tree and returns it as return value.
-
- @param _aRequest
- identifies the component to be loaded
-
- @param __bAddListenter
- identifies is listener is to be registered to backend
-
- @returns
- A valid component instance for the given component.
-
- @throws com::sun::star::uno::Exception
- if the node cannot be retrieved.
- The exact exception being thrown may depend on the underlying backend.
-
- */
- virtual ComponentResult getComponentData(ComponentRequest const & _aRequest,
- bool _bAddListenter)
- CFG_UNO_THROW_ALL() = 0;
+ virtual void dataChanged(ComponentRequest const & _aOriginalRequest) SAL_THROW(()) = 0;
};
-
// ---------------------------------------------------------------------------
/// Interface providing access to template (schema) data
@@ -100,19 +79,21 @@ namespace configmgr
if the template cannot be retrieved.
The exact exception being thrown may depend on the underlying backend.
*/
- virtual TemplateResult getTemplateData(TemplateRequest const & _aRequest)
- CFG_UNO_THROW_ALL() = 0;
+ virtual ResultHolder< TemplateInstance > getTemplateData(TemplateRequest const & _aRequest)
+ SAL_THROW((com::sun::star::uno::Exception)) = 0;
};
// ---------------------------------------------------------------------------
- /** Interface providing access to (merged) data for individual nodes
- with optional notification about subsequent changes.
+ /** Composite interface providing full access to merged configuration data
+ from some data store.
- There is no guarantee, that all changes are notified immediately
- (or even at all).If the provider cannot detect changes
- it may simply ignore a supplied listener.
- */
- struct SAL_NO_VTABLE INodeDataProvider
+ <p> Loading and updating of data is supported.
+ Support for notification depends on the backend.
+ </p>
+ */
+ struct IMergedDataProvider
+ : salhelper::SimpleReferenceObject
+ , ITemplateDataProvider
{
/** loads merged data for a (partial) tree and returns it as return value.
@@ -126,7 +107,7 @@ namespace configmgr
<p> Otherwise the listener will be notified of changes.
The listener must subsequently be removed by calling
- <member>INodeDataProvider::removeRequestListener</member>.
+ <member>removeRequestListener</member>.
The listener must live at least until it is removed.
</p>
@@ -137,10 +118,10 @@ namespace configmgr
if the node cannot be retrieved.
The exact exception being thrown may depend on the underlying backend.
*/
- virtual ComponentResult getNodeData(ComponentRequest const & _aRequest,
+ virtual ResultHolder< ComponentInstance > getNodeData(ComponentRequest const & _aRequest,
ITemplateDataProvider* _aTemplateProvider,
INodeDataListener * _pListener = NULL)
- CFG_UNO_THROW_ALL() = 0;
+ SAL_THROW((com::sun::star::uno::Exception)) = 0;
/** remove a listener registered for a previous request.
<p>This may also release some open resources for the request.</p>
@@ -152,13 +133,8 @@ namespace configmgr
identifies the component associated with the listener
*/
virtual void removeRequestListener(INodeDataListener * _pListener,
- const ComponentRequest& aRequest) CFG_NOTHROW() = 0;
- };
-// ---------------------------------------------------------------------------
+ const ComponentRequest& aRequest) SAL_THROW(()) = 0;
- /// Interface providing the capability to update node data
- struct SAL_NO_VTABLE INodeUpdateProvider
- {
/** applies an update to the stored data.
@param _anUpdate
@@ -170,13 +146,8 @@ namespace configmgr
The exact exception being thrown may depend on the underlying backend.
*/
virtual void updateNodeData(UpdateRequest const & _anUpdate)
- CFG_UNO_THROW_ALL() = 0;
- };
-// ---------------------------------------------------------------------------
+ SAL_THROW((com::sun::star::uno::Exception)) = 0;
- /// Interface providing access to (merged) default data
- struct SAL_NO_VTABLE IDefaultDataProvider
- {
/** loads default data for a (partial) tree and returns it as return value
@param _aRequest
@@ -191,55 +162,8 @@ namespace configmgr
if the default cannot be retrieved.
The exact exception being thrown may depend on the underlying backend.
*/
- virtual NodeResult getDefaultData(NodeRequest const & _aRequest)
- CFG_UNO_THROW_ALL() = 0;
- };
-
-// ---------------------------------------------------------------------------
-
- /// Interface providing access to backend meta-data
- struct SAL_NO_VTABLE IDataProviderMetaData
- {
- /** Queries whether default property values are stripped from
- a merged result tree or whether they are returned inline.
-
- @returns
- <TRUE/> if default data is stripped from a merged node result, <BR/>
- <FALSE/> if default data is left in the merged node result
- */
- virtual bool isStrippingDefaults() CFG_NOTHROW() = 0;
- };
-// ---------------------------------------------------------------------------
-
- /** Composite interface providing simple direct access to (merged) configuration data
- from some data store.
-
- <p> Only loading data is supported (no updates or notifications). </p>
- */
- struct IDirectDataProvider
- : Refcounted
- , IComponentDataProvider
- , IDefaultDataProvider
- , ITemplateDataProvider
- {
- };
-// ---------------------------------------------------------------------------
-
- /** Composite interface providing full access to merged configuration data
- from some data store.
-
- <p> Loading and updating of data is supported.
- Support for notification depends on the backend.
- </p>
- */
- struct IMergedDataProvider
- : Refcounted
- , INodeDataProvider
- , INodeUpdateProvider
- , IDefaultDataProvider
- , ITemplateDataProvider
- , IDataProviderMetaData
- {
+ virtual ResultHolder< NodeInstance > getDefaultData(NodeRequest const & _aRequest)
+ SAL_THROW((com::sun::star::uno::Exception)) = 0;
};
// ---------------------------------------------------------------------------
diff --git a/configmgr/source/inc/namecreator.hxx b/configmgr/source/inc/namecreator.hxx
index f740b4b32a..e33e64b02e 100644
--- a/configmgr/source/inc/namecreator.hxx
+++ b/configmgr/source/inc/namecreator.hxx
@@ -39,37 +39,27 @@ namespace configmgr
class Change;
class SubtreeChange;
// -----------------------------------------------------------------------------
- using configuration::Name;
- using configuration::AbsolutePath;
- using configuration::RelativePath;
- // -----------------------------------------------------------------------------
class ONameCreator
{
public:
- typedef configuration::Path::Component FullName;
- typedef configuration::Path::Rep PathRep;
- typedef std::vector< FullName > NameList;
- public:
ONameCreator() {}
- void pushName(const FullName &_aName) { m_aNameList.push_back(_aName); }
+ void pushName(const configuration::Path::Component &_aName) { m_aNameList.push_back(_aName); }
void popName() { m_aNameList.pop_back(); }
void clear() { m_aNameList.clear(); }
- static FullName createName(Change const& _rChange, SubtreeChange const* _pParent);
+ static configuration::Path::Component createName(Change const& _rChange, SubtreeChange const* _pParent);
private:
- NameList m_aNameList;
+ std::vector< configuration::Path::Component > m_aNameList;
};
template <class PathClass>
class OPathCreator : public ONameCreator
{
public:
- typedef PathClass PathType;
- public:
- OPathCreator() : m_aBasePath( PathRep() ) {}
+ OPathCreator() : m_aBasePath( configuration::Path::Rep() ) {}
OPathCreator(PathClass const & _aBasePath) : m_aBasePath(_aBasePath) {}
void init(PathClass const & _aBasePath)
diff --git a/configmgr/source/inc/node.hxx b/configmgr/source/inc/node.hxx
index b37b705a4b..92d7494c5c 100644
--- a/configmgr/source/inc/node.hxx
+++ b/configmgr/source/inc/node.hxx
@@ -31,34 +31,27 @@
#ifndef INCLUDED_SHARABLE_NODE_HXX
#define INCLUDED_SHARABLE_NODE_HXX
-#include "types.hxx"
+#include "rtl/ustring.hxx"
+
#include "flags.hxx"
#include "anydata.hxx"
namespace configmgr
{
//-----------------------------------------------------------------------------
- namespace uno = ::com::sun::star::uno;
-//-----------------------------------------------------------------------------
namespace node { struct Attributes; }
//-----------------------------------------------------------------------------
namespace sharable
{
- //-----------------------------------------------------------------------------
-
- namespace Type = data::Type;
- namespace Flags = data::Flags;
-
- //-----------------------------------------------------------------------------
struct TreeFragment;
union Node;
//-----------------------------------------------------------------------------
struct NodeInfo
{
- Name name;
- Offset parent; // always counts backwards
- Flags::Field flags;
- Type ::Field type; // contains discriminator for union
+ rtl_uString * name;
+ sal_uInt16 parent; // always counts backwards
+ sal_uInt8 flags;
+ sal_uInt8 type; // contains discriminator for union
rtl::OUString getName() const;
node::Attributes getNodeInfoAttributes() const;
@@ -68,49 +61,47 @@ namespace configmgr
void markAsDefault(bool bDefault = true);
};
//-----------------------------------------------------------------------------
- struct BasicNode // common initial sequence of union Node members
- {
- NodeInfo info;
- };
- //-----------------------------------------------------------------------------
struct GroupNode
{
NodeInfo info;
- Offset numDescendants; // = number of descendants
+ sal_uInt16 numDescendants; // = number of descendants
bool hasDefaultsAvailable() const;
- Node * getFirstChild();
- Node * getNextChild(Node * _pChild);
- Node const * getFirstChild() const;
- Node const * getNextChild(Node const * _pChild) const;
+ Node * getFirstChild() const;
+ Node * getNextChild(Node * child) const;
+ Node * getChild(rtl::OUString const & name) const;
+ static inline GroupNode * from(Node * node);
};
//-----------------------------------------------------------------------------
- typedef sal_uInt8 * SetElementAddress;
struct SetNode
{
NodeInfo info;
- SetElementAddress elementType; // points to template [MM:SetNode *?]
- List elements; // points to first element (TreeFragmentHeader)
-
- bool isLocalizedValue() const;
+ sal_uInt8 * elementType; // points to template [MM:SetNode *?]
+ TreeFragment * elements; // points to first element (TreeFragmentHeader)
rtl::OUString getElementTemplateName() const;
rtl::OUString getElementTemplateModule() const;
- TreeFragment const * getFirstElement() const;
- TreeFragment const * getNextElement(TreeFragment const * _pElement) const;
+ TreeFragment * getFirstElement() const;
+ TreeFragment * getNextElement(TreeFragment * _pElement) const;
+ TreeFragment * getElement(rtl::OUString const & name) const;
+
+ void addElement(TreeFragment * newElement);
+ TreeFragment * removeElement(rtl::OUString const & name);
+
+ static inline SetNode * from(Node * node);
// low-level helper for template data abstraction
static
- SetElementAddress allocTemplateData(const rtl::OUString &rName,
+ sal_uInt8 * allocTemplateData(const rtl::OUString &rName,
const rtl::OUString &rModule);
static
- SetElementAddress copyTemplateData(SetElementAddress _aTemplateData);
+ sal_uInt8 * copyTemplateData(sal_uInt8 * _aTemplateData);
static
- void releaseTemplateData(SetElementAddress _aTemplateData);
+ void releaseTemplateData(sal_uInt8 * _aTemplateData);
};
//-----------------------------------------------------------------------------
struct ValueNode
@@ -122,10 +113,20 @@ namespace configmgr
bool isNull() const;
bool hasUsableDefault() const;
- uno::Any getValue() const;
- uno::Type getValueType() const;
- uno::Any getUserValue() const;
- uno::Any getDefaultValue() const;
+ com::sun::star::uno::Any getValue() const;
+ com::sun::star::uno::Type getValueType() const;
+ com::sun::star::uno::Any getUserValue() const;
+ com::sun::star::uno::Any getDefaultValue() const;
+
+ void setValue(com::sun::star::uno::Any const & newValue);
+ void setToDefault();
+ void changeDefault(com::sun::star::uno::Any const & newDefault);
+
+ static inline ValueNode * from(Node * node);
+
+ private:
+ void releaseValue();
+ sal_uInt8 adaptType(com::sun::star::uno::Any const & newValue);
};
//-----------------------------------------------------------------------------
// TODO: optimized representation of localized values (now as set; mapping locale->element-name)
@@ -133,7 +134,7 @@ namespace configmgr
//-----------------------------------------------------------------------------
union Node
{
- BasicNode node;
+ NodeInfo info;
GroupNode group;
SetNode set;
ValueNode value;
@@ -145,9 +146,9 @@ namespace configmgr
bool isDefault() const;
// type checks
- bool isGroup() const { return typeIs (Type::nodetype_group); }
- bool isSet() const { return typeIs (Type::nodetype_set); }
- bool isValue() const { return typeIs (Type::nodetype_value); }
+ bool isGroup() const { return typeIs (data::Type::nodetype_group); }
+ bool isSet() const { return typeIs (data::Type::nodetype_set); }
+ bool isValue() const { return typeIs (data::Type::nodetype_value); }
// checked access
inline GroupNode * groupData();
@@ -165,12 +166,24 @@ namespace configmgr
#endif
TreeFragment * getTreeFragment();
TreeFragment const * getTreeFragment() const;
- private:
- bool typeIs(Type::Type eType) const
- { return (node.info.type & Type::mask_nodetype) == eType; }
+
+ Node * getSubnode(rtl::OUString const & name);
+
+ private:
+ bool typeIs(data::Type::Type eType) const
+ { return (info.type & data::Type::mask_nodetype) == eType; }
};
//-----------------------------------------------------------------------------
+ inline GroupNode * GroupNode::from(Node * node)
+ { return node == 0 ? 0 : node->groupData(); }
+
+ inline SetNode * SetNode::from(Node * node)
+ { return node == 0 ? 0 : node->setData(); }
+
+ inline ValueNode * ValueNode::from(Node * node)
+ { return node == 0 ? 0 : node->valueData(); }
+
inline GroupNode * Node::groupData()
{ return isGroup() ? &this->group : NULL; }
inline GroupNode const * Node::groupData() const
@@ -213,13 +226,6 @@ namespace configmgr
{ return reinterpret_cast<Node const&>(pNode); }
//-----------------------------------------------------------------------------
}
-
- namespace data {
- typedef sharable::Node * NodeAddress;
- typedef sharable::ValueNode * ValueNodeAddress;
- typedef sharable::GroupNode * GroupNodeAddress;
- typedef sharable::SetNode * SetNodeAddress;
- }
//-----------------------------------------------------------------------------
}
diff --git a/configmgr/source/inc/nodeaccess.hxx b/configmgr/source/inc/nodeaccess.hxx
deleted file mode 100644
index a6fb68b0f4..0000000000
--- a/configmgr/source/inc/nodeaccess.hxx
+++ /dev/null
@@ -1,77 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: nodeaccess.hxx,v $
- * $Revision: 1.8 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef CONFIGMGR_NODEACCESS_HXX
-#define CONFIGMGR_NODEACCESS_HXX
-
-#include "node.hxx"
-#include "valuenode.hxx"
-#include "configpath.hxx"
-
-namespace configmgr
-{
-// -----------------------------------------------------------------------------
- namespace data
- {
- // -------------------------------------------------------------------------
- class NodeAccess
- {
- public:
- NodeAccess(const sharable::Node *_pNode)
- : m_pData((sharable::Node *)_pNode) {}
-
- bool isValid() const { return m_pData != NULL; }
-
- configuration::Name getName() const { return wrapName( m_pData->getName() ); }
- static configuration::Name wrapName(rtl::OUString const& _aNameString)
- { return configuration::makeName( _aNameString, configuration::Name::NoValidate() ); }
-
- // make it look like a pointer ...
- operator sharable::Node *() const { return (sharable::Node *)m_pData; }
- operator const sharable::Node * () const { return m_pData; }
- sharable::Node* operator->() const { return (sharable::Node *)m_pData; }
- bool operator == (const sharable::Node *pData) const { return pData == m_pData; }
- bool operator != (const sharable::Node *pData) const { return pData != m_pData; }
-
- private:
- const sharable::Node * m_pData;
- };
-
- // -------------------------------------------------------------------------
- // helper - finds child or element
- NodeAccess getSubnode(NodeAccess const & _aNode, configuration::Name const & _aName);
- NodeAddress getSubnodeAddress(NodeAddress const & _aNodeAddress, configuration::Name const & _aName);
- // -------------------------------------------------------------------------
- }
-// -----------------------------------------------------------------------------
-} // namespace configmgr
-
-#endif // CONFIGMGR_NODEACCESS_HXX
-
diff --git a/configmgr/source/inc/nodechange.hxx b/configmgr/source/inc/nodechange.hxx
index 8366f7f7fd..6024cbf986 100644
--- a/configmgr/source/inc/nodechange.hxx
+++ b/configmgr/source/inc/nodechange.hxx
@@ -31,6 +31,8 @@
#ifndef CONFIGMGR_CONFIGCHANGE_HXX_
#define CONFIGMGR_CONFIGCHANGE_HXX_
+#include "rtl/ref.hxx"
+
#include "configexcept.hxx"
#include <vector>
@@ -40,7 +42,6 @@ namespace configmgr
namespace configuration
{
//-----------------------------------------------------------------------------
- class Name;
class AbsolutePath;
class RelativePath;
class NodeRef;
@@ -49,10 +50,6 @@ namespace configmgr
class Tree;
//-----------------------------------------------------------------------------
- typedef com::sun::star::uno::Type UnoType;
- typedef com::sun::star::uno::Any UnoAny;
-//-----------------------------------------------------------------------------
-
class NodeChange;
class NodeChangeImpl;
class NodeChangeLocation;
@@ -95,12 +92,12 @@ namespace configmgr
NodeChange const& apply() const;
// retrieve the tree where the change is actually taking place
- Tree getBaseTree() const;
+ rtl::Reference< Tree > getBaseTree() const;
// retrieve the node where the change is actually taking place
NodeRef getBaseNode() const;
// retrieve the tree where the change is actually taking place
- Tree getAffectedTree() const;
+ rtl::Reference< Tree > getAffectedTree() const;
// retrieve the node where the change is actually taking place
NodeRef getAffectedNode() const;
// identify the node where the change is actually taking place
@@ -127,10 +124,6 @@ namespace configmgr
*/
class NodeChanges
{
- typedef std::vector<NodeChange> ChangesList;
- public:
- typedef ChangesList::const_iterator Iterator;
- typedef ChangesList::iterator MutatingIterator;
public:
/// Constructs an empty collection of changes
NodeChanges();
@@ -139,7 +132,7 @@ namespace configmgr
bool isEmpty() const;
/// retrieves the total count of changes in this collection
- ChangesList::size_type getCount() const { return m_aChanges.size(); }
+ std::vector<NodeChange>::size_type getCount() const { return m_aChanges.size(); }
/// retrieve information about the changed data, appending to a sequence, returning the count
sal_uInt32 getChangesInfos(NodeChangesInformation& rInfos) const;
@@ -164,17 +157,17 @@ namespace configmgr
void add(NodeChanges const& aChanges);
/// returns an STL-style iterator to the first element of the collection
- Iterator begin() const { return m_aChanges.begin(); }
- MutatingIterator begin() { return m_aChanges.begin(); }
+ std::vector<NodeChange>::const_iterator begin() const { return m_aChanges.begin(); }
+ std::vector<NodeChange>::iterator begin() { return m_aChanges.begin(); }
/// returns an STL-style iterator to past the last element of the collection
- Iterator end() const { return m_aChanges.end(); }
- MutatingIterator end() { return m_aChanges.end(); }
+ std::vector<NodeChange>::const_iterator end() const { return m_aChanges.end(); }
+ std::vector<NodeChange>::iterator end() { return m_aChanges.end(); }
private:
void implTest() const;
void implApply() const;
- ChangesList m_aChanges;
+ std::vector<NodeChange> m_aChanges;
};
}
diff --git a/configmgr/source/inc/nodechangeinfo.hxx b/configmgr/source/inc/nodechangeinfo.hxx
index f8ca15e02f..840f13ef83 100644
--- a/configmgr/source/inc/nodechangeinfo.hxx
+++ b/configmgr/source/inc/nodechangeinfo.hxx
@@ -46,17 +46,12 @@ namespace configmgr
namespace configuration
{
//-----------------------------------------------------------------------------
- typedef com::sun::star::uno::Type UnoType;
- typedef com::sun::star::uno::Any UnoAny;
-//-----------------------------------------------------------------------------
- class Tree;
class NodeRef;
class ValueRef;
class NodeID;
class SubNodeID;
- class ElementTreeImpl;
- typedef rtl::Reference<ElementTreeImpl> ElementTreeHolder;
+ class ElementTree;
//-----------------------------------------------------------------------------
/// captures the values of something changing
@@ -114,8 +109,8 @@ namespace configmgr
//-------------------------------------------------
// wrapper object creation
- Tree getNewElementTree() const;
- Tree getOldElementTree() const;
+ rtl::Reference< Tree > getNewElementTree() const;
+ rtl::Reference< Tree > getOldElementTree() const;
NodeID getNewElementNodeID() const;
NodeID getOldElementNodeID() const;
@@ -130,9 +125,9 @@ namespace configmgr
Type type;
// Value change: old/new value; Set change: new/old api element (if known); Rename: old/new name
- DataChange< UnoAny > unoData;
+ DataChange< com::sun::star::uno::Any > unoData;
// Value change: NULL,NULL; Set change: new/old tree element; Rename: the affected element-tree (twice)
- DataChange< ElementTreeHolder > element;
+ DataChange< rtl::Reference<ElementTree> > element;
//-------------------------------------------------
};
@@ -156,12 +151,12 @@ namespace configmgr
RelativePath getAccessor() const { return m_path; }
/// retrieve the tree where the change is actually initiated/reported
- Tree getBaseTree() const;
+ rtl::Reference< Tree > getBaseTree() const;
/// retrieve the node where the change is actually initiated/reported
NodeRef getBaseNode() const;
/// retrieve the tree where the change is actually taking place (may be Empty, if the tree has never been accessed)
- TreeRef getAffectedTreeRef() const;
+ rtl::Reference< Tree > getAffectedTreeRef() const;
/// identify the node where the change is actually taking place
NodeID getAffectedNodeID() const;
@@ -172,11 +167,11 @@ namespace configmgr
void setAccessor( RelativePath const& aAccessor );
void setBase( NodeID const& aBaseID );
- void setBase( Tree const& aBaseTree, NodeRef const& aBaseNode )
+ void setBase( rtl::Reference< Tree > const& aBaseTree, NodeRef const& aBaseNode )
{ setBase( NodeID(aBaseTree,aBaseNode) ); }
void setAffected( NodeID const& aTargetID );
- void setAffected( Tree const& aTargetTree, NodeRef const& aTargetNode )
+ void setAffected( rtl::Reference< Tree > const& aTargetTree, NodeRef const& aTargetNode )
{ setAffected( NodeID(aTargetTree,aTargetNode) ); }
void setChangingSubnode( bool bSubnode = true );
@@ -221,24 +216,21 @@ namespace configmgr
class NodeChangesInformation
{
- typedef std::vector< NodeChangeInformation > Rep;
public:
- typedef Rep::const_iterator Iterator;
-
- Rep::size_type size() const { return m_data.size(); }
+ std::vector< NodeChangeInformation >::size_type size() const { return m_data.size(); }
bool empty() const { return m_data.empty(); }
- void reserve(Rep::size_type sz_) { m_data.reserve(sz_); }
+ void reserve(std::vector< NodeChangeInformation >::size_type sz_) { m_data.reserve(sz_); }
void clear() { m_data.clear(); }
void swap(NodeChangesInformation& aOther) throw() { m_data.swap(aOther.m_data); }
void push_back(NodeChangeInformation const& aChange_)
{ m_data.push_back(aChange_); }
- Iterator begin() const { return m_data.begin(); }
- Iterator end() const { return m_data.end(); }
+ std::vector< NodeChangeInformation >::const_iterator begin() const { return m_data.begin(); }
+ std::vector< NodeChangeInformation >::const_iterator end() const { return m_data.end(); }
private:
- Rep m_data;
+ std::vector< NodeChangeInformation > m_data;
};
//-----------------------------------------------------------------------------
}
diff --git a/configmgr/source/inc/noderef.hxx b/configmgr/source/inc/noderef.hxx
index 4833b2d47a..78cee2868e 100644
--- a/configmgr/source/inc/noderef.hxx
+++ b/configmgr/source/inc/noderef.hxx
@@ -31,8 +31,11 @@
#ifndef CONFIGMGR_CONFIGNODE_HXX_
#define CONFIGMGR_CONFIGNODE_HXX_
+#include "rtl/ref.hxx"
+
#include "configexcept.hxx"
#include "configpath.hxx"
+#include "tree.hxx"
#ifndef INCLUDED_VECTOR
#include <vector>
@@ -43,56 +46,25 @@ namespace configmgr
{
class INode;
- namespace data { class TreeAccessor; }
namespace view { class ViewTreeAccess; }
namespace configapi { class Factory; }
namespace node { struct Attributes; }
namespace configuration
{
//-------------------------------------------------------------------------
- class Name;
class AbsolutePath;
class RelativePath;
namespace Path { class Component; }
class NodeChange;
class NodeChanges;
- class NodeChangesTree;
- //-------------------------------------------------------------------------
-
- namespace argument { struct NoValidate; }
-
- typedef com::sun::star::uno::Type UnoType;
- typedef com::sun::star::uno::Any UnoAny;
- //-------------------------------------------------------------------------
-
class NodeRef;
class ValueRef;
class AnyNodeRef;
- class ElementRef;
class NodeID;
- class Tree;
- class TreeImpl;
-
- typedef unsigned int NodeOffset;
- typedef unsigned int TreeDepth;
- const TreeDepth C_TreeDepthAll = ~0u;
- //-------------------------------------------------------------------------
-
- /// interface for a class that can be used to do some operation on a set of <type>NodeRef</type>s and <type>ValueRef</type>s.
- struct NodeVisitor
- {
- /// returned from <method>handle</method> to indicate whether the operation is complete or should continue
- enum Result { DONE, CONTINUE };
- /// do the operation on <var>aNode</var>. needs to be implemented by concrete visitor classes
- virtual Result handle(Tree const& aTree, NodeRef const& aNode) = 0;
- /// do the operation on <var>aValue</var>. needs to be implemented by concrete visitor classes
- virtual Result handle(Tree const& aTree, ValueRef const& aValue) = 0;
- protected:
- virtual ~NodeVisitor() {}
- };
+ const unsigned int C_TreeDepthAll = ~0u;
//-------------------------------------------------------------------------
/// represents a inner node position in some tree
@@ -102,6 +74,8 @@ namespace configmgr
/// constructs an empty (invalid) node
NodeRef();
+ NodeRef(unsigned int nPos, unsigned int nDepth);
+
/// copy a node (with reference semantics)
NodeRef(NodeRef const& rOther);
/// copy a node (with reference semantics)
@@ -115,355 +89,24 @@ namespace configmgr
inline bool isValid() const;
/// returns the offset of this Node
- inline NodeOffset getOffset() const;
+ inline unsigned int getOffset() const;
/// returns the offset of this Node
- inline TreeDepth getDepth() const;
+ inline unsigned int getDepth() const;
private:
- friend class Tree;
- friend class TreeRef;
- friend class TreeImplHelper;
friend class AnyNodeRef;
- NodeRef(NodeOffset nPos, TreeDepth nDepth);
private:
- NodeOffset m_nPos;
- TreeDepth m_nDepth;
- };
- //-------------------------------------------------------------------------
-
- /** identifies a hierarchy of config entries (identified by <type>NodeRef</type>s and <type>ValueRef</type>s)
-
- <p>Examples for trees include</p>
- <ulist>
- <li>A module tree (for a specific set of parameters).</li>
- <li>An updating tree (for a part of the whole).</li>
- <li>A set element (updating or not), which could be detached.</li>
- <ulist>
- */
- class TreeRef
- {
- public:
- /// create a tree with a given implementation
- TreeRef(TreeImpl* pImpl);
- /// copy a tree (with reference semantics)
- TreeRef(TreeRef const& rOther);
- /// copy a tree (with reference semantics)
- TreeRef& operator=(TreeRef const& rOther);
-
- ~TreeRef();
-
- void swap(TreeRef& rOther);
-
- /// checks, if this refers to an existing tree
- inline bool isValid() const;
-
- /// checks, if this represents a real tree
- bool isEmpty() const;
-
- /// retrieves the number of immediately contained (subtree) nodes
- NodeOffset getContainedInnerNodeCount() const;
-
- /// checks whether the node <var>aNode</var> is a valid inner node in this tree.
- bool isValidNode(NodeRef const& aNode) const;
-
- // releases the data this tree operates on
- void disposeData();
-
- // Root node
- public:
- /// checks whether <var>aNode</var> is the root node of this tree
- bool isRootNode(NodeRef const& aNode) const;
-
- /// gets the root node of this tree
- NodeRef getRootNode() const;
-
- // Tree context handling
- public:
- /// gets the parent tree of this tree, if available
- TreeRef getContextTree() const;
- /// gets the parent node of this tree ('s root node), if available
- NodeRef getContextNode() const;
- friend bool equalTreeRef(TreeRef const& lhs, TreeRef const& rhs);
- private:
- friend class Tree;
- friend class TreeImplHelper;
- TreeImpl* operator->() const { return m_pImpl; }
- TreeImpl& operator* () const { return *m_pImpl; }
- TreeImpl* get() const { return m_pImpl; }
-
- TreeImpl* m_pImpl;
- };
- inline bool equalTreeRef(TreeRef const& lhs, TreeRef const& rhs) { return lhs.m_pImpl == rhs.m_pImpl; }
-
- /** represents a hierarchy of config entries (identified by <type>NodeRef</type>s and <type>ValueRef</type>s)
-
- <p>Examples for trees include</p>
- <ulist>
- <li>A module tree (for a specific set of parameters).</li>
- <li>An updating tree (for a part of the whole).</li>
- <li>A set element (updating or not), which could be detached.</li>
- <ulist>
- */
- class Tree
- {
- typedef node::Attributes NodeAttributes;
- public:
- /// create a tree with a given implementation
- Tree(TreeImpl* pImpl);
- Tree(TreeRef const& _aTree);
-
- /// checks, if this refers to an existing tree
- bool isValid() const
- { return m_ref.isValid(); }
-
- /// checks, if this represents a real tree
- bool isEmpty() const
- { return m_ref.isEmpty(); }
-
- /// retrieves the number of immediately contained (subtree) nodes
- NodeOffset getContainedInnerNodeCount() const
- { return m_ref.getContainedInnerNodeCount(); }
-
- /// checks whether the node <var>aNode</var> is a valid inner node in this tree.
- bool isValidNode(NodeRef const& aNode) const;
-
-#if OSL_DEBUG_LEVEL > 0
- /// checks whether the node <var>aNode</var> is a valid inner node in this tree.
- bool isValidNode(AnyNodeRef const& aNode) const;
-#endif
-
- /// checks whether the node <var>aNode</var> is a valid value node in this tree.
- bool isValidNode(ValueRef const& aNode) const;
-
- /// checks whether the node <var>aNode</var> has any element nodes (of its own).
- bool hasElements(NodeRef const& aNode) const;
-
- /// checks whether the node <var>aNode</var> has a element node named <var>aName</var>.
- bool hasElement(NodeRef const& aNode, Name const& aName) const;
-
- /// checks whether the node <var>aNode</var> has a element node named <var>aName</var>.
- bool hasElement(NodeRef const& aNode, Path::Component const& aName) const;
-
- /** gets the element named <var>aName</var> of node <var>aNode</var>.
- <p>PRE: <code>hasElement(aNode,aName) == true</code></p>
- <p>If there is no such element, may return an empty node or raise an exception (?)</p>
-
- @throws InvalidName
- if <var>aName</var> is not a valid child name for this node
- */
- ElementRef getElement(NodeRef const& aNode, Name const& aName) const;
-
- /** gets the element named <var>aName</var> of node <var>aNode</var>, if it is available.
- <p>PRE: <code>hasElement(aNode,aName) == true</code></p>
- <p>If there is no such element, may return an empty node or raise an exception (?)</p>
- <p>Caution: May miss existing children unless hasChild/getChild has been called before.</p>
-
- @throws InvalidName
- if <var>aName</var> is not a valid child name for this node
- */
- ElementRef getAvailableElement(NodeRef const& aNode, Name const& aName) const;
-
- /// checks whether the node <var>aNode</var> has any child value (in this tree).
- bool hasChildValues(NodeRef const& aNode) const;
-
- /// checks whether the node <var>aNode</var> has any child subtrees (in this tree).
- bool hasChildNodes(NodeRef const& aNode) const;
-
- /// checks whether the node <var>aNode</var> has any child nodes (in this tree).
- bool hasChildren(NodeRef const& aNode) const;
-
- /// checks whether the node <var>aNode</var> has a child value (in this tree) named <var>aName</var>.
- bool hasChildValue(NodeRef const& aNode, Name const& aName) const;
-
- /// checks whether the node <var>aNode</var> has a child subtree (in this tree) named <var>aName</var>.
- bool hasChildNode(NodeRef const& aNode, Name const& aName) const;
-
- /// checks whether the node <var>aNode</var> has a child node (in this tree) named <var>aName</var>.
- bool hasChild(NodeRef const& aNode, Name const& aName) const;
-
- /** gets the child value (in this tree) named <var>aName</var> of node <var>aNode</var>.
- <p>PRE: <code>hasChildValue(aNode,aName) == true</code></p>
- <P>If there is no such node, may return an empty node or raise an exception (?)</p>
-
- @throws InvalidName
- if <var>aName</var> is not a valid child name for this node
- */
- ValueRef getChildValue(NodeRef const& aNode, Name const& aName) const;
-
- /** gets the child value (in this tree) named <var>aName</var> of node <var>aNode</var>.
- <p>PRE: <code>hasChildNode(aNode,aName) == true</code></p>
- <P>If there is no such node, may return an empty node or raise an exception (?)</p>
-
- @throws InvalidName
- if <var>aName</var> is not a valid child name for this node
- */
- NodeRef getChildNode(NodeRef const& aNode, Name const& aName) const;
-
- /** gets the child value (in this tree) named <var>aName</var> of node <var>aNode</var>.
- <p>PRE: <code>hasChildNode(aNode,aName) == true</code></p>
- <P>If there is no such node, may return an empty node or raise an exception (?)</p>
-
- @throws InvalidName
- if <var>aName</var> is not a valid child name for this node
- */
- AnyNodeRef getAnyChild(NodeRef const& aNode, Name const& aName) const;
-
- /// return the local <type>Name</type> of the root node of this tree
- Path::Component getRootName() const;
-
- /// return the local <type>Name</type> of node <var>aNode</var> in this tree
- Name getName(NodeRef const& aNode) const;
-
- /// return the local <type>Name</type> of value <var>aValue</var> in this tree
- Name getName(ValueRef const& aValue) const;
-
- /// return the <type>Attributes</type> of node <var>aNode</var> in this tree
- NodeAttributes getAttributes(NodeRef const& aNode) const;
-
- /// return the <type>Attributes</type> of node <var>aNode</var> in this tree
- NodeAttributes getAttributes(AnyNodeRef const& aNode) const;
-
- /// return the <type>Attributes</type> of value <var>aValue</var> in this tree
- NodeAttributes getAttributes(ValueRef const& aValue) const;
-
- /// get the Uno <type scope='com::sun::star::uno'>Type</type> of value <var>aValue</var> in this tree
- UnoType getUnoType(ValueRef const& aValue) const;
-
- // Parent/NodeRef context handling
- public:
- /// return the parent <type>NodeRef</type> of <var>aNode</var> (or an empty node, if it is the tree root)
- NodeRef getParent(NodeRef const& aNode) const;
-
- /// return the parent <type>NodeRef</type> of <var>aValue</var> (or an empty node, if it is the tree root)
- NodeRef getParent(ValueRef const& aValue) const;
-
- /// return the <type>AbsolutePath</type> of <var>aNode</var>
- AbsolutePath getAbsolutePath(NodeRef const& aNode) const;
-
- /// gets the <type>AbsolutePath</type> of the root node of this tree
- AbsolutePath getRootPath() const;
-
- /// gets the root node of this tree
- NodeRef getRootNode() const
- { return m_ref.getRootNode(); }
-
- /// checks whether <var>aNode</var> is the root node of this tree
- bool isRootNode(NodeRef const& aNode) const
- { return m_ref.isRootNode(aNode); }
-
- public:
- // value handling
- /** retrieves the current value for <var>aNode</var>, provided there is one and it
- is available.
- */
- UnoAny getNodeValue(ValueRef const& aNode) const; // only works for value nodes
-
- // default value handling
- /// checks whether <var>aNode</var> has a default value
- bool hasNodeDefault(ValueRef const& aNode) const; // only works for value nodes
-
- /// checks whether <var>aNode</var> assumes its default value
- bool isNodeDefault(ValueRef const& aNode) const; // only works for value nodes
-
- /// checks whether <var>aNode</var> has a default state
- bool hasNodeDefault(NodeRef const& aNode) const;
-
- /// checks whether <var>aNode</var> assumes its default state
- bool isNodeDefault(NodeRef const& aNode) const;
-
- /// checks whether <var>aNode</var> has a default state
- bool hasNodeDefault(AnyNodeRef const& aNode) const;
-
- /// checks whether <var>aNode</var> assumes its default state
- bool isNodeDefault(AnyNodeRef const& aNode) const;
-
- /// checks whether the default values are available for the children of <var>aNode</var> (if applicable)
- bool areValueDefaultsAvailable(NodeRef const& aNode) const;
-
- /** retrieves the default value for <var>aNode</var>, provided there is one and it
- is available.
- <p>call <method>Tree::ensureDefaults</method> first to achieve best results</p>
- */
- UnoAny getNodeDefaultValue(ValueRef const& aNode) const; // only works for value nodes
-
- // Tree context handling
- public:
- /// gets the parent tree of this tree, if available
- Tree getContextTree() const;
- /// gets the parent node of this tree ('s root node), if available
- NodeRef getContextNode() const;
-
- // Update handling
- public:
- /// checks whether there are pending changes on this tree
- bool hasChanges() const;
-
- /// lists any pending changes on this tree
- bool collectChanges(NodeChanges& aChanges) const;
-
- /// applies <var>aChange</var> to <var>aNode</var> within this tree
- void integrate(NodeChange& aChange, NodeRef const& aNode, bool bLocal) const;
-
- /// applies <var>aChange</var> to <var>aNode</var> within this tree
- void integrate(NodeChange& aChange, ValueRef const& aNode, bool bLocal) const;
-
- /// applies <var>aChanges</var> to the children or descendants of <var>aNode</var> within this tree
- void integrate(NodeChanges& aChanges, NodeRef const& aNode, bool bLocal) const;
-
- /// applies <var>aChanges</var> to the descendants of <var>aNode</var> within this tree
- void integrate(NodeChangesTree& aChanges, NodeRef const& aNode) const;
-
- // Visitor handling
- public:
- /// dispatch node <var>aNode</var> to a Visitor
- NodeVisitor::Result visit(NodeRef const& aNode, NodeVisitor& aVisitor) const
- { return aVisitor.handle(*this,aNode); }
-
- /// dispatch node <var>aNode</var> to a Visitor
- NodeVisitor::Result visit(ValueRef const& aNode, NodeVisitor& aVisitor) const
- { return aVisitor.handle(*this,aNode); }
-
- /** lets <var>aVisitor</var> visit the child nodes of <var>aNode</var>
- <p>The order in which nodes are visited is repeatable (but currently unspecified)</p>
- <p> Visits nodes until NodeVisitor::DONE is returned, then returns NodeVisitor::DONE.<BR/>
- If all visits return NodeVisitor::CONTINUE, returns NodeVisitor::CONTINUE.<BR/>
- If no children are present, returns NodeVisitor::CONTINUE
- </p>
- */
- NodeVisitor::Result dispatchToChildren(NodeRef const& aNode, NodeVisitor& aVisitor) const;
-
- /** lets <var>aVisitor</var> visit the child nodes of <var>aNode</var>
- <p>The order in which nodes are visited is repeatable (but currently unspecified)</p>
- <p> Visits nodes until NodeVisitor::DONE is returned, then returns NodeVisitor::DONE.<BR/>
- If all visits return NodeVisitor::CONTINUE, returns NodeVisitor::CONTINUE.<BR/>
- If no children are present, returns NodeVisitor::CONTINUE
- </p>
- */
- NodeVisitor::Result dispatchToChildren(AnyNodeRef const& aNode, NodeVisitor& aVisitor) const;
- // More NodeRef handling
- public:
- TreeRef getRef() const { return m_ref; }
-
- // view & data layer binding
- public:
- view::ViewTreeAccess getView() const;
-
- // Comparison
- public:
- friend bool equalTree(Tree const& lhs, Tree const& rhs) { return equalTreeRef(lhs.m_ref, rhs.m_ref); }
- private:
- friend class TreeImplHelper;
- TreeRef m_ref;
+ unsigned int m_nPos;
+ unsigned int m_nDepth;
};
//-------------------------------------------------------------------------
class NodeID
{
public:
- NodeID(Tree const& rTree, NodeRef const& rNode);
- NodeID(TreeRef const& rTree, NodeRef const& rNode);
- NodeID(TreeImpl* pImpl, NodeOffset nNode);
+ NodeID(rtl::Reference< Tree > const& rTree, NodeRef const& rNode);
+ NodeID(Tree* pImpl, unsigned int nNode);
// comparison
// equality
@@ -478,41 +121,47 @@ namespace configmgr
// hashing
size_t hashCode() const;
// use as index - returns a value in the range 0..rTree.getContainedNodes() for the tree used to construct this
- NodeOffset toIndex() const;
+ unsigned int toIndex() const;
+
+ Tree * getTree() const { return m_pTree; }
+
+ unsigned int getOffset() const { return m_nNode; }
+
+ NodeRef getNode() const;
+
private:
- friend class TreeImplHelper;
- TreeImpl* m_pTree;
- NodeOffset m_nNode;
+ Tree* m_pTree;
+ unsigned int m_nNode;
};
//-------------------------------------------------------------------------
- /** make a <type>Name</type> out of <var>sName</var>.
+ /** make a name out of <var>sName</var>.
@throws InvalidName
if <var>sName</var> is not a valid name for a member of group <var>aNode</var> within <var>aTree</var>
*/
- Name validateChildName(OUString const& sName, Tree const& aTree, NodeRef const& aNode );
+ rtl::OUString validateChildName(rtl::OUString const& sName, rtl::Reference< Tree > const& aTree, NodeRef const& aNode );
- /** make a <type>Name</type> out of <var>sName</var>.
+ /** make a name out of <var>sName</var>.
@throws InvalidName
if <var>sName</var> is not a valid name for an element of set <var>aNode</var> within <var>aTree</var>
*/
- Name validateElementName(OUString const& sName, Tree const& aTree, NodeRef const& aNode );
+ rtl::OUString validateElementName(rtl::OUString const& sName, rtl::Reference< Tree > const& aTree, NodeRef const& aNode );
- /** make a <type>Name</type> out of <var>sName</var>.
+ /** make a name out of <var>sName</var>.
@throws InvalidName
if <var>sName</var> is not a valid name for a child of <var>aNode</var> within <var>aTree</var>
*/
- Name validateChildOrElementName(OUString const& sName, Tree const& aTree, NodeRef const& aNode );
+ rtl::OUString validateChildOrElementName(rtl::OUString const& sName, rtl::Reference< Tree > const& aTree, NodeRef const& aNode );
/** make one path component out of <var>sName</var>.
@throws InvalidName
if <var>sName</var> is not a valid name for an element of set <var>aNode</var> within <var>aTree</var>
*/
- Path::Component validateElementPathComponent(OUString const& sName, Tree const& aTree, NodeRef const& aNode );
+ Path::Component validateElementPathComponent(rtl::OUString const& sName, rtl::Reference< Tree > const& aTree, NodeRef const& aNode );
/** parse <var>aPath</var> into a relative path,
valid in the context of node <var>aNode<var/> in <var>aTree<var/>.
@@ -522,7 +171,7 @@ namespace configmgr
@throws InvalidName
if <var>aPath<var/> is not a relative path or not valid in the context of <var>aNode<var/>
*/
- RelativePath validateRelativePath(OUString const& aPath, Tree const& aTree, NodeRef const& aNode);
+ RelativePath validateRelativePath(rtl::OUString const& aPath, rtl::Reference< Tree > const& aTree, NodeRef const& aNode);
/** parse <var>aPath</var> as a configuration path
and reduce it to be relative to node <var>aNode<var/> in <var>aTree<var/>.
@@ -535,7 +184,7 @@ namespace configmgr
if <var>aPath<var/> is not awell-formed path or
if it is an absolute path that is not to a descendant of <var>aNode<var/>
*/
- RelativePath validateAndReducePath(OUString const& aPath, Tree const& aTree, NodeRef const& aNode);
+ RelativePath validateAndReducePath(rtl::OUString const& aPath, rtl::Reference< Tree > const& aTree, NodeRef const& aNode);
/** checks whether there is an immediate child of <var>aNode</var> (which is in <var>aTree</var>)
specified by <var>aName</var>
@@ -543,7 +192,7 @@ namespace configmgr
<TRUE/> if the child node exists
<FALSE/> otherwise
*/
- bool hasChildOrElement(Tree const& aTree, NodeRef const& aNode, Name const& aName);
+ bool hasChildOrElement(rtl::Reference< Tree > const& aTree, NodeRef const& aNode, rtl::OUString const& aName);
/** checks whether there is an immediate child of <var>aNode</var> (which is in <var>aTree</var>)
specified by <var>aName</var>
@@ -552,7 +201,7 @@ namespace configmgr
<TRUE/> if the child node exists
<FALSE/> otherwise
*/
- bool hasChildOrElement(Tree const& aTree, NodeRef const& aNode, Path::Component const& aName);
+ bool hasChildOrElement(rtl::Reference< Tree > const& aTree, NodeRef const& aNode, Path::Component const& aName);
/** tries to find the immediate child of <var>aNode</var> (which is in <var>aTree</var>)
specified by <var>aName</var>
@@ -568,30 +217,22 @@ namespace configmgr
@see NodeRef::getAvailableChild
*/
- bool findInnerChildOrAvailableElement(Tree& aTree, NodeRef& aNode, Name const& aName);
+ bool findInnerChildOrAvailableElement(rtl::Reference< Tree >& aTree, NodeRef& aNode, rtl::OUString const& aName);
/// test whether the given node is a structural (inner) node
- bool isStructuralNode(Tree const& aTree, NodeRef const& aNode);
+ bool isStructuralNode(rtl::Reference< Tree > const& aTree, NodeRef const& aNode);
/// test whether the given inner node is a group node
- bool isGroupNode(Tree const& aTree, NodeRef const& aNode);
+ bool isGroupNode(rtl::Reference< Tree > const& aTree, NodeRef const& aNode);
/// get the value for a node that is a simple value (as tree element)
- UnoAny getSimpleElementValue(Tree const& aTree, NodeRef const& aNode);
+ com::sun::star::uno::Any getSimpleElementValue(rtl::Reference< Tree > const& aTree, NodeRef const& aNode);
/// test whether the given inner node is a set node
- bool isSetNode(Tree const& aTree, NodeRef const& aNode);
-
- typedef std::vector<NodeID> NodeIDList;
-
- void getAllContainedNodes(Tree const& aTree, NodeIDList& aList);
- NodeID findNodeFromIndex(TreeRef const& aTreeRef, NodeOffset nIndex);
+ bool isSetNode(rtl::Reference< Tree > const& aTree, NodeRef const& aNode);
- //-------------------------------------------------------------------------
- inline bool TreeRef::isValid() const
- {
- return m_pImpl != 0;
- }
+ void getAllContainedNodes(rtl::Reference< Tree > const& aTree, std::vector<NodeID>& aList);
+ NodeID findNodeFromIndex(rtl::Reference< Tree > const& aTreeRef, unsigned int nIndex);
//-------------------------------------------------------------------------
inline bool NodeRef::isValid() const
@@ -600,13 +241,13 @@ namespace configmgr
}
//-------------------------------------------------------------------------
- inline NodeOffset NodeRef::getOffset() const
+ inline unsigned int NodeRef::getOffset() const
{
return m_nPos;
}
//-------------------------------------------------------------------------
- inline TreeDepth NodeRef::getDepth() const
+ inline unsigned int NodeRef::getDepth() const
{
return m_nDepth;
}
diff --git a/configmgr/source/inc/nodevisitor.hxx b/configmgr/source/inc/nodevisitor.hxx
index ab8975ece8..a61b48f9ed 100644
--- a/configmgr/source/inc/nodevisitor.hxx
+++ b/configmgr/source/inc/nodevisitor.hxx
@@ -1,7 +1,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2008 by Sun Microsystems, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -28,97 +28,53 @@
*
************************************************************************/
-#ifndef CONFIGMGR_NODEVISITOR_HXX
-#define CONFIGMGR_NODEVISITOR_HXX
-
-#include "nodeaccess.hxx"
-
-namespace configmgr
-{
-// -----------------------------------------------------------------------------
- namespace data
- {
- // -------------------------------------------------------------------------
- // class NodeAccess;
- class ValueNodeAccess;
- class GroupNodeAccess;
- class SetNodeAccess;
- class TreeAccessor;
-
- // -------------------------------------------------------------------------
- /** interface for a class that can be used to do some operation on a set of <type>NodeAccess</type>s
- <p>Concrete classes should override at least one of the 'handle' methods.</p>
- */
- class NodeVisitor
- {
- public:
- /// returned from <method>handle</method> to indicate whether the operation is complete or should continue
- enum Result { DONE, CONTINUE };
-
- /// destructor. is pure to make this class abstract
- virtual ~NodeVisitor() ; // = 0; - does not work well with SunCC 5.2
-
- /// dispatch this to the children of <var>aNode</var>, until one returns DONE
- Result visitChildren(GroupNodeAccess const& _aNode);
-
- /// dispatch to <var>aNode</var> as the proper type
- Result visitNode(NodeAccess const& _aNode);
-
- protected:
- /// do the operation on <var>aNode</var>. Default implementation returns CONTINUE.
- virtual Result handle(NodeAccess const& _aNode);
-
- /// do the operation on <var>aNode</var>. Default implementation calls handle(NodeAccess(_aNode));
- virtual Result handle(ValueNodeAccess const& _aNode);
-
- /** do the operation on <var>aNode</var>. Default implementation calls handle(NodeAccess(_aNode));
- <p>To recursively visit the whole tree, call <method>visitChildren</method>
- in the implementation</p>
- */
- virtual Result handle(GroupNodeAccess const& _aNode);
-
- /** do the operation on <var>aNode</var>. Default implementation calls handle(NodeAccess(_aNode));
- <p>To recursively visit the whole tree, call <method>visitChildren</method>
- in the implementation</p>
- */
- virtual Result handle(SetNodeAccess const& _aNode);
-
- struct Dispatcher;
- friend struct Dispatcher;
- };
-
- inline NodeVisitor::~NodeVisitor() {}
-
- // -------------------------------------------------------------------------
- /** interface for a class that can be used to do some operation on a set of <type>TreeAccess</type>s
- <p>Concrete classes should override at least one of the 'handle' methods.</p>
- */
- class SetVisitor : public NodeVisitor
- {
- public:
- /// destructor. is pure to make this class abstract
- virtual ~SetVisitor() ; //= 0; - does not work well with SunCC 5.2
-
- /// dispatch to <var>_aElementTree</var>
- Result visitTree(TreeAccessor const& _aElementTree);
-
- /// dispatch this to the elements of <var>aNode</var>, until one returns DONE
- Result visitElements(SetNodeAccess const& _aNode);
-
- protected:
- using NodeVisitor::handle;
- /// do the operation on <var>aNode</var>. Default implementation call NodeVisitor::visit for the rootnode.
- virtual Result handle(TreeAccessor const& _aElementTree);
-
- struct Dispatcher;
- friend struct Dispatcher;
- };
-
- inline SetVisitor::~SetVisitor() {}
- // -------------------------------------------------------------------------
- }
-// -----------------------------------------------------------------------------
-} // namespace configmgr
-
-#endif // CONFIGMGR_NODEVISITOR_HXX
+#ifndef INCLUDED_CONFIGMGR_SOURCE_INC_NODEVISITOR_HXX
+#define INCLUDED_CONFIGMGR_SOURCE_INC_NODEVISITOR_HXX
+
+#include "sal/config.h"
+
+namespace configmgr { namespace sharable {
+ struct GroupNode;
+ struct SetNode;
+ struct TreeFragment;
+ struct ValueNode;
+ union Node;
+} }
+
+namespace configmgr { namespace data {
+
+class NodeVisitor {
+public:
+ virtual ~NodeVisitor() = 0;
+
+ bool visitNode(sharable::Node * node);
+
+ bool visitChildren(sharable::GroupNode * node);
+
+protected:
+ virtual bool handle(sharable::Node * node);
+
+ virtual bool handle(sharable::ValueNode * node);
+
+ virtual bool handle(sharable::GroupNode * node);
+
+ virtual bool handle(sharable::SetNode * node);
+};
+
+class SetVisitor: public NodeVisitor {
+public:
+ virtual ~SetVisitor() = 0;
+
+ bool visitTree(sharable::TreeFragment * tree);
+
+ bool visitElements(sharable::SetNode * node);
+
+protected:
+ using NodeVisitor::handle;
+
+ virtual bool handle(sharable::TreeFragment * tree);
+};
+
+} }
+#endif
diff --git a/configmgr/source/inc/options.hxx b/configmgr/source/inc/options.hxx
index 2f9dfb4ca6..6ec446df7e 100644
--- a/configmgr/source/inc/options.hxx
+++ b/configmgr/source/inc/options.hxx
@@ -35,6 +35,7 @@
#include <com/sun/star/uno/Any.hxx>
#include <com/sun/star/uno/Reference.hxx>
#include "utility.hxx"
+#include <salhelper/simplereferenceobject.hxx>
#include <vos/ref.hxx>
namespace configmgr
@@ -49,15 +50,11 @@ namespace configmgr
the new options or important options etc.
*/
- class OOptions : public configmgr::SimpleReferenceObject
+ class OOptions : public salhelper::SimpleReferenceObject
{
RequestOptions m_aRequestOptions; // current options to use
public:
- typedef RequestOptions::Locale Locale;
- typedef RequestOptions::LocaleString LocaleString;
- typedef RequestOptions::Entity Entity;
-
OOptions()
: m_aRequestOptions()
{}
@@ -69,23 +66,23 @@ namespace configmgr
}
OOptions(const OOptions& _aOtherOptions)
- : configmgr::SimpleReferenceObject()
+ : SimpleReferenceObject()
, m_aRequestOptions(_aOtherOptions.m_aRequestOptions)
{
}
bool isForSessionUser() const { return ! m_aRequestOptions.hasEntity(); }
- LocaleString getLocale() const { return m_aRequestOptions.getLocale(); }
- Entity getUser() const { return m_aRequestOptions.getEntity(); }
+ rtl::OUString getLocale() const { return m_aRequestOptions.getLocale(); }
+ rtl::OUString getUser() const { return m_aRequestOptions.getEntity(); }
RequestOptions const & getRequestOptions() const
{ return m_aRequestOptions; }
- void setUser(const Entity & _rUser)
+ void setUser(const rtl::OUString & _rUser)
{ m_aRequestOptions.setEntity(_rUser); }
- void setLocale(const Locale & _rLocale)
+ void setLocale(const com::sun::star::lang::Locale & _rLocale)
{ m_aRequestOptions.setLocale(_rLocale); }
void setMultiLocaleMode()
@@ -94,12 +91,11 @@ namespace configmgr
void enableAsync(bool _bEnable)
{ m_aRequestOptions.enableAsync(_bEnable); }
};
- typedef vos::ORef<OOptions> OptionsRef;
struct ltOptions
{
lessRequestOptions ltData;
- bool operator()(OptionsRef const &o1, OptionsRef const &o2) const
+ bool operator()(vos::ORef<OOptions> const &o1, vos::ORef<OOptions> const &o2) const
{
return ltData(o1->getRequestOptions(),o2->getRequestOptions());
}
diff --git a/configmgr/source/inc/oslstream.hxx b/configmgr/source/inc/oslstream.hxx
index 580ef41623..4ea8868b63 100644
--- a/configmgr/source/inc/oslstream.hxx
+++ b/configmgr/source/inc/oslstream.hxx
@@ -48,13 +48,9 @@ namespace configmgr
namespace stario = ::com::sun::star::io;
namespace staruno = ::com::sun::star::uno;
- using rtl::OUString;
-
// -----------------------------------------------------------------------------
- typedef ::cppu::WeakImplHelper1<stario::XInputStream> InputStreamWrapper_Base;
-
/// OSLInputStreamWrapper - implementation of XInputStream on an (unbuffered) osl::File
- class OSLInputStreamWrapper : public InputStreamWrapper_Base
+ class OSLInputStreamWrapper : public ::cppu::WeakImplHelper1<stario::XInputStream>
{
::osl::Mutex m_aMutex;
::osl::File* m_pFile;
@@ -85,10 +81,8 @@ namespace configmgr
};
// -----------------------------------------------------------------------------
- typedef ::cppu::WeakImplHelper1<stario::XOutputStream> OutputStreamWrapper_Base;
-
/// OSLOutputStreamWrapper - implementation of XOutputStream on an (unbuffered) osl::File
- class OSLOutputStreamWrapper : public OutputStreamWrapper_Base
+ class OSLOutputStreamWrapper : public ::cppu::WeakImplHelper1<stario::XOutputStream>
{
::osl::Mutex m_aMutex;
::osl::File& rFile;
@@ -109,7 +103,7 @@ namespace configmgr
};
// -----------------------------------------------------------------------------
/// BufferedFileOutputStream - buffered implementation of XOutputStream on an osl::File
- class BufferedFileOutputStream: public OutputStreamWrapper_Base
+ class BufferedFileOutputStream: public ::cppu::WeakImplHelper1<stario::XOutputStream>
{
BufferedOutputFile m_aFile;
diff --git a/configmgr/source/inc/pointer.hxx b/configmgr/source/inc/pointer.hxx
deleted file mode 100644
index 948a9e48d5..0000000000
--- a/configmgr/source/inc/pointer.hxx
+++ /dev/null
@@ -1,29 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: pointer.hxx,v $
- * $Revision: 1.7 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
diff --git a/configmgr/source/inc/request.hxx b/configmgr/source/inc/request.hxx
index cd08ce4856..1d553abb5c 100644
--- a/configmgr/source/inc/request.hxx
+++ b/configmgr/source/inc/request.hxx
@@ -41,40 +41,37 @@ namespace configmgr
namespace backend
{
// ---------------------------------------------------------------------------
- using configuration::AbsolutePath;
- using configuration::Name;
-// ---------------------------------------------------------------------------
class NodeRequest
{
- AbsolutePath m_aNodePath;
+ configuration::AbsolutePath m_aNodePath;
RequestOptions m_aOptions;
public:
- NodeRequest(AbsolutePath const& _aNodePath, RequestOptions const & _aOptions)
+ NodeRequest(configuration::AbsolutePath const& _aNodePath, RequestOptions const & _aOptions)
: m_aNodePath(_aNodePath)
, m_aOptions(_aOptions)
{
}
- AbsolutePath const & getPath() const { return m_aNodePath; }
+ configuration::AbsolutePath const & getPath() const { return m_aNodePath; }
RequestOptions const & getOptions() const { return m_aOptions; }
};
// ---------------------------------------------------------------------------
class ComponentRequest
{
- Name m_aComponentName;
+ rtl::OUString m_aComponentName;
RequestOptions m_aOptions;
bool m_bForcedReload;
public:
- ComponentRequest(Name const& _aComponentName, RequestOptions const & _aOptions)
+ ComponentRequest(rtl::OUString const& _aComponentName, RequestOptions const & _aOptions)
: m_aComponentName(_aComponentName)
, m_aOptions(_aOptions)
, m_bForcedReload(false)
{
}
- Name const & getComponentName() const { return m_aComponentName; }
+ rtl::OUString const & getComponentName() const { return m_aComponentName; }
RequestOptions const & getOptions() const { return m_aOptions; }
bool isForcingReload() const { return m_bForcedReload; }
@@ -84,25 +81,25 @@ namespace configmgr
class TemplateRequest
{
- Name m_aComponentName;
- Name m_aTemplateName;
+ rtl::OUString m_aComponentName;
+ rtl::OUString m_aTemplateName;
public:
static
- TemplateRequest forComponent(Name const & _aComponentName)
+ TemplateRequest forComponent(rtl::OUString const & _aComponentName)
{
- return TemplateRequest( Name(), _aComponentName);
+ return TemplateRequest( rtl::OUString(), _aComponentName);
}
explicit
- TemplateRequest(Name const & _aTemplateName, Name const & _aComponentName)
+ TemplateRequest(rtl::OUString const & _aTemplateName, rtl::OUString const & _aComponentName)
: m_aComponentName(_aComponentName)
, m_aTemplateName(_aTemplateName)
{}
- bool isComponentRequest() const { return m_aTemplateName.isEmpty(); }
- Name getTemplateName() const { return m_aTemplateName; }
- Name getComponentName() const { return m_aComponentName; }
+ bool isComponentRequest() const { return m_aTemplateName.getLength() == 0; }
+ rtl::OUString getTemplateName() const { return m_aTemplateName; }
+ rtl::OUString getComponentName() const { return m_aComponentName; }
};
@@ -110,11 +107,9 @@ namespace configmgr
class UpdateRequest
{
- typedef rtl::OUString RequestId;
-
ConstUpdateInstance m_aUpdate;
RequestOptions m_aOptions;
- RequestId m_aRQID;
+ rtl::OUString m_aRQID;
public:
explicit
UpdateRequest( UpdateInstance const & _aUpdate,
@@ -132,7 +127,7 @@ namespace configmgr
explicit
UpdateRequest( ConstUpdateInstance::Data _aUpdateData,
- AbsolutePath const & _aRootpath,
+ configuration::AbsolutePath const & _aRootpath,
RequestOptions const & _aOptions)
: m_aUpdate(_aUpdateData, _aRootpath)
, m_aOptions(_aOptions)
@@ -141,13 +136,13 @@ namespace configmgr
bool isSyncRequired() const { return !m_aOptions.isAsyncEnabled(); }
RequestOptions const & getOptions() const { return m_aOptions; }
- NodePath const & getUpdateRoot() const { return m_aUpdate.root(); }
+ configuration::AbsolutePath const & getUpdateRoot() const { return m_aUpdate.root(); }
ConstUpdateInstance const & getUpdate() const { return m_aUpdate; }
ConstUpdateInstance::Data getUpdateData() const { return m_aUpdate.data(); }
- void setRequestId(RequestId const & _aRQID) { m_aRQID = _aRQID; }
- RequestId getRequestId() const { return m_aRQID; }
+ void setRequestId(rtl::OUString const & _aRQID) { m_aRQID = _aRQID; }
+ rtl::OUString getRequestId() const { return m_aRQID; }
};
inline ComponentRequest getComponentRequest(UpdateRequest const & _aUR)
diff --git a/configmgr/source/inc/requestoptions.hxx b/configmgr/source/inc/requestoptions.hxx
index 1eb9f3fafc..bf3ba310cc 100644
--- a/configmgr/source/inc/requestoptions.hxx
+++ b/configmgr/source/inc/requestoptions.hxx
@@ -44,10 +44,6 @@ namespace configmgr
class RequestOptions
{
public:
- typedef com::sun::star::lang::Locale Locale;
- typedef rtl::OUString LocaleString;
- typedef rtl::OUString Entity;
- public:
/// Default constructor. Sets options to use defaults.
RequestOptions()
: m_sLocale()
@@ -68,11 +64,11 @@ namespace configmgr
/// @returns the locale to get data for
bool isForAllLocales() const;
/// @returns the locale to get data for - compatibilty version
- LocaleString getLocale() const { return getIsoLocale(); }
+ rtl::OUString getLocale() const { return getIsoLocale(); }
/// @returns the locale to get data for
- LocaleString getIsoLocale() const;
+ rtl::OUString getIsoLocale() const;
/// @returns the locale to get data for
- Locale const & getUnoLocale() const { return m_sLocale; }
+ com::sun::star::lang::Locale const & getUnoLocale() const { return m_sLocale; }
/** @returns
<TRUE/>, if an entity is specified, <BR/>
@@ -80,19 +76,19 @@ namespace configmgr
*/
bool hasEntity() const { return m_sEntity.getLength() != 0; }
/// @returns the entity to get data for
- Entity getEntity() const { return m_sEntity; }
+ rtl::OUString getEntity() const { return m_sEntity; }
/// sets the entity to get data for to the given entity
- void setEntity(Entity const & _sEntity) { m_sEntity = _sEntity; }
+ void setEntity(rtl::OUString const & _sEntity) { m_sEntity = _sEntity; }
/// resets the entity to get data for to be the session user
- void clearEntity() { m_sEntity = Entity(); }
+ void clearEntity() { m_sEntity = rtl::OUString(); }
/// sets the locale so data is gotten for all locales
void setAllLocales();
/// sets the locale to get data for to the given locale
- void setLocale(Locale const & _aLocale) { m_sLocale = _aLocale; }
+ void setLocale(com::sun::star::lang::Locale const & _aLocale) { m_sLocale = _aLocale; }
/// sets the locale to get data for to the given locale
- void setIsoLocale(LocaleString const & _sLocale);
+ void setIsoLocale(rtl::OUString const & _sLocale);
/// sets a fallback locale, if no locale is set yet
void ensureLocaleSet();
@@ -104,8 +100,8 @@ namespace configmgr
/// function that defines a weak strict ordering on RequestOptions
friend sal_Int32 compareRequestOptions(RequestOptions const& lhs, RequestOptions const& rhs);
private:
- Locale m_sLocale; /// locale to fetch data for
- Entity m_sEntity; /// user/group/role to fetch data for
+ com::sun::star::lang::Locale m_sLocale; /// locale to fetch data for
+ rtl::OUString m_sEntity; /// user/group/role to fetch data for
bool m_bEnableAsync; /// true, if data may be
bool m_bReload; /// reload into cache from backend
};
diff --git a/configmgr/source/inc/requesttypes.hxx b/configmgr/source/inc/requesttypes.hxx
index 2cc8019098..9fb6d8ac7e 100644
--- a/configmgr/source/inc/requesttypes.hxx
+++ b/configmgr/source/inc/requesttypes.hxx
@@ -31,6 +31,10 @@
#ifndef CONFIGMGR_BACKEND_REQUESTTYPES_HXX_
#define CONFIGMGR_BACKEND_REQUESTTYPES_HXX_
+#include "sal/config.h"
+
+#include "salhelper/simplereferenceobject.hxx"
+
#include "valuenode.hxx"
#include "treechangelist.hxx"
#include "configpath.hxx"
@@ -50,53 +54,33 @@ namespace configmgr
namespace backend
{
// ---------------------------------------------------------------------------
- using configuration::AbsolutePath;
- using configuration::Name;
-// ---------------------------------------------------------------------------
- //typedef std::pair<std::auto_ptr<ISubtree>, Name> ComponentData;
struct ComponentDataStruct
{
const std::auto_ptr<ISubtree>& data;
- Name name;
- ComponentDataStruct (const std::auto_ptr<ISubtree>& _data, Name _name)
+ rtl::OUString name;
+ ComponentDataStruct (const std::auto_ptr<ISubtree>& _data, rtl::OUString _name)
: data(_data), name(_name) {}
};
- typedef struct ComponentDataStruct ComponentData;
-
- class NodePath
- {
- AbsolutePath m_path;
- public:
- NodePath(AbsolutePath const & _path) : m_path(_path) {};
-
- AbsolutePath const & location() const { return m_path; }
- AbsolutePath context() const { return m_path.getParentPath(); }
-
- bool isEmpty() const { return m_path.isRoot(); }
- bool isModuleRoot() const { return m_path.getDepth() == 1; }
- Name getModuleName() const { return m_path.getModuleName(); }
- rtl::OUString toString() const { return m_path.toString(); }
- };
// ---------------------------------------------------------------------------
struct NodeInstance
{
typedef std::auto_ptr<ISubtree> Data;
explicit
- NodeInstance(Data _node, AbsolutePath const & _rootpath)
+ NodeInstance(Data _node, configuration::AbsolutePath const & _rootpath)
: m_node(_node)
, m_root(_rootpath)
{
}
Data const & data() const { return m_node; }
- NodePath const & root() const { return m_root; }
+ configuration::AbsolutePath const & root() const { return m_root; }
Data & mutableData() { return m_node; }
Data extractData() { return m_node; }
private:
Data m_node;
- NodePath m_root;
+ configuration::AbsolutePath m_root;
};
// ---------------------------------------------------------------------------
struct TemplateInstance
@@ -104,7 +88,7 @@ namespace configmgr
typedef std::auto_ptr<INode> Data;
explicit
- TemplateInstance(Data _node, Name const & _name, Name const & _component)
+ TemplateInstance(Data _node, rtl::OUString const & _name, rtl::OUString const & _component)
: m_node(_node)
, m_name(_name)
, m_component(_component)
@@ -112,14 +96,14 @@ namespace configmgr
}
Data const & data() const { return m_node; }
- Name const & name() const { return m_name; }
- Name const & component() const { return m_component; }
+ rtl::OUString const & name() const { return m_name; }
+ rtl::OUString const & component() const { return m_component; }
Data extractData() { return m_node; }
private:
Data m_node;
- Name m_name; // if empty, this is a complete set of component templates
- Name m_component;
+ rtl::OUString m_name; // if empty, this is a complete set of component templates
+ rtl::OUString m_component;
};
// ---------------------------------------------------------------------------
struct ComponentInstance
@@ -127,7 +111,7 @@ namespace configmgr
typedef std::auto_ptr<ISubtree> Data;
explicit
- ComponentInstance(Data _node, Data _template, Name const & _component)
+ ComponentInstance(Data _node, Data _template, rtl::OUString const & _component)
: m_node(_node)
, m_template(_template)
, m_component(_component)
@@ -136,26 +120,25 @@ namespace configmgr
Data const & data() const { return m_node; }
Data const & templateData() const { return m_template; }
- Name const & component() const { return m_component; }
+ rtl::OUString const & component() const { return m_component; }
- ComponentData componentTemplateData () const { return ComponentData(m_template,m_component);}
- ComponentData componentNodeData () const { return ComponentData(m_node,m_component);}
+ ComponentDataStruct componentTemplateData () const { return ComponentDataStruct(m_template,m_component);}
+ ComponentDataStruct componentNodeData () const { return ComponentDataStruct(m_node,m_component);}
Data & mutableData() { return m_node; }
Data extractData() { return m_node; }
Data extractTemplateData() { return m_template; }
private:
Data m_node;
Data m_template;
- Name m_component;
+ rtl::OUString m_component;
};
// ---------------------------------------------------------------------------
struct UpdateInstance
{
typedef SubtreeChange * Data;
- typedef SubtreeChange const * ConstData;
explicit
- UpdateInstance(Data _update, AbsolutePath const & _rootpath)
+ UpdateInstance(Data _update, configuration::AbsolutePath const & _rootpath)
: m_update(_update)
, m_root(_rootpath)
{
@@ -168,19 +151,19 @@ namespace configmgr
}
Data data() { return m_update; }
- ConstData data() const { return m_update; }
- NodePath const & root() const { return m_root; }
+ SubtreeChange const * data() const { return m_update; }
+ configuration::AbsolutePath const & root() const { return m_root; }
private:
Data m_update;
- NodePath m_root;
+ configuration::AbsolutePath m_root;
};
// ---------------------------------------------------------------------------
struct ConstUpdateInstance
{
- typedef UpdateInstance::ConstData Data, ConstData;
+ typedef SubtreeChange const * Data;
explicit
- ConstUpdateInstance(Data _update, AbsolutePath const & _rootpath)
+ ConstUpdateInstance(Data _update, configuration::AbsolutePath const & _rootpath)
: m_update(_update)
, m_root(_rootpath)
{
@@ -194,10 +177,10 @@ namespace configmgr
}
Data data() const { return m_update; }
- NodePath const & root() const { return m_root; }
+ configuration::AbsolutePath const & root() const { return m_root; }
private:
Data m_update;
- NodePath m_root;
+ configuration::AbsolutePath m_root;
};
// ---------------------------------------------------------------------------
// ---------------------------------------------------------------------------
@@ -207,20 +190,17 @@ namespace configmgr
template <class Instance_>
class ResultHolder
{
- struct RCInstance : public configmgr::SimpleReferenceObject
+ struct RCInstance : public salhelper::SimpleReferenceObject
{
RCInstance(Instance_ & _instance)
: instance(_instance) {}
Instance_ instance;
};
- typedef rtl::Reference< RCInstance > InstanceRef;
- InstanceRef m_xInstance;
+ rtl::Reference< RCInstance > m_xInstance;
public:
- typedef Instance_ Instance;
-
explicit
- ResultHolder(Instance & _rInstance)
+ ResultHolder(Instance_ & _rInstance)
: m_xInstance( new RCInstance(_rInstance) )
{}
@@ -228,33 +208,28 @@ namespace configmgr
bool is() const { return m_xInstance.is() && m_xInstance->instance.data().get(); }
- Instance const & instance() const { return m_xInstance->instance; }
+ Instance_ const & instance() const { return m_xInstance->instance; }
- Instance const & operator *() const { return instance(); }
- Instance const * operator->() const { return &instance(); }
- Instance & mutableInstance() { return m_xInstance->instance; }
+ Instance_ const & operator *() const { return instance(); }
+ Instance_ const * operator->() const { return &instance(); }
+ Instance_ & mutableInstance() { return m_xInstance->instance; }
- typename Instance::Data extractDataAndClear()
+ typename Instance_::Data extractDataAndClear()
{
- typename Instance::Data aData = m_xInstance->instance.extractData();
+ typename Instance_::Data aData = m_xInstance->instance.extractData();
this->clear();
return aData;
}
void releaseAndClear()
{
- typename Instance::Data aData = this->extractDataAndClear();
+ typename Instance_::Data aData = this->extractDataAndClear();
aData.release();
}
void clear() { m_xInstance.clear(); }
};
// ---------------------------------------------------------------------------
- typedef ResultHolder< NodeInstance > NodeResult;
- typedef ResultHolder< TemplateInstance > TemplateResult;
- typedef ResultHolder< ComponentInstance > ComponentResult;
-
-// ---------------------------------------------------------------------------
}
// ---------------------------------------------------------------------------
} // namespace
diff --git a/configmgr/source/inc/roottree.hxx b/configmgr/source/inc/roottree.hxx
index 8f2dc40fe4..7e6cee11dc 100644
--- a/configmgr/source/inc/roottree.hxx
+++ b/configmgr/source/inc/roottree.hxx
@@ -31,61 +31,52 @@
#ifndef CONFIGMGR_ROOTTREE_HXX_
#define CONFIGMGR_ROOTTREE_HXX_
-#include "utility.hxx"
+#include "sal/config.h"
-#ifndef INCLUDED_MEMORY
#include <memory>
-#define INCLUDED_MEMORY
-#endif
+
+#include "boost/utility.hpp"
+#include "rtl/ref.hxx"
+
+#include "utility.hxx"
namespace configmgr
{
//-----------------------------------------------------------------------------
-
+ namespace sharable { union Node; }
class SubtreeChange;
struct TreeChangeList;
-//-----------------------------------------------------------------------------
-
- namespace data
- {
- class NodeAccess;
- }
-//-----------------------------------------------------------------------------
namespace configuration
{
//-----------------------------------------------------------------------------
- class Tree; typedef Tree RootTree;
- class TreeRef;
- class TreeImpl;
+ class Tree;
class NodeRef;
class NodeChangesInformation;
class AbsolutePath;
class TemplateProvider;
- typedef unsigned int NodeOffset;
- typedef unsigned int TreeDepth;
//-----------------------------------------------------------------------------
- RootTree createReadOnlyTree( AbsolutePath const& aRootPath,
- data::NodeAccess const& _aCacheNode,
- TreeDepth nDepth,
+ rtl::Reference< Tree > createReadOnlyTree( AbsolutePath const& aRootPath,
+ sharable::Node * _aCacheNode,
+ unsigned int nDepth,
TemplateProvider const& aTemplateProvider);
- RootTree createUpdatableTree( AbsolutePath const& aRootPath,
- data::NodeAccess const& _aCacheNode,
- TreeDepth nDepth,
+ rtl::Reference< Tree > createUpdatableTree( AbsolutePath const& aRootPath,
+ sharable::Node * _aCacheNode,
+ unsigned int nDepth,
TemplateProvider const& aTemplateProvider);
//-----------------------------------------------------------------------------
- class CommitHelper : Noncopyable
+ class CommitHelper: private boost::noncopyable
{
struct Data;
std::auto_ptr<Data> m_pData;
- TreeImpl* m_pTree;
+ Tree* m_pTree;
public:
- CommitHelper(TreeRef const& aTree);
+ CommitHelper(rtl::Reference< Tree > const& aTree);
~CommitHelper();
// collect all changes into rChangeList
@@ -105,7 +96,7 @@ namespace configmgr
@param aExternalChanges
a structured change that has already been applied to the master tree.
@param aBaseTree
- the Tree that contains (directly) the affected node of <var>aExternalChanges</var>.
+ the tree that contains (directly) the affected node of <var>aExternalChanges</var>.
@param aBaseNode
a NodeRef referring to the (directly) affected node of <var>aExternalChanges</var>.
@return
@@ -113,7 +104,7 @@ namespace configmgr
*/
bool adjustToChanges( NodeChangesInformation& rLocalChanges,
- Tree const& aBaseTree, NodeRef const& aBaseNode,
+ rtl::Reference< Tree > const& aBaseTree, NodeRef const& aBaseNode,
SubtreeChange const& aExternalChange) ;
diff --git a/configmgr/source/inc/rttimacros.hxx b/configmgr/source/inc/rttimacros.hxx
deleted file mode 100644
index e7ddedd7ee..0000000000
--- a/configmgr/source/inc/rttimacros.hxx
+++ /dev/null
@@ -1,58 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: rttimacros.hxx,v $
- * $Revision: 1.4 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-/* PLEASE DON'T DELETE ANY COMMENT LINES, ALSO IT'S UNNECESSARY. */
-
-
-#ifndef CONFIGMGR_RTTIMACROS_HXX
-#define CONFIGMGR_RTTIMACROS_HXX
-
-#define RTTI_BASE(classname) \
- virtual sal_Bool isA(const sal_Char* _pName) const \
- { \
- return 0 == strcmp(_pName, getStaticType()); \
- } \
- virtual const sal_Char* getType() const { return #classname; } \
- static const sal_Char* getStaticType() { return #classname; }
-
-#define RTTI(classname, baseclassname) \
- virtual sal_Bool isA(const sal_Char* _pName) const \
- { \
- return 0 == strcmp(_pName, getStaticType()) \
- || baseclassname::isA(_pName); \
- } \
- const sal_Char* getType() const { return #classname; } \
- static const sal_Char* getStaticType() { return #classname; }
-
-#ifndef ISA
-#define ISA(classname) isA(classname::getStaticType())
-#endif
-
-#endif
diff --git a/configmgr/source/inc/sequence.hxx b/configmgr/source/inc/sequence.hxx
index e3c69096ce..2b3702c062 100644
--- a/configmgr/source/inc/sequence.hxx
+++ b/configmgr/source/inc/sequence.hxx
@@ -31,7 +31,6 @@
#ifndef INCLUDED_SHARABLE_SEQUENCE_HXX
#define INCLUDED_SHARABLE_SEQUENCE_HXX
-#include "types.hxx"
#include "anydata.hxx"
#include <com/sun/star/uno/Sequence.hxx>
@@ -41,42 +40,40 @@ namespace configmgr
namespace sharable
{
//-----------------------------------------------------------------------------
- typedef Vector Sequence; // alternative name
- //-----------------------------------------------------------------------------
- Sequence allocSequence(AnyData::TypeCode _aElementType, ::sal_Sequence const * _pSeqData);
- void freeSequence(AnyData::TypeCode _aElementType, Sequence _aSeq);
+ sal_uInt8 * allocSequence(sal_uInt8 _aElementType, ::sal_Sequence const * _pSeqData);
+ void freeSequence(sal_uInt8 _aElementType, sal_uInt8 * _aSeq);
- ::sal_Sequence * readSequence(AnyData::TypeCode _aElementType, Sequence _aSeq);
- ::com::sun::star::uno::Any readAnySequence(AnyData::TypeCode _aElementType, Sequence _aSeq);
+ ::sal_Sequence * readSequence(sal_uInt8 _aElementType, sal_uInt8 * _aSeq);
+ ::com::sun::star::uno::Any readAnySequence(sal_uInt8 _aElementType, sal_uInt8 * _aSeq);
//-----------------------------------------------------------------------------
- Sequence allocBinary(::com::sun::star::uno::Sequence<sal_Int8> const & _aBinaryValue);
- void freeBinary(Sequence _aSeq);
+ sal_uInt8 * allocBinary(::com::sun::star::uno::Sequence<sal_Int8> const & _aBinaryValue);
+ void freeBinary(sal_uInt8 * _aSeq);
- ::com::sun::star::uno::Sequence<sal_Int8> readBinary(Sequence _aSeq);
+ ::com::sun::star::uno::Sequence<sal_Int8> readBinary(sal_uInt8 * _aSeq);
//-----------------------------------------------------------------------------
template <class ET>
inline
- AnyData::TypeCode getElementTypeCode(::com::sun::star::uno::Sequence<ET> const & )
+ sal_uInt8 getElementTypeCode(::com::sun::star::uno::Sequence<ET> const & )
{
::com::sun::star::uno::Type aElementType = ::getCppuType( static_cast<ET const *>(NULL) );
return getTypeCode(aElementType);
}
template <class ET>
- Sequence allocSequence(::com::sun::star::uno::Sequence<ET> const & _aSeq)
+ sal_uInt8 * allocSequence(::com::sun::star::uno::Sequence<ET> const & _aSeq)
{
- AnyData::TypeCode aTC = getElementTypeCode(_aSeq);
+ sal_uInt8 aTC = getElementTypeCode(_aSeq);
::sal_Sequence const * pSeqData = _aSeq.get();
return allocSequence(aTC, pSeqData);
}
template <class ET>
- void readSequence(::com::sun::star::uno::Sequence<ET> & _rSeq, Sequence _aSeq)
+ void readSequence(::com::sun::star::uno::Sequence<ET> & _rSeq, sal_uInt8 * _aSeq)
{
- AnyData::TypeCode aElementType = getElementTypeCode(_rSeq);
+ sal_uInt8 aElementType = getElementTypeCode(_rSeq);
::sal_Sequence * pNewSequence = readSequence(aElementType, _aSeq);
@@ -88,7 +85,7 @@ namespace configmgr
}
template <class ET>
- bool readSequence(::com::sun::star::uno::Sequence<ET> & _rSeq, AnyData::TypeCode _aElementType, Sequence _aSeq)
+ bool readSequence(::com::sun::star::uno::Sequence<ET> & _rSeq, sal_uInt8 _aElementType, sal_uInt8 * _aSeq)
{
if (getElementTypeCode(_rSeq) != _aElementType) return false;
diff --git a/configmgr/source/inc/serviceinfohelper.hxx b/configmgr/source/inc/serviceinfohelper.hxx
index 19dfb79fd3..1be7b1e2a2 100644
--- a/configmgr/source/inc/serviceinfohelper.hxx
+++ b/configmgr/source/inc/serviceinfohelper.hxx
@@ -38,19 +38,15 @@ namespace configmgr
// -----------------------------------------------------------------------------
namespace uno = ::com::sun::star::uno;
namespace lang = ::com::sun::star::lang;
- using ::rtl::OUString;
-// -----------------------------------------------------------------------------
-
- typedef sal_Char const * AsciiServiceName;
// -----------------------------------------------------------------------------
/// POD struct describing the registration information of a service implementation
struct ServiceRegistrationInfo
{
/// The implementation name of this service implementation
- AsciiServiceName implementationName;
+ sal_Char const * implementationName;
/// The services for which this service implementation is registered
- AsciiServiceName const * registeredServiceNames;
+ sal_Char const * const * registeredServiceNames;
};
// -----------------------------------------------------------------------------
@@ -58,11 +54,11 @@ namespace configmgr
struct ServiceImplementationInfo
{
/// The implementation name of this service implementation
- AsciiServiceName implementationName;
+ sal_Char const * implementationName;
/// The services for which this service implementation is registered
- AsciiServiceName const * registeredServiceNames;
+ sal_Char const * const * registeredServiceNames;
/// Additional services implemented by this service implementation, for which it is not registered
- AsciiServiceName const * additionalServiceNames;
+ sal_Char const * const * additionalServiceNames;
};
// -----------------------------------------------------------------------------
@@ -80,11 +76,11 @@ namespace configmgr
struct SingletonRegistrationInfo
{
/// The name of this singleton
- AsciiServiceName singletonName;
+ sal_Char const * singletonName;
/// The implementation, which owns this singleton
- AsciiServiceName implementationName;
+ sal_Char const * implementationName;
/// The service, which should be instatiated for this singleton
- AsciiServiceName instantiatedServiceName;
+ sal_Char const * instantiatedServiceName;
/// A name for a pseudo-implementation, which is mapped to this singleton
ServiceRegistrationInfo const * mappedImplementation;
};
@@ -105,10 +101,10 @@ namespace configmgr
sal_Int32 countServices() const;
- OUString getImplementationName( ) const
+ rtl::OUString getImplementationName( ) const
throw(uno::RuntimeException);
- uno::Sequence< OUString > getRegisteredServiceNames( ) const
+ uno::Sequence< rtl::OUString > getRegisteredServiceNames( ) const
throw(uno::RuntimeException);
};
// -----------------------------------------------------------------------------
@@ -124,13 +120,13 @@ namespace configmgr
sal_Int32 countServices() const;
- OUString getImplementationName( ) const
+ rtl::OUString getImplementationName( ) const
throw(uno::RuntimeException);
- sal_Bool supportsService( OUString const & ServiceName ) const
+ sal_Bool supportsService( rtl::OUString const & ServiceName ) const
throw(uno::RuntimeException);
- uno::Sequence< OUString > getSupportedServiceNames( ) const
+ uno::Sequence< rtl::OUString > getSupportedServiceNames( ) const
throw(uno::RuntimeException);
};
// -----------------------------------------------------------------------------
diff --git a/configmgr/source/inc/setnodeaccess.hxx b/configmgr/source/inc/setnodeaccess.hxx
deleted file mode 100644
index 7bbe380c7b..0000000000
--- a/configmgr/source/inc/setnodeaccess.hxx
+++ /dev/null
@@ -1,140 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: setnodeaccess.hxx,v $
- * $Revision: 1.7 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef CONFIGMGR_SETNODEACCESS_HXX
-#define CONFIGMGR_SETNODEACCESS_HXX
-
-#include "nodeaccess.hxx"
-#include "treefragment.hxx"
-
-#include "treeaccessor.hxx"
-
-namespace configmgr
-{
-// -----------------------------------------------------------------------------
- namespace data
- {
- // -------------------------------------------------------------------------
- class TreeAccessor;
- // -------------------------------------------------------------------------
- /** class that mediates access to the data of a Set node
- <p>Is a handle class with reference copy semantics.</p>
- */
- class SetNodeAccess
- {
- public:
- typedef TreeAddress ElementAddress;
- typedef TreeAccessor ElementAccess;
-
- SetNodeAccess(const sharable::SetNode *_pNodeRef)
- : m_pData((SetNodeAddress)_pNodeRef)
- {}
-
- SetNodeAccess(const sharable::Node *_pNodeRef)
- : m_pData(check(_pNodeRef))
- {}
-
- explicit
- SetNodeAccess(NodeAccess const & _aNode)
- : m_pData(check(_aNode))
- {}
-
- static bool isInstance(NodeAccess const & _aNode)
- { return check(_aNode) != NULL; }
-
- bool isValid() const { return m_pData != NULL; }
-
- configuration::Name getName() const;
- node::Attributes getAttributes() const;
-
- bool isDefault() const;
-
- bool isLocalizedValueSetNode() const;
-
- configuration::Name getElementTemplateName() const;
- configuration::Name getElementTemplateModule() const;
-
- bool hasElement (configuration::Name const& _aName) const
- { return SetNodeAccess::implGetElement(_aName) != NULL; }
- ElementAccess getElementTree (configuration::Name const& _aName) const
- { return TreeAccessor(implGetElement(_aName)); }
-
- operator NodeAccess() const { return NodeAccess(NodeAddress(m_pData)); }
-
- sharable::SetNode & data() const { return *m_pData; }
- operator SetNodeAddress () const { return (SetNodeAddress)m_pData; }
- operator NodeAddress () const { return (NodeAddress)m_pData; }
-
- static void addElement(SetNodeAddress _aSetAddress, ElementAddress _aNewElement);
- static ElementAddress removeElement(SetNodeAddress _aSetAddress,
- configuration::Name const & _aName);
- private:
- static SetNodeAddress check(sharable::Node *pNode)
- { return pNode ? const_cast<SetNodeAddress>(pNode->setData()) : NULL; }
- static SetNodeAddress check(NodeAccess const&aRef)
- { return check(static_cast<sharable::Node *>(aRef)); }
-
- ElementAddress implGetElement(configuration::Name const& _aName) const;
-
- SetNodeAddress m_pData;
- };
-
- SetNodeAddress toSetNodeAddress(NodeAddress const & _aNodeAddr);
- // -------------------------------------------------------------------------
- inline
- configuration::Name SetNodeAccess::getName() const
- { return NodeAccess::wrapName( data().info.getName() ); }
-
- inline
- configuration::Name SetNodeAccess::getElementTemplateName() const
- { return NodeAccess::wrapName( data().getElementTemplateName() ); }
-
- inline
- configuration::Name SetNodeAccess::getElementTemplateModule() const
- { return NodeAccess::wrapName( data().getElementTemplateModule() ); }
-
- inline
- node::Attributes SetNodeAccess::getAttributes() const
- { return sharable::node(data()).getAttributes(); }
-
- inline
- bool SetNodeAccess::isDefault() const
- { return data().info.isDefault(); }
-
- inline
- bool SetNodeAccess::isLocalizedValueSetNode() const
- { return data().isLocalizedValue(); }
- // -------------------------------------------------------------------------
- }
-// -----------------------------------------------------------------------------
-} // namespace configmgr
-
-#endif // CONFIGMGR_SETNODEACCESS_HXX
-
diff --git a/configmgr/source/inc/simpleinteractionrequest.hxx b/configmgr/source/inc/simpleinteractionrequest.hxx
index 3b8c9c1e36..204ff4ddc8 100644
--- a/configmgr/source/inc/simpleinteractionrequest.hxx
+++ b/configmgr/source/inc/simpleinteractionrequest.hxx
@@ -56,9 +56,6 @@ namespace apihelper {
class SimpleInteractionRequest : public InteractionRequest
{
public:
- // type used to identify continuations
- typedef sal_uInt32 Continuation;
-
/**
* Constructor.
*
@@ -68,7 +65,7 @@ namespace apihelper {
* listed above.
*/
SimpleInteractionRequest( const uno::Any & rRequest,
- const Continuation nContinuations );
+ const sal_uInt32 nContinuations );
/**
* After passing this request to XInteractionHandler::handle, this method
@@ -77,7 +74,7 @@ namespace apihelper {
* @return the continuation choosen by an interaction handler or
* CONTINUATION_UNKNOWN, if the request was not (yet) handled.
*/
- Continuation getResponse() const;
+ const sal_uInt32 getResponse() const;
};
/** These are the constants that can be passed to the constructor of class
@@ -86,19 +83,19 @@ namespace apihelper {
*/
/** The request was not (yet) handled by the interaction handler. */
- const SimpleInteractionRequest::Continuation CONTINUATION_UNKNOWN = 0;
+ const sal_uInt32 CONTINUATION_UNKNOWN = 0;
/** The interaction handler selected XInteractionAbort. */
- const SimpleInteractionRequest::Continuation CONTINUATION_ABORT = 1;
+ const sal_uInt32 CONTINUATION_ABORT = 1;
/** The interaction handler selected XInteractionRetry. */
- const SimpleInteractionRequest::Continuation CONTINUATION_RETRY = 2;
+ const sal_uInt32 CONTINUATION_RETRY = 2;
/** The interaction handler selected XInteractionApprove. */
- const SimpleInteractionRequest::Continuation CONTINUATION_APPROVE = 4;
+ const sal_uInt32 CONTINUATION_APPROVE = 4;
/** The interaction handler selected XInteractionDisapprove. */
- const SimpleInteractionRequest::Continuation CONTINUATION_DISAPPROVE = 8;
+ const sal_uInt32 CONTINUATION_DISAPPROVE = 8;
} // namespace apihelper
diff --git a/configmgr/source/inc/template.hxx b/configmgr/source/inc/template.hxx
index 6161f86240..49fea66201 100644
--- a/configmgr/source/inc/template.hxx
+++ b/configmgr/source/inc/template.hxx
@@ -34,6 +34,7 @@
#include "configexcept.hxx"
#include "configpath.hxx"
#include <rtl/ref.hxx>
+#include <salhelper/simplereferenceobject.hxx>
#ifndef _CONFIGMGR_UTILITY_HXX_
#include <utility.hxx>
#endif
@@ -41,22 +42,14 @@
namespace configmgr
{
//-----------------------------------------------------------------------------
- struct IConfigTemplateManager;
class RequestOptions;
-//-----------------------------------------------------------------------------
- namespace data { class SetNodeAccess; }
-//-----------------------------------------------------------------------------
+ class TreeManager;
+ namespace sharable { struct SetNode; }
namespace configuration
{
//-----------------------------------------------------------------------------
- class Name;
class AbsolutePath;
- //---------------------------------------------------------------------
-
- typedef com::sun::star::uno::Type UnoType;
- typedef com::sun::star::uno::Any UnoAny;
-
//-----------------------------------------------------------------------------
struct TemplateProvider_Impl;
@@ -67,10 +60,8 @@ namespace configmgr
rtl::Reference<TemplateProvider_Impl> m_aImpl;
public:
- typedef rtl::Reference< IConfigTemplateManager > TemplateManagerRef;
- public:
TemplateProvider(); // creates an empty (invalid) template instance provider
- TemplateProvider(TemplateManagerRef const & xProvider, RequestOptions const& xOptions);
+ TemplateProvider(rtl::Reference< TreeManager > const & xProvider, RequestOptions const& xOptions);
TemplateProvider(TemplateProvider const& aOther);
TemplateProvider& operator=(TemplateProvider const& aOther);
~TemplateProvider();
@@ -79,17 +70,14 @@ namespace configmgr
};
//-----------------------------------------------------------------------------
- class Template;
- typedef rtl::Reference<Template> TemplateHolder;
-
/// provides information about the elements of a <type>Node</type> that is a Container ("set").
- class Template : public configmgr::SimpleReferenceObject
+ class Template : public salhelper::SimpleReferenceObject
{
- Name m_aName;
- Name m_aModule;
- UnoType m_aInstanceType;
+ rtl::OUString m_aName;
+ rtl::OUString m_aModule;
+ com::sun::star::uno::Type m_aInstanceType;
private:
- explicit Template(Name const& aName, Name const& aModule,UnoType const& aType);
+ explicit Template(rtl::OUString const& aName, rtl::OUString const& aModule,com::sun::star::uno::Type const& aType);
public:
/// checks if the type of an instance of this is known
@@ -99,22 +87,22 @@ namespace configmgr
bool isInstanceValue() const;
/// get the UNO type for instances (primarily (only ?) for 'value' templates) <p> PRE: the instance type is known </p>
- UnoType getInstanceType() const;
+ com::sun::star::uno::Type getInstanceType() const;
/// get the path where the template is located
- OUString getPathString() const;
+ rtl::OUString getPathString() const;
/// get the local name of the template
- Name getName() const { return m_aName; }
+ rtl::OUString getName() const { return m_aName; }
/// get the package name of the template
- Name getModule() const { return m_aModule; }
+ rtl::OUString getModule() const { return m_aModule; }
friend class TemplateImplHelper;
};
/// make a template instance that matches the elements of the given set. Ensures that the element type is known
- TemplateHolder makeSetElementTemplate(data::SetNodeAccess const& _aSet, TemplateProvider const& _aProvider);
+ rtl::Reference<Template> makeSetElementTemplate(sharable::SetNode * set, TemplateProvider const& _aProvider);
//-----------------------------------------------------------------------------
}
}
diff --git a/configmgr/source/inc/tree.hxx b/configmgr/source/inc/tree.hxx
new file mode 100644
index 0000000000..bad6b23e4e
--- /dev/null
+++ b/configmgr/source/inc/tree.hxx
@@ -0,0 +1,666 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile$
+ * $Revision$
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef CONFIGMGR_CONFIGNODEIMPL_HXX_
+#define CONFIGMGR_CONFIGNODEIMPL_HXX_
+
+#include "change.hxx"
+#include "configpath.hxx"
+#include "template.hxx"
+#include "utility.hxx"
+#include <rtl/ref.hxx>
+#include <salhelper/simplereferenceobject.hxx>
+#include <osl/diagnose.h>
+
+#ifndef INCLUDED_VECTOR
+#include <vector>
+#define INCLUDED_VECTOR
+#endif
+#ifndef INCLUDED_MAP
+#include <map>
+#define INCLUDED_MAP
+#endif
+#ifndef INCLUDED_MEMORY
+#include <memory>
+#define INCLUDED_MEMORY
+#endif
+
+namespace configmgr
+{
+ namespace node { struct Attributes; }
+ namespace sharable { union Node; }
+ namespace view { class ViewStrategy; }
+ namespace configuration
+ {
+//-----------------------------------------------------------------------------
+ class AnyNodeRef;
+ class ElementTree;
+ class GroupNodeImpl;
+ class NodeChange;
+ class NodeChanges;
+ class NodeImpl;
+ class NodeRef;
+ class SetNodeImpl;
+ class TemplateProvider;
+ class Tree;
+ class ValueElementNodeImpl;
+ class ValueMemberNode;
+ class ValueRef;
+//-----------------------------------------------------------------------------
+ // WARNING: a similar item is in noderef.hxx
+ const unsigned int c_TreeDepthAll = ~0u;
+
+//-----------------------------------------------------------------------------
+ inline
+ unsigned int& incDepth(unsigned int& rDepth)
+ {
+ if (rDepth != c_TreeDepthAll) ++rDepth;
+ return rDepth;
+ }
+
+ inline
+ unsigned int& decDepth(unsigned int& rDepth)
+ {
+ OSL_ENSURE(rDepth != 0,"Cannot decrement zero depth");
+ if (rDepth != c_TreeDepthAll && rDepth != 0) --rDepth;
+ return rDepth;
+ }
+
+ inline
+ unsigned int childDepth(unsigned int nDepth)
+ { return decDepth(nDepth); }
+
+ inline
+ unsigned int parentDepth(unsigned int nDepth)
+ { return incDepth(nDepth); }
+
+ inline
+ unsigned int remainingDepth(unsigned int nOuterDepth, unsigned int nRelativeDepth)
+ {
+ OSL_ENSURE(nRelativeDepth != c_TreeDepthAll,"RelativeDepth can't be infinite");
+ OSL_ENSURE(nRelativeDepth <= nOuterDepth,"ERROR: RelativeDepth is larger than enclosing depth");
+
+ unsigned int nInnerDepth = (nOuterDepth == c_TreeDepthAll) ? nOuterDepth :
+ (nRelativeDepth < nOuterDepth) ? nOuterDepth-nRelativeDepth :
+ 0;
+ return nInnerDepth;
+ }
+ //-------------------------------------------------------------------------
+
+ /// interface for a class that can be used to do some operation on a set of <type>NodeRef</type>s and <type>ValueRef</type>s.
+ struct NodeVisitor
+ {
+ /// returned from <method>handle</method> to indicate whether the operation is complete or should continue
+ enum Result { DONE, CONTINUE };
+ /// do the operation on <var>aNode</var>. needs to be implemented by concrete visitor classes
+ virtual Result handle(rtl::Reference< Tree > const& aTree, NodeRef const& aNode) = 0;
+ /// do the operation on <var>aValue</var>. needs to be implemented by concrete visitor classes
+ virtual Result handle(rtl::Reference< Tree > const& aTree, ValueRef const& aValue) = 0;
+ protected:
+ virtual ~NodeVisitor() {}
+ };
+//-----------------------------------------------------------------------------
+
+// class Node Impl
+//-----------------------------------------------------------------------------
+
+ /** is the Implementation class for class <type>Node</type>, held inside a <type>Tree</type>.
+ <p> Implements some functionality common to all node types.
+ </p>
+ <p> Otherwise it provides (not really typesafe) access to a
+ <type scope='configmgr::configuration::NodeType>NodeImpl</type> which implements
+ functionality for a node of a given type
+ (as given by a <type scope='configmgr::configuration::NodeType>Enum</type> value).
+ </p>
+ */
+ class NodeData
+ {
+ rtl::Reference<NodeImpl> m_pSpecificNode;
+ rtl::OUString m_aName_; // cached for better performance
+ unsigned int m_nParent;
+ public:
+ NodeData(rtl::Reference<NodeImpl> const& aSpecificNodeImpl, rtl::OUString const& aName, unsigned int nParent);
+
+ void rebuild(rtl::Reference<view::ViewStrategy> const& _xNewStrategy, sharable::Node * _aNewData);
+ // COMMON: information
+ rtl::OUString getName() const { return m_aName_; }
+ unsigned int getParent() const { return m_nParent; }
+
+ // change management
+ public:
+ // BASIC NODE: access to common attributes
+ NodeImpl & nodeImpl() { return implGetNodeImpl(); }
+ NodeImpl const & nodeImpl() const { return implGetNodeImpl(); }
+
+ // SET: access to child elements
+ bool isSetNode() const;
+ SetNodeImpl& setImpl() { return implGetSetImpl(); }
+ SetNodeImpl const& setImpl() const { return implGetSetImpl(); }
+
+ // VALUES: access to data
+ bool isValueElementNode() const;
+ ValueElementNodeImpl& valueElementImpl() { return implGetValueImpl(); }
+ ValueElementNodeImpl const& valueElementImpl() const { return implGetValueImpl(); }
+
+ // GROUP: access to children
+ bool isGroupNode() const;
+ GroupNodeImpl& groupImpl() { return implGetGroupImpl(); }
+ GroupNodeImpl const&groupImpl() const { return implGetGroupImpl(); }
+
+ // access helper
+ public:
+ sharable::Node * getOriginalNodeAccess() const;
+
+ private:
+ NodeImpl& implGetNodeImpl() const;
+ SetNodeImpl& implGetSetImpl() const;
+ GroupNodeImpl& implGetGroupImpl() const ;
+ ValueElementNodeImpl& implGetValueImpl() const ;
+ };
+//-----------------------------------------------------------------------------
+ /** represents a hierarchy of config entries (identified by <type>NodeRef</type>s and <type>ValueRef</type>s)
+
+ <p>Examples for trees include</p>
+ <ulist>
+ <li>A module tree (for a specific set of parameters).</li>
+ <li>An updating tree (for a part of the whole).</li>
+ <li>A set element (updating or not), which could be detached.</li>
+ <ulist>
+ <p> Holds a list of <type>Node</type> which it allows to access by
+ <type>unsigned int</type> (which is basically a one-based index).
+ </p>
+ <p> Also provides for navigation to the context this tree is located in
+ </p>
+ */
+ class Tree : public salhelper::SimpleReferenceObject
+ {
+ friend class view::ViewStrategy;
+ protected:
+ // Construction
+ /// creates a Tree for a detached, virgin tree
+ Tree( );
+
+ /// creates a Tree with a parent tree
+ Tree(Tree& rParentTree, unsigned int nParentNode);
+
+ virtual ~Tree() = 0;
+
+ /// fills this Tree starting from _aRootNode, using the given factory and the tree's template provider
+ void build(rtl::Reference<view::ViewStrategy> const& _xStrategy, sharable::Node * _aRootNode, unsigned int nDepth, TemplateProvider const& aTemplateProvider);
+
+ void rebuild(rtl::Reference<view::ViewStrategy> const& _xNewStrategy, sharable::Node * _aNewData);
+
+ public:
+ // realeses the data this refers to
+ virtual void disposeData();
+
+ // Context Access
+ /// gets the path to the root node of this tree
+ AbsolutePath getRootPath() const;
+ /// gets the tree of parent node of this tree
+ Tree* getContextTree() { return m_pParentTree; }
+ /// gets the tree of parent node of this tree
+ Tree const *getContextTree() const { return m_pParentTree; }
+ /// gets the offset of parent node of this tree within its tree
+ unsigned int getContextNode() const { return m_nParentNode; }
+
+ // Node Collection information
+ /// checks whether <var>nNode</var> is a valid node offset in this tree
+ bool isValidNode(unsigned int nNode) const;
+
+ bool isRootNode(NodeRef const & node) const;
+
+ NodeRef getRootNode() const;
+
+ NodeRef getContextNodeRef() const;
+
+ bool isValidValueNode(ValueRef const & value);
+
+ bool isValidAnyNode(AnyNodeRef const & node);
+
+ /// checks whether the node has any element nodes (of its own)
+ bool hasElements(NodeRef const & node);
+
+ bool hasElement(NodeRef const & node, rtl::OUString const & name);
+
+ bool hasElement(NodeRef const & node, Path::Component const & name);
+
+ /** gets the element with the given name of the given node
+ <p>PRE: <code>hasElement(node, name)</code></p>
+ <p>If there is no such element, may return an empty node or
+ raise an exception (?)</p>
+
+ @throws InvalidName
+ if name is not a valid child name for this node
+ */
+ rtl::Reference< ElementTree > getElement(
+ NodeRef const & node, rtl::OUString const & name);
+
+ /** gets the element with the given name of the given node, if it is
+ available
+ <p>PRE: <code>hasElement(node, name)</code></p>
+ <p>If there is no such element, may return an empty node or
+ raise an exception (?)</p>
+ <p>Caution: May miss existing children unless hasChild/getChild
+ has been called before.</p>
+
+ @throws InvalidName
+ if name is not a valid child name for this node
+ */
+ rtl::Reference< ElementTree > getAvailableElement(
+ NodeRef const & node, rtl::OUString const & name);
+
+ /// checks whether the node has any child nodes (in this tree)
+ bool hasChildren(NodeRef const & node);
+
+ bool hasChildValue(
+ NodeRef const & node, rtl::OUString const & name);
+
+ bool hasChildNode(NodeRef const & node, rtl::OUString const & name);
+
+ bool hasChild(NodeRef const & node, rtl::OUString const & name);
+
+ /** gets the child value (in this tree) with the given name of the
+ given node
+ <p>PRE: <code>hasChildValue(node, name)</code></p>
+ <P>If there is no such node, may return an empty node or raise
+ an exception (?)</p>
+
+ @throws InvalidName
+ if <var>aName</var> is not a valid child name for this node
+ */
+ ValueRef getChildValue(
+ NodeRef const & node, rtl::OUString const & name);
+
+ NodeRef getChildNode(
+ NodeRef const & node, rtl::OUString const & name);
+
+ AnyNodeRef getAnyChild(
+ NodeRef const& node, rtl::OUString const & name);
+
+ node::Attributes getAttributes(NodeRef const & node);
+
+ node::Attributes getAttributes(AnyNodeRef const & node);
+
+ node::Attributes getAttributes(ValueRef const & value);
+
+ com::sun::star::uno::Type getUnoType(ValueRef const & value);
+
+ /// return the parent of the given node (or an empty node, if it is
+ /// the tree root)
+ NodeRef getParent(NodeRef const & node);
+
+ /// return the parent of the given value (or an empty node, if it is
+ /// the tree root)
+ NodeRef getParent(ValueRef const & value);
+
+ AbsolutePath getAbsolutePath(NodeRef const & node);
+
+ /// retrieves the current value for the given node, provided there
+ /// is one and it is available (only works for value nodes)
+ com::sun::star::uno::Any getNodeValue(ValueRef const & value);
+
+ /// checks whether the given node has a default value (only works
+ /// for value nodes)
+ bool hasNodeDefault(ValueRef const & value);
+
+ /// checks whether the given node assumes its default value (only
+ /// works for value nodes)
+ bool isNodeDefault(ValueRef const & value);
+
+ /// checks whether the given node has a default state
+ bool hasNodeDefault(NodeRef const & node);
+
+ /// checks whether the given node assumes its default state
+ bool isNodeDefault(NodeRef const & node);
+
+ /// checks whether the given node has a default state
+ bool hasNodeDefault(AnyNodeRef const & node);
+
+ /// checks whether the given node assumes its default state
+ bool isNodeDefault(AnyNodeRef const & node);
+
+ /// checks whether the default values are available for the children
+ /// of the given node (if applicable)
+ bool areValueDefaultsAvailable(NodeRef const & node);
+
+ /// retrieves the default value for the given node, provided there
+ /// is one and it is available (only works for value nodes)
+ com::sun::star::uno::Any getNodeDefaultValue(
+ ValueRef const & value);
+
+ bool hasChanges();
+
+ /// lists any pending changes on this tree
+ bool collectChanges(NodeChanges & changes);
+
+ void integrate(
+ NodeChange & change, NodeRef const & node, bool local);
+
+ void integrate(
+ NodeChanges & changes, NodeRef const & node, bool local);
+
+ NodeVisitor::Result visit(
+ NodeRef const & node, NodeVisitor & visitor)
+ { return visitor.handle(this, node); }
+
+ NodeVisitor::Result visit(
+ ValueRef const & value, NodeVisitor & visitor)
+ { return visitor.handle(this, value); }
+
+ /** lets the given visitor visit the child nodes of the given node
+
+ The order in which nodes are visited is repeatable (but
+ currently unspecified). Visits nodes until NodeVisitor::DONE is
+ returned, then returns NodeVisitor::DONE. If all visits return
+ NodeVisitor::CONTINUE, returns NodeVisitor::CONTINUE. If no
+ children are present, returns NodeVisitor::CONTINUE.
+ */
+ NodeVisitor::Result dispatchToChildren(
+ NodeRef const & node, NodeVisitor & visitor);
+
+ NodeRef getNode(unsigned int offset) const;
+
+ rtl::Reference< Template > extractElementInfo(NodeRef const & node);
+
+ /// gets the depth that is available in this tree (due to the original request)
+ unsigned int getAvailableDepth() const { return m_nDepth; }
+
+ /// gets the depth that is available in this tree within the given node
+ unsigned int getRemainingDepth(unsigned int nNode) const
+ { return remainingDepth(getAvailableDepth(),depthTo(nNode)); }
+
+ // Node Collection navigation
+ /** gets the simple name of the node <var>nNode</var>
+ <p>PRE: <code>isValidNode(nNode)</code>
+ </p>
+ */
+ rtl::OUString getSimpleNodeName(unsigned int nNode) const;
+
+ /** gets the simple name of the root node (i.e. of the tree as a whole)
+ */
+ virtual rtl::OUString getSimpleRootName() const;
+
+ /** gets the full name of the root node
+ */
+ Path::Component getExtendedRootName() const;
+
+ /** gets the number of hierarchy levels from the root node to node <var>nNode</var>
+ in this tree
+ <p>In particular <code>depthTo(N) == 0</code> if <code>N == root()</code>
+ </p>
+ <p>PRE: <code>isValidNode(nNode)</code>
+ </p>
+ */
+ unsigned int depthTo(unsigned int nNode) const;
+
+ /// append the local path (relative to root) to a node to a collection of names
+ void prependLocalPathTo(unsigned int nNode, Path::Rep& rNames);
+
+ // check whether defaults are available
+ bool hasDefaults(unsigned int _nNode) const;
+ public:
+ enum { ROOT = 1 }; /// base of <type>unsigned int</type>s used in this class
+
+ /** gets the <type>unsigned int</type> of the parent node <var>nNode</var> in this tree
+ or 0 (zero) if it is the root node
+ <p>PRE: <code>isValidNode(nNode)</code>
+ </p>
+ */
+ unsigned int parent_(unsigned int nNode) const;
+
+ // Node iteration and access
+ /** gets the <type>unsigned int</type> of the first child node
+ of node <var>nParent</var> in this tree (in list order)
+ or 0 (zero) if it has no children in this tree
+ <p>PRE: <code>isValidNode(nParent)</code>
+ </p>
+ */
+ unsigned int firstChild_ (unsigned int nParent) const;
+
+ /** gets the <type>unsigned int</type> of the first child node
+ of node <var>nParent</var> that is after
+ node <var>nNode</var> in this tree (in list order)
+ or 0 (zero) if there is no such node
+ <p>if <code>nStartAfter == 0</code> searching starts at the beginning
+ </p>
+ <p>PRE: <code>isValidNode(nParent)</code>
+ </p>
+ <p>PRE: <code>isValidNode(nStartAfter) || nStartAfter == 0</code>
+ </p>
+ */
+ unsigned int findNextChild_(unsigned int nParent, unsigned int nStartAfter) const;
+
+ /** gets the <type>unsigned int</type> of the first (and only) child node
+ of node <var>nParent</var> in this tree (in list order)
+ where the name of the node is <var>aName</var>,
+ or 0 (zero) if there is no such node
+ <p>PRE: <code>isValidNode(nParent)</code>
+ </p>
+ */
+ unsigned int findChild_(unsigned int nParent, rtl::OUString const& aName) const;
+
+ // Node Collection access
+ /// get the number of nodes in this tree
+ unsigned int nodeCount() const;
+
+ /// get the <type>NodeData</type> for node <var>nNode</var> in this tree
+ NodeData* nodeData(unsigned int nNode);
+ /// get the <type>NodeData</type> for node <var>nNode</var> in this tree
+ NodeData const* nodeData(unsigned int nNode) const;
+ /// get the <type>NodeData</type> for node <var>nNode</var> in this tree
+ NodeImpl& nodeImpl(unsigned int nNode) { return nodeData(nNode)->nodeImpl(); }
+ /// get the <type>NodeData</type> for node <var>nNode</var> in this tree
+ NodeImpl const& nodeImpl(unsigned int nNode) const { return nodeData(nNode)->nodeImpl(); }
+
+ unsigned int nodeOffset(NodeData const & rNodeData) const;
+
+ // Behavior
+ rtl::Reference< view::ViewStrategy > getViewBehavior() const;
+ protected:
+ // immediate commit
+/* // implementation of commit protocol
+ void commitDirect();
+
+ void implCommitDirectFrom(unsigned int nNode);
+*/
+ void implRebuild(unsigned int nNode, sharable::Node * _aNewData);
+
+ protected:
+ /// set a new parent context for this tree
+ void setContext(Tree* pParentTree, unsigned int nParentNode);
+ /// set no-parent context for this tree
+ void clearContext();
+
+ inline // is protected and should be used only in the implementation
+ rtl::OUString implGetOriginalName(unsigned int nNode) const;
+
+ private:
+ /// get the full name of the root of this tree
+ virtual Path::Component doGetRootName() const = 0;
+
+ /// prepend the absolute path to the root of this tree (no context use)
+ virtual void doFinishRootPath(Path::Rep& rPath) const = 0;
+
+ ValueMemberNode getMemberNode(ValueRef const & value);
+
+ rtl::Reference<view::ViewStrategy> m_xStrategy;
+ std::vector<NodeData> m_aNodes;
+ Tree* m_pParentTree;
+ unsigned int m_nParentNode;
+ unsigned int m_nDepth;
+
+ /// prepend the absolute path to the root of this tree (using context if present)
+ void implPrependRootPath(Path::Rep& rPath) const;
+
+ friend class TreeImplBuilder;
+ };
+
+ /// checks, if tree represents a real tree
+ bool isEmpty(Tree * tree);
+//-----------------------------------------------------------------------------
+
+ class ElementTree : public Tree
+ {
+ public:
+
+ /// creates a Tree for a detached, virgin instance of <var>aTemplate</var> (always will be direct)
+ ElementTree(rtl::Reference< data::TreeSegment > const& _aElementData, rtl::Reference<Template> aTemplate, TemplateProvider const& aTemplateProvider );
+
+ /** creates a Tree with a parent tree, that (supposedly)
+ is an instance of <var>aTemplateInfo</var>
+ */
+ ElementTree(rtl::Reference<view::ViewStrategy> const& _xStrategy,
+ Tree& rParentTree, unsigned int nParentNode,
+ sharable::TreeFragment * dataTree, unsigned int nDepth,
+ rtl::Reference<Template> aTemplateInfo,
+ TemplateProvider const& aTemplateProvider );
+
+ /** creates a Tree with no parent node, that (supposedly)
+ is an instance of <var>aTemplateInfo</var>
+ */
+ ElementTree(rtl::Reference<view::ViewStrategy> const& _xStrategy,
+ sharable::TreeFragment * dataTree, unsigned int nDepth,
+ rtl::Reference<Template> aTemplateInfo,
+ TemplateProvider const& aTemplateProvider );
+
+ ~ElementTree();
+
+ // realeses the data this refers to
+ virtual void disposeData();
+
+ // rebuilding
+ using Tree::rebuild;
+ void rebuild(rtl::Reference<view::ViewStrategy> const& _xNewStrategy, sharable::TreeFragment * newData);
+
+ // data access
+ sharable::TreeFragment * getOriginalTreeAccess() const { return m_aDataAddress; }
+
+ // Tree information
+ virtual rtl::OUString getSimpleRootName() const;
+ /// checks whether this is an instance of a known template
+ bool isTemplateInstance() const { return !!m_aInstanceInfo.is(); }
+ /// checks whether this is an instance of the given template
+ bool isInstanceOf(rtl::Reference<Template> const& aTemplateInfo) const
+ { return m_aInstanceInfo == aTemplateInfo && aTemplateInfo.is(); }
+ /// retrieves the template that this is an instance of
+ rtl::Reference<Template> getTemplate() const { return m_aInstanceInfo; }
+ /// makes a complete name from a simple name and template information
+ Path::Component makeExtendedName(rtl::OUString const& aSimpleName) const;
+
+ // node control operation
+ /// check if this is a free-floating tree
+ bool isFree() const { return m_aOwnData.is(); }
+ /// transfer ownership to the given set
+ void attachTo(sharable::SetNode * updatableSetNode, rtl::OUString const& aElementName);
+ /// tranfer ownership from the given set
+ void detachFrom(sharable::SetNode * updatableSetNode, rtl::OUString const& aElementName);
+
+ /// take ownership of the given tree (which must not already be the one in use)
+ void takeTreeAndRebuild(rtl::Reference< data::TreeSegment > const& _aElementData);
+ /// take ownership of the given tree (which must already be the one in use)
+ void takeTreeBack(rtl::Reference< data::TreeSegment > const& _aElementData);
+
+ /// release ownership
+ rtl::Reference< data::TreeSegment > releaseOwnedTree();
+
+ // context operation
+ /// set a new root name
+ void renameTree(rtl::OUString const& aNewName);
+ /// set a new parent context for this tree
+ void moveTree(Tree* pParentTree, unsigned int nParentNode);
+ /// set no-parent context for this tree
+ void detachTree();
+
+ private:
+ static bool isUpdatableSegment(Tree& _rTree);
+
+ virtual Path::Component doGetRootName() const;
+
+ virtual void doFinishRootPath(Path::Rep& rPath) const;
+ private:
+ rtl::Reference<Template> const m_aInstanceInfo;
+ rtl::OUString m_aElementName;
+ sharable::TreeFragment * m_aDataAddress;
+ rtl::Reference< data::TreeSegment > m_aOwnData;
+ };
+//-----------------------------------------------------------------------------
+ inline
+ bool Tree::isValidNode(unsigned int nNode) const
+ {
+ return ROOT <= nNode && nNode < nodeCount() + ROOT;
+ }
+ //---------------------------------------------------------------------
+ inline
+ unsigned int Tree::nodeCount() const
+ {
+ return m_aNodes.size();
+ }
+ //---------------------------------------------------------------------
+ inline
+ NodeData* Tree::nodeData(unsigned int nNode)
+ {
+ if (nNode == 0) return NULL;
+ OSL_ASSERT(isValidNode(nNode));
+ return &m_aNodes[nNode - ROOT];
+ }
+ //---------------------------------------------------------------------
+ inline
+ NodeData const* Tree::nodeData(unsigned int nNode) const
+ {
+ if (nNode == 0) return NULL;
+ OSL_ASSERT(isValidNode(nNode));
+ return &m_aNodes[nNode - ROOT];
+ }
+ //---------------------------------------------------------------------
+ inline
+ unsigned int Tree::nodeOffset(NodeData const & rNode) const
+ {
+ unsigned int nOffset = ROOT + (&rNode - &m_aNodes[0]);
+ OSL_ASSERT(isValidNode(nOffset));
+ return nOffset;
+ }
+
+//-----------------------------------------------------------------------------
+// helper for other impl classes
+//-----------------------------------------------------------------------------
+#if OSL_DEBUG_LEVEL > 0
+ struct ElementHelper
+ {
+ static
+ com::sun::star::uno::Type getUnoType(rtl::Reference< ElementTree > const& aElement);
+ };
+#endif
+//-----------------------------------------------------------------------------
+ }
+//-----------------------------------------------------------------------------
+}
+
+#endif // CONFIGMGR_CONFIGNODEIMPL_HXX_
diff --git a/configmgr/source/inc/treeaccessor.hxx b/configmgr/source/inc/treeaccessor.hxx
deleted file mode 100644
index 50aa8c5406..0000000000
--- a/configmgr/source/inc/treeaccessor.hxx
+++ /dev/null
@@ -1,88 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: treeaccessor.hxx,v $
- * $Revision: 1.8 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef CONFIGMGR_TREEACCESSOR_HXX
-#define CONFIGMGR_TREEACCESSOR_HXX
-
-#include "nodeaccess.hxx"
-#include "treefragment.hxx"
-
-#ifndef INCLUDED_CSTDDEF
-#include <cstddef>
-#define INCLUDED_CSTDDEF
-#endif
-#include <builddata.hxx>
-
-namespace configmgr
-{
-// -----------------------------------------------------------------------------
-
-// -----------------------------------------------------------------------------
- namespace data
- {
- // -------------------------------------------------------------------------
- /** class that mediates access to the data of a tree fragment
- */
- class TreeAccessor
- {
- public:
- TreeAccessor(sharable::TreeFragment *_aTreeRef)
- : m_pTree(_aTreeRef) {}
- TreeAccessor(const sharable::TreeFragment * _pTree)
- : m_pTree((sharable::TreeFragment *)_pTree) {}
-
- inline configuration::Name getName() const
- { return configuration::makeName( m_pTree->getName(),
- configuration::Name::NoValidate() ); }
-
- NodeAccess getRootNode() const
- { return NodeAccess(m_pTree ? const_cast<sharable::Node *>(m_pTree->nodes) : NULL); }
-
- TreeAddress copyTree() const
- { return data::buildTree(*this); }
- static void freeTree(TreeAddress _aTree)
- { data::destroyTree(_aTree); }
-
- // make it look like a pointer ...
- operator sharable::TreeFragment *() const { return (sharable::TreeFragment *)m_pTree; }
- sharable::TreeFragment* operator->() const { return m_pTree; }
- bool operator == (sharable::TreeFragment *pTree) const { return pTree == m_pTree; }
- bool operator != (sharable::TreeFragment *pTree) const { return pTree != m_pTree; }
-
- private:
- TreeAddress m_pTree;
- };
- // -------------------------------------------------------------------------
- }
-// -----------------------------------------------------------------------------
-} // namespace configmgr
-
-#endif // CONFIGMGR_TREEACCESSOR_HXX
-
diff --git a/configmgr/source/inc/treeactions.hxx b/configmgr/source/inc/treeactions.hxx
index e025326c0d..7d60b78562 100644
--- a/configmgr/source/inc/treeactions.hxx
+++ b/configmgr/source/inc/treeactions.hxx
@@ -68,10 +68,7 @@ struct OChangeActionCounter : public ChangeTreeAction
class CollectNames : public NodeAction
{
public:
- typedef std::vector<OUString> NameList;
-
-public:
- NameList const& list() const { return aList; }
+ std::vector<rtl::OUString> const& list() const { return aList; }
CollectNames() : aList() {}
@@ -83,7 +80,7 @@ public:
aList.push_back(aNode.getName());
}
private:
- NameList aList;
+ std::vector<rtl::OUString> aList;
};
//..........................................................................
diff --git a/configmgr/source/inc/treechangefactory.hxx b/configmgr/source/inc/treechangefactory.hxx
index 036a0c5206..93a33c0b0d 100644
--- a/configmgr/source/inc/treechangefactory.hxx
+++ b/configmgr/source/inc/treechangefactory.hxx
@@ -45,39 +45,34 @@ namespace configmgr
namespace uno = ::com::sun::star::uno;
//==========================================================================
- namespace configuration { class Name;}
-
- //==========================================================================
class OTreeChangeFactory
{
public:
- typedef rtl::OUString Name;
- public:
//-----------------------------------------------
std::auto_ptr<SubtreeChange> createSetNodeChange(
- Name const& _aName,
- Name const& _aTemplateName,
- Name const& _aTemplateModule,
+ rtl::OUString const& _aName,
+ rtl::OUString const& _aTemplateName,
+ rtl::OUString const& _aTemplateModule,
node::Attributes _aAttrs,
bool _bToDefault = false);
//-----------------------------------------------
//= Set Changes ============================================================
std::auto_ptr<AddNode> createAddNodeChange(
- data::TreeSegment const & _aNewTree,
- Name const& _aName,
+ rtl::Reference< data::TreeSegment > const & _aNewTree,
+ rtl::OUString const& _aName,
bool _bToDefault = false);
//-----------------------------------------------
std::auto_ptr<RemoveNode> createRemoveNodeChange(
- Name const& _aName,
+ rtl::OUString const& _aName,
bool _bToDefault = false);
//= special case: Dummy ISubtree ============================================================
static std::auto_ptr<SubtreeChange> createDummyChange(
- configuration::Name const& _aName,
- configuration::Name const& _aElementTypeName);
+ rtl::OUString const& _aName,
+ rtl::OUString const& _aElementTypeName);
//-----------------------------------------------
};
@@ -101,10 +96,10 @@ namespace configmgr
{ return std::auto_ptr<Change>(pChange.release()); }
//==========================================================================
- bool isGenericSetElementType(OUString const& _aElementType);
- bool isDummySetElementModule(OUString const& _aElementModule);
- configuration::Name getGenericSetElementType();
- configuration::Name getDummySetElementModule();
+ bool isGenericSetElementType(rtl::OUString const& _aElementType);
+ bool isDummySetElementModule(rtl::OUString const& _aElementModule);
+ rtl::OUString getGenericSetElementType();
+ rtl::OUString getDummySetElementModule();
//==========================================================================
} // namespace configmgr
diff --git a/configmgr/source/inc/treechangelist.hxx b/configmgr/source/inc/treechangelist.hxx
index 7fa4ccdf74..5d291cb5f2 100644
--- a/configmgr/source/inc/treechangelist.hxx
+++ b/configmgr/source/inc/treechangelist.hxx
@@ -49,14 +49,10 @@ namespace configmgr
//==========================================================================
struct TreeChangeList
{
- typedef configuration::AbsolutePath AbsolutePath;
- typedef configuration::Name Name;
- typedef node::Attributes NodeAttributes;
-
TreeChangeList(const RequestOptions& _aOptions,
- const AbsolutePath& _rRootPath,
+ const configuration::AbsolutePath& _rRootPath,
const SubtreeChange& _aSubtree,
- SubtreeChange::DeepChildCopy _doDeepCopy)
+ treeop::DeepChildCopy _doDeepCopy)
: root(_aSubtree,_doDeepCopy)
, m_aLocation(_rRootPath)
, m_aOptions(_aOptions)
@@ -66,9 +62,9 @@ namespace configmgr
@param _rRootPath path to the root of the whole to-be-updated subtree
*/
TreeChangeList( const RequestOptions& _aOptions,
- const AbsolutePath& _rRootPath,
- const NodeAttributes& _rAttr = NodeAttributes())
- : root(_rRootPath.getLocalName().getName().toString(), _rAttr)
+ const configuration::AbsolutePath& _rRootPath,
+ const node::Attributes& _rAttr = node::Attributes())
+ : root(_rRootPath.getLocalName().getName(), _rAttr)
, m_aLocation(_rRootPath)
, m_aOptions(_aOptions)
{}
@@ -77,11 +73,11 @@ namespace configmgr
@param _rLocalName relative path within the to-be-updated subtree
*/
TreeChangeList( const RequestOptions& _aOptions,
- const AbsolutePath& _rRootPath,
- const Name& _rChildTemplateName,
- const Name& _rChildTemplateModule,
- const NodeAttributes& _rAttr = NodeAttributes())
- : root(_rRootPath.getLocalName().getName().toString(), _rChildTemplateName.toString(), _rChildTemplateModule.toString(), _rAttr)
+ const configuration::AbsolutePath& _rRootPath,
+ rtl::OUString const & _rChildTemplateName,
+ rtl::OUString const & _rChildTemplateModule,
+ const node::Attributes& _rAttr = node::Attributes())
+ : root(_rRootPath.getLocalName().getName(), _rChildTemplateName, _rChildTemplateModule, _rAttr)
, m_aLocation(_rRootPath)
, m_aOptions(_aOptions)
{}
@@ -89,7 +85,7 @@ namespace configmgr
/** ctor
@param _rTreeList list to initialize the path, no childs are copied
*/
- TreeChangeList( const TreeChangeList& _rTree, SubtreeChange::NoChildCopy _rNoCopy)
+ TreeChangeList( const TreeChangeList& _rTree, treeop::NoChildCopy _rNoCopy)
: root(_rTree.root, _rNoCopy)
, m_aLocation(_rTree.m_aLocation)
, m_aOptions(_rTree.m_aOptions)
@@ -99,24 +95,24 @@ namespace configmgr
bool isModuleRootChange() const { return m_aLocation.getDepth() <= 1; }
/// get the module these changes belong to
- Name getModuleName() const { return m_aLocation.getModuleName(); }
+ rtl::OUString getModuleName() const { return m_aLocation.getModuleName(); }
/// get the full path to the root (location + root-name)
- void setRootPath(const AbsolutePath& _rRootPath)
+ void setRootPath(const configuration::AbsolutePath& _rRootPath)
{ m_aLocation = _rRootPath; }
/// get the full path to the root (location + root-name)
- AbsolutePath const& getRootNodePath() const { return m_aLocation; }
+ configuration::AbsolutePath const& getRootNodePath() const { return m_aLocation; }
/// get the full path to the root (location)
- AbsolutePath getRootContextPath() const { return m_aLocation.getParentPath(); }
+ configuration::AbsolutePath getRootContextPath() const { return m_aLocation.getParentPath(); }
RequestOptions const & getOptions() const { return m_aOptions; }
public:
SubtreeChange root; // the root of the whole tree of updates
private:
- AbsolutePath m_aLocation; // absolute path to the parent of the node corresponding to this->root
+ configuration::AbsolutePath m_aLocation; // absolute path to the parent of the node corresponding to this->root
RequestOptions m_aOptions; // options for the tree that is concerned by these changes
};
//----------------------------------------------------------------------------
diff --git a/configmgr/source/inc/treefragment.hxx b/configmgr/source/inc/treefragment.hxx
index 3a9fedeef4..2430c3b7ab 100644
--- a/configmgr/source/inc/treefragment.hxx
+++ b/configmgr/source/inc/treefragment.hxx
@@ -31,7 +31,6 @@
#ifndef INCLUDED_SHARABLE_TREEFRAGMENT_HXX
#define INCLUDED_SHARABLE_TREEFRAGMENT_HXX
-#include "types.hxx"
#include "flags.hxx"
#include "node.hxx"
@@ -41,26 +40,24 @@ namespace configmgr
namespace sharable
{
//-----------------------------------------------------------------------------
- namespace State = data::State;
- //-----------------------------------------------------------------------------
/* a TreeFragment header is interpreted differently, depending on the kind of TreeFragment
- for a set element
- name points to the element name (the Name in the root node is the template name)
+ name points to the element name (the name in the root node is the template name)
parent points to the SetNode that is the parent. The containing treefragment can
be recovered from this with some care
next points to the next element of the same set. It is null for the last element.
state is fully used here
- for a template tree
- name points to the template name (same as the Name in the root node)
+ name points to the template name (same as the name in the root node)
component points to the home component name of the template
(often the same as 'component' in the component tree)
next points to another template TreeFragment. It is null for the last template.
state must be 'replaced' here (rarely it might be marked as mandatory)
- for a component tree
- name points to the component name (same as the Name in the root node)
+ name points to the component name (same as the name in the root node)
component is equal to name (or NULL ?)
next points to another template TreeFragment. It is null if there is no template.
state must be either 'defaulted' or 'merged'
@@ -69,14 +66,14 @@ namespace configmgr
struct TreeFragmentHeader
{
struct TreeFragment *next; // next sibling set element or template
- String name; // element-name/template name
+ rtl_uString * name; // element-name/template name
union // context
{
union Node *parent; // parent node
- String component; // component name
+ rtl_uString * component; // component name
};
- Offset count; // number of contained nodes
- State::Field state;
+ sal_uInt16 count; // number of contained nodes
+ sal_uInt8 state;
sal_uInt8 reserved;
};
//-----------------------------------------------------------------------------
@@ -125,17 +122,19 @@ namespace configmgr
bool isNamed(rtl::OUString const & _aName) const;
rtl::OUString getName() const;
+
+ void setName(rtl::OUString const & name);
+
configmgr::node::Attributes getAttributes()const;
+ Node * getRootNode() { return nodes; }
+
static TreeFragment *allocate(sal_uInt32 nFragments);
static void free_shallow( TreeFragment *pFragment );
};
//-----------------------------------------------------------------------------
}
- namespace data {
- typedef sharable::TreeFragment * TreeAddress;
- }
//-----------------------------------------------------------------------------
}
diff --git a/configmgr/source/inc/treemanager.hxx b/configmgr/source/inc/treemanager.hxx
index 68e845b3a5..d6609308a2 100644
--- a/configmgr/source/inc/treemanager.hxx
+++ b/configmgr/source/inc/treemanager.hxx
@@ -31,9 +31,11 @@
#ifndef CONFIGMGR_TREEMANAGER_HXX_
#define CONFIGMGR_TREEMANAGER_HXX_
-#include "treeprovider.hxx"
+#include <memory>
+
+#include "salhelper/simplereferenceobject.hxx"
+
#include "defaultprovider.hxx"
-#include "cacheddataprovider.hxx"
#include "confevents.hxx"
#include "options.hxx"
#include "autoreferencemap.hxx"
@@ -43,52 +45,49 @@ namespace configmgr
{
namespace uno = ::com::sun::star::uno;
+ namespace backend {
+ class CacheController;
+ class ComponentRequest;
+ class UpdateRequest;
+ }
+ namespace sharable {
+ struct TreeFragment;
+ union Node;
+ }
+
//==========================================================================
//= TreeManager
//==========================================================================
class CacheClientAccess;
class CacheData;
+ class ConfigChangeBroadcastHelper;
+ class ISubtree;
//==========================================================================
- class TreeManager : public IConfigTreeManager
- , public IConfigDefaultProvider
- , public IDefaultableTreeManager
- , private backend::ICachedDataListener
- , private ConfigChangeBroadcaster
- {
- typedef CacheClientAccess Cache;
- typedef rtl::Reference<Cache> CacheRef;
-
- typedef AutoReferenceMap< RequestOptions, Cache, lessRequestOptions> CacheList;
- typedef AutoObject< CacheData > TemplateCache;
-
- typedef backend::ICachedDataProvider BackendCache;
- typedef rtl::Reference< BackendCache > BackendCacheRef;
-
+ class TreeManager: public salhelper::SimpleReferenceObject {
+ typedef AutoReferenceMap< RequestOptions, CacheClientAccess, lessRequestOptions> CacheList;
+
osl::Mutex m_aCacheControllerMutex;
- BackendCacheRef m_xCacheController;
+ rtl::Reference< backend::CacheController > m_xCacheController;
- BackendCacheRef maybeGetBackendCache() CFG_NOTHROW( );
- BackendCacheRef getCacheLoader() CFG_UNO_THROW_RTE( );
- void disposeBackendCache() CFG_NOTHROW( );
+ rtl::Reference< backend::CacheController > maybeGetBackendCache() SAL_THROW(());
+ rtl::Reference< backend::CacheController > getCacheLoader() SAL_THROW((com::sun::star::uno::RuntimeException));
+ void disposeBackendCache() SAL_THROW(());
CacheList m_aCacheList; // Map
- TemplateCache m_aTemplates;
+ AutoObject< CacheData > m_aTemplates;
sal_Bool m_bEnableAsync;
- protected:
- // ref counted, that's why no public dtor
- ~TreeManager();
+ virtual ~TreeManager();
public:
/** ctor
*/
explicit
- TreeManager(BackendCacheRef const & _xBackend);
+ TreeManager(rtl::Reference< backend::CacheController > const & _xBackend);
// disposing the cache before destroying
void dispose();
- // ITreeManager
/** requests a node given by it's path. Basicly, this means
that the node is fetch from the cache when it contains it else it ask the server
system into it's cache.
@@ -96,75 +95,63 @@ namespace configmgr
@param _nMinLevels indicates how many tree levels under the node determined by <arg>_rSubtreePath</arg>
should be loaded
*/
- virtual data::NodeAccess requestSubtree(AbsolutePath const& _rSubtreePath,
+ sharable::Node * requestSubtree(configuration::AbsolutePath const& _rSubtreePath,
RequestOptions const& _aOptions
- ) CFG_UNO_THROW_ALL( );
+ ) SAL_THROW((com::sun::star::uno::Exception));
- virtual void updateTree(TreeChangeList& aChanges) CFG_UNO_THROW_ALL( );
+ void updateTree(TreeChangeList& aChanges) SAL_THROW((com::sun::star::uno::Exception));
- virtual void saveAndNotifyUpdate(TreeChangeList const& aChanges) CFG_UNO_THROW_ALL( );
+ void saveAndNotifyUpdate(TreeChangeList const& aChanges) SAL_THROW((com::sun::star::uno::Exception));
- virtual void releaseSubtree(AbsolutePath const& aSubtreePath,
- RequestOptions const& _aOptions ) CFG_NOTHROW();
+ void releaseSubtree(configuration::AbsolutePath const& aSubtreePath,
+ RequestOptions const& _aOptions ) SAL_THROW(());
- virtual void disposeData(const RequestOptions& _aOptions) CFG_NOTHROW();
+ void fetchSubtree( configuration::AbsolutePath const& aSubtreePath,
+ RequestOptions const& _xOptions
+ ) SAL_THROW(());
- virtual void fetchSubtree( AbsolutePath const& aSubtreePath,
- RequestOptions const& _xOptions
- ) CFG_NOTHROW();
+ void refreshAll() SAL_THROW((com::sun::star::uno::Exception));
+ void flushAll() SAL_THROW(());
+ void enableAsync(const sal_Bool& bEnableAsync) SAL_THROW(()) ;
- virtual void refreshAll() CFG_UNO_THROW_ALL( );
- virtual void flushAll() CFG_NOTHROW();
- virtual void enableAsync(const sal_Bool& bEnableAsync) CFG_NOTHROW() ;
-
- // IDefaultableTreeManager
- virtual sal_Bool fetchDefaultData( AbsolutePath const& aSubtreePath,
+ sal_Bool fetchDefaultData( configuration::AbsolutePath const& aSubtreePath,
RequestOptions const& _aOptions
- ) CFG_UNO_THROW_ALL( );
+ ) SAL_THROW((com::sun::star::uno::Exception));
- // IDefaultProvider
- virtual std::auto_ptr<ISubtree> requestDefaultData(AbsolutePath const& aSubtreePath,
+ std::auto_ptr<ISubtree> requestDefaultData(configuration::AbsolutePath const& aSubtreePath,
const RequestOptions& _aOptions
- ) CFG_UNO_THROW_ALL( );
- // ITemplateManager
- virtual data::TreeAccessor requestTemplate( Name const& aName, Name const& aModule
- ) CFG_UNO_THROW_ALL( );
-
- IConfigBroadcaster* getBroadcaster() { return this; }
-
+ ) SAL_THROW((com::sun::star::uno::Exception));
+ sharable::TreeFragment * requestTemplate( rtl::OUString const& aName, rtl::OUString const& aModule
+ ) SAL_THROW((com::sun::star::uno::Exception));
+
// implementation interfaces
- void refreshSubtree(const AbsolutePath &_aAbsoluteSubtreePath,
- const RequestOptions& _aOptions) CFG_UNO_THROW_ALL( );
+ void refreshSubtree(const configuration::AbsolutePath &_aAbsoluteSubtreePath,
+ const RequestOptions& _aOptions) SAL_THROW((com::sun::star::uno::Exception));
-
-
+ void addListener(configuration::AbsolutePath const& aName, const RequestOptions& _aOptions, rtl::Reference<INodeListener> const& pListener);
+ void removeListener(const RequestOptions& _aOptions, rtl::Reference<INodeListener> const& pListener);
+
+ void disposing(backend::CacheController & _rProvider) SAL_THROW(());
+ void componentCreated(backend::ComponentRequest const & _aComponent) SAL_THROW(());
+ void componentChanged(backend::UpdateRequest const & _anUpdate) SAL_THROW(());
+
private:
CacheData & getTemplates() { return * m_aTemplates.get(); }
- AbsolutePath encodeTemplateLocation(const Name& _rLogicalTemplateName, const Name &_rModule);
-
- void fireChanges(TreeChangeList const& aChangeTree, sal_Bool _bError);
+ configuration::AbsolutePath encodeTemplateLocation(rtl::OUString const & _rLogicalTemplateName, rtl::OUString const &_rModule);
private:
- CacheRef getCacheAlways(RequestOptions const & _aOptions);
+ rtl::Reference<CacheClientAccess> getCacheAlways(RequestOptions const & _aOptions);
// disposing
void disposeAll();
- void disposeOne(RequestOptions const & _aOptions);
- void disposeUser(RequestOptions const & _aUserOptions);
- void implDisposeOne(CacheRef const & _aCache, RequestOptions const & _aOptions);
- // ConfigChangeBroadcaster
- virtual ConfigChangeBroadcastHelper* getBroadcastHelper(RequestOptions const& _aOptions, bool bCreate);
+ void fireChanges(TreeChangeList const& _aChanges, sal_Bool _bError);
+ ConfigChangeBroadcastHelper* getBroadcastHelper(RequestOptions const& _aOptions, bool bCreate);
+ void disposeBroadcastHelper(ConfigChangeBroadcastHelper* pHelper);
- // former INotifyListener
void nodeUpdated(TreeChangeList& _rChanges);
-
- // ICachedDataListener
- virtual void disposing(backend::ICachedDataProvider & _rProvider) CFG_NOTHROW();
- virtual void componentCreated(backend::ComponentRequest const & _aComponent) CFG_NOTHROW();
- virtual void componentChanged(backend::UpdateRequest const & _anUpdate) CFG_NOTHROW();
};
}
diff --git a/configmgr/source/inc/treenodefactory.hxx b/configmgr/source/inc/treenodefactory.hxx
index 5b3104eebb..06d8791587 100644
--- a/configmgr/source/inc/treenodefactory.hxx
+++ b/configmgr/source/inc/treenodefactory.hxx
@@ -46,15 +46,10 @@ namespace configmgr
namespace uno = ::com::sun::star::uno;
//==========================================================================
- namespace configuration { class Name;}
-
- //==========================================================================
class OTreeNodeFactory
{
public:
- typedef configuration::Name Name;
- public:
//= ValueNodes ============================================================
std::auto_ptr<ValueNode> createValueNode(
rtl::OUString const& aName,
diff --git a/configmgr/source/inc/treeprovider.hxx b/configmgr/source/inc/treeprovider.hxx
deleted file mode 100644
index 2ed80e3e67..0000000000
--- a/configmgr/source/inc/treeprovider.hxx
+++ /dev/null
@@ -1,187 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: treeprovider.hxx,v $
- * $Revision: 1.23 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-/* PLEASE DON'T DELETE ANY COMMENT LINES, ALSO IT'S UNNECESSARY. */
-
-
-#ifndef CONFIGMGR_TREEPROVIDER_HXX
-#define CONFIGMGR_TREEPROVIDER_HXX
-
-#include "commontypes.hxx"
-#include "valuenode.hxx"
-#include "utility.hxx"
-#include <com/sun/star/uno/Exception.hpp>
-#include <com/sun/star/uno/RuntimeException.hpp>
-
-#ifndef INCLUDED_MEMORY
-#include <memory>
-#define INCLUDED_MEMORY
-#endif
-
-
-namespace configmgr
-{
-
- namespace uno = com::sun::star::uno;
- using ::rtl::OUString;
-
-////////////////////////////////////////////////////////////////////////////////
- namespace configuration
- {
- class Name;
- class AbsolutePath;
- }
- //-------------------------
- namespace data
- {
- class NodeAccess;
- class TreeAccessor;
- }
- //-------------------------
- class ISubtree;
- struct TreeChangeList;
-
- class RequestOptions;
-
- //==========================================================================
- //= ITreeManager
- //==========================================================================
- // a TreeProvider which can notify changes that were done, and manages the lifetime of subtrees
-
- class SAL_NO_VTABLE ITreeManager
- {
- public:
- typedef configuration::AbsolutePath AbsolutePath;
-
- /** request that the tree named by a path is added to the collection of managed trees
- respecting certain options and requiring a specific loading depth.
- Return a reference to that managed tree.
- The reference must later be released by calling releaseSubtree with the same path and options.
- */
- virtual data::NodeAccess requestSubtree(AbsolutePath const& aSubtreePath,
- const RequestOptions& _aOptions) CFG_UNO_THROW_ALL( ) = 0;
-
- /** request that the tree named by a path is added to the collection of managed trees
- respecting certain options and requiring a specific loading depth.
- */
- virtual void fetchSubtree(AbsolutePath const& aSubtreePath,
- const RequestOptions& _aOptions) CFG_NOTHROW() = 0;
-
- /// update the managed data according to a changes list - update the changes list accordingly with old values
- virtual void updateTree(TreeChangeList& aChanges) CFG_UNO_THROW_ALL( ) = 0;
-
- // notification
- virtual void saveAndNotifyUpdate(TreeChangeList const& aChanges ) CFG_UNO_THROW_ALL( ) = 0;
-
- // bookkeeping support
- virtual void releaseSubtree(AbsolutePath const& aSubtreePath,
- const RequestOptions& _aOptions ) CFG_NOTHROW() = 0;
-
- /** data for the given options may not be used any more
- <p>all clients of such data must be disposed</p>
- <p>If the locale is not set, the whole user has become invalid</p>
- */
- virtual void disposeData(const RequestOptions& _aOptions) CFG_NOTHROW() = 0;
-
- //Refresh all components in the cache
- virtual void refreshAll()CFG_UNO_THROW_ALL() = 0;
-
- //Flush all components in the cache
- virtual void flushAll()CFG_NOTHROW() = 0;
-
- //Enable/Disable Asynchronous write-back to cache
- virtual void enableAsync(const sal_Bool& bEnableAsync) CFG_NOTHROW() = 0;
- };
-
-
- //==========================================================================
- //= ITemplateProvider
- //==========================================================================
- struct SAL_NO_VTABLE ITemplateProvider
- {
- typedef configuration::Name Name;
-
- virtual ::std::auto_ptr<INode> loadTemplate(
- Name const& aName, Name const& aModule,
- const RequestOptions& _aOptions
- ) CFG_UNO_THROW_ALL( ) = 0;
-
- };
-
- //==========================================================================
- //= ITemplateManager
- //==========================================================================
- class SAL_NO_VTABLE ITemplateManager
- {
- public:
- typedef configuration::Name Name;
-
- virtual data::TreeAccessor requestTemplate(
- Name const& aName, Name const& aModule
- ) CFG_UNO_THROW_ALL( ) = 0;
-
- };
-
-////////////////////////////////////////////////////////////////////////////////
-
- //==========================================================================
- //= INotifyListener
- //==========================================================================
- /** a listener on configuration nodes. able to receive all changes in one or more
- specific registry sub trees.
- */
- struct SAL_NO_VTABLE INotifyListener : public IInterface
- {
- /** called whenever another session modified a node which the listener is registered for
- @param _rChanges The list of changes for a node.
- */
- virtual void nodeUpdated(TreeChangeList& _rChanges) = 0;
- };
-
- //==========================================================================
- /// a refcounted TemplateManager
- struct SAL_NO_VTABLE IConfigTemplateManager
- : public Refcounted
- , public ITemplateManager
- {};
-
- //==========================================================================
- /// a complete combined TreeManager
- struct SAL_NO_VTABLE IConfigTreeManager
- : public IConfigTemplateManager
- , public ITreeManager
- {};
-
-
- //==========================================================================
-} // namespace configmgr
-
-#endif
-
diff --git a/configmgr/source/inc/treesegment.hxx b/configmgr/source/inc/treesegment.hxx
index 55d51f8007..ca8769c82a 100644
--- a/configmgr/source/inc/treesegment.hxx
+++ b/configmgr/source/inc/treesegment.hxx
@@ -1,7 +1,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2008 by Sun Microsystems, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -28,94 +28,49 @@
*
************************************************************************/
-#ifndef CONFIGMGR_TREESEGMENT_HXX
-#define CONFIGMGR_TREESEGMENT_HXX
+#ifndef INCLUDED_CONFIGMGR_SOURCE_INC_TREESEGMENT_HXX
+#define INCLUDED_CONFIGMGR_SOURCE_INC_TREESEGMENT_HXX
+
+#include "sal/config.h"
-#include "valuenode.hxx"
-#include <rtl/ref.hxx>
-#include "treefragment.hxx"
-#ifndef INCLUDED_MEMORY
#include <memory>
-#define INCLUDED_MEMORY
-#endif // INCLUDED_MEMORY
+#include "rtl/ref.hxx"
+#include "salhelper/simplereferenceobject.hxx"
-// -----------------------------------------------------------------------------
namespace rtl { class OUString; }
-// -----------------------------------------------------------------------------
-namespace configmgr
-{
-// -----------------------------------------------------------------------------
- class INode; // for RawTreeData
- namespace sharable { struct TreeFragment; union Node; } // for TreeData (sharable)
-// -----------------------------------------------------------------------------
- namespace configuration { class Name; }
- // -------------------------------------------------------------------------
- namespace data
- {
- // -------------------------------------------------------------------------
- class TreeAccessor;
- // -------------------------------------------------------------------------
- class TreeSegment
- {
- struct Impl;
- rtl::Reference<Impl> m_pImpl;
- public:
- typedef configuration::Name Name;
- typedef std::auto_ptr<INode> RawTreeData;
- typedef rtl::OUString RawName;
-
- typedef sharable::Node const * NodeDataPtr;
- typedef sharable::TreeFragment const * TreeDataPtr;
- typedef sharable::TreeFragment * TreeDataUpdatePtr;
-
- static TreeSegment createNew(RawTreeData _aTree, RawName const & _aTypeName)
- { return createNewSegment(_aTree,_aTypeName); }
- static TreeSegment createNew(RawName const & _aTreeName, RawTreeData _aTree)
- { return createNewSegment(_aTreeName, _aTree); }
+namespace configmgr {
+ class INode;
+ namespace sharable { struct TreeFragment; }
- static TreeSegment createNew(TreeAccessor const & _aTree)
- { return createNewSegment(_aTree); }
-
- TreeSegment();
- TreeSegment(TreeSegment const & );
- TreeSegment& operator=(TreeSegment const & );
- ~TreeSegment();
-
- TreeSegment cloneSegment() const;
+ namespace data {
+ // rtl::Reference< TreeSegment > is a reference counted
+ // sharable::TreeFragment *. A null reference is always modeled as an
+ // empty rtl::Reference< TreeSegment >, never as a null fragment.
+ class TreeSegment: public salhelper::SimpleReferenceObject {
+ public:
+ static rtl::Reference< TreeSegment > create(
+ std::auto_ptr< INode > tree, rtl::OUString const & type);
- bool is() const;
- void clear();
+ static rtl::Reference< TreeSegment > create(
+ rtl::OUString const & name, std::auto_ptr< INode > tree);
- Name getName() const;
- void setName(Name const & _aNewName);
- void markRemovable();
+ static rtl::Reference< TreeSegment > create(
+ sharable::TreeFragment * tree);
- TreeAddress getBaseAddress() const;
- TreeAccessor getTreeAccess() const;
+ static rtl::Reference< TreeSegment > create(
+ rtl::Reference< TreeSegment > const & tree)
+ { return create(tree.is() ? tree->fragment : 0); }
- // RawTreeData releaseData();
- void clearData() { clear(); }
- RawTreeData cloneData(bool bUseTreeName) const;
+ sharable::TreeFragment * const fragment; // non-null
- TreeDataPtr getTreeData() const;
- NodeDataPtr getSegmentRootNode() const;
private:
- TreeDataUpdatePtr getTreeDataForUpdate() const;
+ TreeSegment(sharable::TreeFragment * tree);
- private:
- bool hasData() const { return !!m_pImpl.is(); }
- static Impl* createNewSegment(RawName const & _aTreeName, RawTreeData& _aTree);
- static Impl* createNewSegment(RawTreeData& _aTree, RawName const & _aTypeName);
- static Impl* createNewSegment(TreeAccessor const & _aTree);
- TreeSegment(Impl *);
+ virtual ~TreeSegment();
};
-
- // -------------------------------------------------------------------------
}
-// -----------------------------------------------------------------------------
-} // namespace configmgr
-
-#endif // CONFIGMGR_SEGMENT_HXX
+}
+#endif
diff --git a/configmgr/source/inc/typeconverter.hxx b/configmgr/source/inc/typeconverter.hxx
index aa0f27166f..a4d0b1505d 100644
--- a/configmgr/source/inc/typeconverter.hxx
+++ b/configmgr/source/inc/typeconverter.hxx
@@ -52,10 +52,10 @@ namespace configmgr
uno::Any toAny( const uno::Reference< script::XTypeConverter >& xTypeConverter,
const ::rtl::OUString& _rValue,
const uno::TypeClass& _rTypeClass)
- CFG_UNO_THROW1( script::CannotConvertException );
+ SAL_THROW((script::CannotConvertException , com::sun::star::uno::RuntimeException));
rtl::OUString toString(const uno::Reference< script::XTypeConverter >& xTypeConverter, const uno::Any& rValue)
- CFG_UNO_THROW1( script::CannotConvertException );
+ SAL_THROW((script::CannotConvertException , com::sun::star::uno::RuntimeException));
// Type conversion
::rtl::OUString toTypeName(const uno::TypeClass& _rTypeClass);
diff --git a/configmgr/source/inc/types.hxx b/configmgr/source/inc/types.hxx
deleted file mode 100644
index 18d382f2ad..0000000000
--- a/configmgr/source/inc/types.hxx
+++ /dev/null
@@ -1,81 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: types.hxx,v $
- * $Revision: 1.6 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public 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_SHARABLE_BASETYPES_HXX
-#define INCLUDED_SHARABLE_BASETYPES_HXX
-
-#include <sal/types.h>
-#include <rtl/ustring.hxx>
-
-//-----------------------------------------------------------------------------
-namespace rtl { class OUString; }
-//-----------------------------------------------------------------------------
-
-namespace configmgr
-{
- namespace sharable
- {
- //-----------------------------------------------------------------------------
- // some base types
- typedef sal_uInt16 Offset; // Offset relative to 'this' in array of nodes
-
- // some derived types
- typedef rtl_uString * Name;
- typedef rtl_uString * String;
- typedef struct TreeFragment * List; // singly linked intrusive, used for set elements
- typedef sal_uInt8 * Vector; // points to counted sequence of some type
-
- //-----------------------------------------------------------------------------
-
- inline String allocString(::rtl::OUString const & _sString)
- {
- rtl_uString_acquire(_sString.pData);
- return _sString.pData;
- }
- inline void freeString(String _aString)
- { rtl_uString_release(_aString); }
- inline ::rtl::OUString readString(String _aString)
- { return rtl::OUString(_aString); }
-
- //-----------------------------------------------------------------------------
-
- inline Name allocName(::rtl::OUString const & _aName)
- { return allocString(_aName); }
- inline void freeName(Name _aName)
- { freeString(_aName); }
- inline ::rtl::OUString readName(Name _aName)
- { return readString(_aName); }
-
- //-----------------------------------------------------------------------------
- }
-//-----------------------------------------------------------------------------
-}
-
-#endif // INCLUDED_SHARABLE_BASETYPES_HXX
diff --git a/configmgr/source/inc/updatehelper.hxx b/configmgr/source/inc/updatehelper.hxx
index 5bfaa005c7..24bc378167 100644
--- a/configmgr/source/inc/updatehelper.hxx
+++ b/configmgr/source/inc/updatehelper.hxx
@@ -33,26 +33,17 @@
#include "change.hxx"
-#include "nodeaccess.hxx"
-
-//..........................................................................
-namespace configmgr
-{
-//..........................................................................
+namespace configmgr {
+ namespace sharable { union Node; }
// apply a already matching set of changes to the target tree
- void applyUpdateToTree(SubtreeChange& _anUpdateTree, data::NodeAddress _aRootNode);
+ void applyUpdateToTree(SubtreeChange& _anUpdateTree, sharable::Node * _aRootNode);
// apply a set of changes to the target tree
- void applyUpdateWithAdjustmentToTree(SubtreeChange& _anUpdateTree, data::NodeAddress _aRootNode);
+ void applyUpdateWithAdjustmentToTree(SubtreeChange& _anUpdateTree, sharable::Node * _aRootNode);
// apply a set of changes to the target tree, return true, if there are changes found
- bool createUpdateFromDifference(SubtreeChange& _rResultingUpdateTree, data::NodeAccess const & _aExistingData, ISubtree const & _aNewData);
-
-//..........................................................................
-} // namespace configmgr
-//..........................................................................
-
-#endif // CONFIGMGR_MERGEHELPER_HXX
-
+ bool createUpdateFromDifference(SubtreeChange& _rResultingUpdateTree, sharable::Node * existingData, ISubtree const & _aNewData);
+}
+#endif
diff --git a/configmgr/source/inc/utility.hxx b/configmgr/source/inc/utility.hxx
index cb4f5e45d6..8549747040 100644
--- a/configmgr/source/inc/utility.hxx
+++ b/configmgr/source/inc/utility.hxx
@@ -1,7 +1,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2008 by Sun Microsystems, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -28,105 +28,26 @@
*
************************************************************************/
-#ifndef CONFIGMGR_UTILITY_HXX_
-#define CONFIGMGR_UTILITY_HXX_
-#if defined(_MSC_VER) && (_MSC_VER >= 1400)
-#pragma warning(disable : 4350) // behavior change: 'member1' called instead of 'member2'
-#endif
-
-#include <com/sun/star/uno/RuntimeException.hpp>
-#include <salhelper/simplereferenceobject.hxx>
-#include "datalock.hxx"
-
-#include "osl/diagnose.h"
-
-#define CFG_NOTHROW() SAL_THROW( () )
-
-#define CFG_THROW1( Ex1 ) SAL_THROW( (Ex1) )
-#define CFG_THROW2( Ex1,Ex2 ) SAL_THROW( (Ex1,Ex2) )
-#define CFG_THROW3( Ex1,Ex2,Ex3 ) SAL_THROW( (Ex1,Ex2,Ex3) )
-#define CFG_THROW4( Ex1,Ex2,Ex3,Ex4 ) SAL_THROW( (Ex1,Ex2,Ex3,Ex4) )
-#define CFG_THROW5( Ex1,Ex2,Ex3,Ex4,Ex5 ) SAL_THROW( (Ex1,Ex2,Ex3,Ex4,Ex5) )
-#define CFG_THROW6( Ex1,Ex2,Ex3,Ex4,Ex5,Ex6 ) SAL_THROW( (Ex1,Ex2,Ex3,Ex4,Ex5,Ex6) )
-
-#define CFG_UNO_THROW1( Ex1 ) \
- SAL_THROW( (::com::sun::star::Ex1, \
- ::com::sun::star::uno::RuntimeException) )
-
-#define CFG_UNO_THROW2( Ex1,Ex2 ) \
- SAL_THROW( (::com::sun::star::Ex1, ::com::sun::star::Ex2, \
- ::com::sun::star::uno::RuntimeException) )
+#ifndef INCLUDED_CONFIGMGR_SOURCE_INC_UTILITY_HXX
+#define INCLUDED_CONFIGMGR_SOURCE_INC_UTILITY_HXX
-#define CFG_UNO_THROW3( Ex1,Ex2,Ex3 ) \
- SAL_THROW( (::com::sun::star::Ex1, ::com::sun::star::Ex2, ::com::sun::star::Ex3, \
- ::com::sun::star::uno::RuntimeException) )
+#include "sal/config.h"
-#define CFG_UNO_THROW4( Ex1,Ex2,Ex3,Ex4 ) \
- SAL_THROW( (::com::sun::star::Ex1, ::com::sun::star::Ex2, ::com::sun::star::Ex3, \
- ::com::sun::star::Ex4, \
- ::com::sun::star::uno::RuntimeException) )
+#include "rtl/ustring.h"
+#include "rtl/ustring.hxx"
-#define CFG_UNO_THROW5( Ex1,Ex2,Ex3,Ex4,Ex5 ) \
- SAL_THROW( (::com::sun::star::Ex1, ::com::sun::star::Ex2, ::com::sun::star::Ex3, \
- ::com::sun::star::Ex4, ::com::sun::star::Ex5, \
- ::com::sun::star::uno::RuntimeException) )
-
-#define CFG_UNO_THROW6( Ex1,Ex2,Ex3,Ex4,Ex5,Ex6 ) \
- SAL_THROW( (::com::sun::star::Ex1, ::com::sun::star::Ex2, ::com::sun::star::Ex3, \
- ::com::sun::star::Ex4, ::com::sun::star::Ex5, ::com::sun::star::Ex6, \
- ::com::sun::star::uno::RuntimeException) )
-
-#define CFG_UNO_THROW_ALL( ) CFG_UNO_THROW1(uno::Exception)
-#define CFG_UNO_THROW_RTE( ) CFG_UNO_THROW1(uno::RuntimeException)
-
-namespace configmgr
-{
- class Noncopyable
- {
- protected:
- Noncopyable() {}
- ~Noncopyable() {}
- private:
- Noncopyable (Noncopyable& notImplemented);
- void operator= (Noncopyable& notImplemented);
- };
-
- // Used for internal, non-UNO objects
- class SimpleReferenceObject
- {
- public:
- inline SimpleReferenceObject() SAL_THROW(()): m_nCount(0) {}
-#define SIMPLE_REFERENCE_FAST
-#ifdef SIMPLE_REFERENCE_FAST
- inline void acquire() SAL_THROW(())
- {
-// OSL_ASSERT(UnoApiLock::isHeld());
- m_nCount++;
- }
- inline void release() SAL_THROW(())
- {
-// OSL_ASSERT(UnoApiLock::isHeld());
- if (--m_nCount == 0)
- delete this;
- }
-#else
- void acquire() SAL_THROW(());
- void release() SAL_THROW(());
+#if defined _MSC_VER && _MSC_VER >= 1400
+#pragma warning(disable: 4350)
+ // behavior change: 'member1' called instead of 'member2'
#endif
- protected:
- virtual ~SimpleReferenceObject() SAL_THROW(());
- private:
- sal_uInt32 m_nCount;
- // not implemented:
- SimpleReferenceObject(SimpleReferenceObject &);
- void operator =(SimpleReferenceObject);
- };
+namespace configmgr {
- struct Refcounted : virtual configmgr::SimpleReferenceObject
- {
- };
-}
+ inline rtl_uString * acquireString(rtl::OUString const & string) {
+ rtl_uString_acquire(string.pData);
+ return string.pData;
+ }
-#endif // CONFIGMGR_UTILITY_HXX_
+}
+#endif
diff --git a/configmgr/source/inc/valuenode.hxx b/configmgr/source/inc/valuenode.hxx
index db4a4f74cc..b2645b504c 100644
--- a/configmgr/source/inc/valuenode.hxx
+++ b/configmgr/source/inc/valuenode.hxx
@@ -35,7 +35,6 @@
#include "anypair.hxx"
#include <com/sun/star/uno/Any.h>
#include <rtl/ustring.hxx>
-#include "rttimacros.hxx"
#include <string.h>
#ifndef INCLUDED_MEMORY
@@ -53,8 +52,6 @@ namespace configmgr
class ISubtree;
class ValueNode;
- using rtl::OUString;
-
// helper (tag) class
namespace treeop { struct NoChildCopy {}; struct DeepChildCopy {}; enum { ALL_LEVELS = -1 }; }
//==========================================================================
@@ -84,7 +81,7 @@ namespace configmgr
class INode
{
- OUString m_aName;
+ rtl::OUString m_aName;
node::Attributes m_aAttributes;
protected:
@@ -96,14 +93,14 @@ namespace configmgr
}
public:
explicit
- INode(OUString const& aName, node::Attributes);
+ INode(rtl::OUString const& aName, node::Attributes);
virtual ~INode();
virtual std::auto_ptr<INode> clone() const = 0;
public:
- const OUString& getName() const { return m_aName; }
+ const rtl::OUString& getName() const { return m_aName; }
node::Attributes getAttributes() const { return m_aAttributes; }
bool isDefault() const { return m_aAttributes.isDefault(); }
@@ -117,7 +114,7 @@ namespace configmgr
// to be used with caution. If the node is referenced from somewhere else under it's old name,
// you may have problems with this inconsistence
- void setName(const OUString& _rNewName) { m_aName = _rNewName; }
+ void setName(const rtl::OUString& _rNewName) { m_aName = _rNewName; }
virtual ValueNode* asValueNode();
virtual ValueNode const* asValueNode() const;
@@ -127,9 +124,6 @@ namespace configmgr
// double dispatch support
virtual void dispatch(NodeAction&) const = 0;
virtual void dispatch(NodeModification&) = 0;
-
- // "rtti"
- RTTI_BASE(INode);
};
// -----------------------------------------------------------------------------
@@ -141,11 +135,11 @@ namespace configmgr
{
sal_Int16 m_nLevel; /// determines if everything is read
sal_Int16 m_nDefaultLevels; /// determines if defaults are read
- OUString m_sId;
- OUString m_sTemplateName; /// path of the template for child instantiation
- OUString m_sTemplateModule; /// module of the template for child instantiation
+ rtl::OUString m_sId;
+ rtl::OUString m_sTemplateName; /// path of the template for child instantiation
+ rtl::OUString m_sTemplateModule; /// module of the template for child instantiation
- virtual INode* doGetChild(OUString const& name) const = 0;
+ virtual INode* doGetChild(rtl::OUString const& name) const = 0;
protected:
ISubtree():m_nLevel(0){}
@@ -178,8 +172,8 @@ namespace configmgr
,m_sTemplateName(_rTemplateName)
,m_sTemplateModule(_rTemplateModule){}
- INode* getChild(OUString const& name) { return doGetChild(name); }
- INode const* getChild(OUString const& name) const { return doGetChild(name); }
+ INode* getChild(rtl::OUString const& name) { return doGetChild(name); }
+ INode const* getChild(rtl::OUString const& name) const { return doGetChild(name); }
ISubtree* asISubtree();
ISubtree const* asISubtree() const;
@@ -192,11 +186,11 @@ namespace configmgr
bool isSetNode() const { return m_sTemplateName.getLength() != 0; }
- void makeSetNode(OUString const& _sTemplateName, OUString const& _sTemplateModule)
+ void makeSetNode(rtl::OUString const& _sTemplateName, rtl::OUString const& _sTemplateModule)
{ m_sTemplateName = _sTemplateName; m_sTemplateModule = _sTemplateModule; }
- OUString const& getElementTemplateName() const { return m_sTemplateName; }
- OUString const& getElementTemplateModule() const { return m_sTemplateModule; }
+ rtl::OUString const& getElementTemplateName() const { return m_sTemplateName; }
+ rtl::OUString const& getElementTemplateModule() const { return m_sTemplateModule; }
virtual INode* addChild(std::auto_ptr<INode> node) =0; // takes ownership
virtual ::std::auto_ptr<INode> removeChild(rtl::OUString const& name) =0; // releases ownership
@@ -208,9 +202,6 @@ namespace configmgr
// double dispatch support
virtual void dispatch(NodeAction& anAction) const { anAction.handle(*this); }
virtual void dispatch(NodeModification& anAction) { anAction.handle(*this); }
-
- // "rtti"
- RTTI(ISubtree, INode);
};
//==========================================================================
@@ -229,22 +220,22 @@ namespace configmgr
//explicit ValueNode(node::Attributes _aAttrs):INode(_aAttrs){}
/*
- ValueNode(OUString const& aName, node::Attributes _aAttrs)
+ ValueNode(rtl::OUString const& aName, node::Attributes _aAttrs)
: INode(aName, _aAttrs)
, m_aValuePair()
{}
*/
- ValueNode(OUString const& aName,uno::Type const& aType, node::Attributes _aAttrs)
+ ValueNode(rtl::OUString const& aName,uno::Type const& aType, node::Attributes _aAttrs)
: INode(aName, _aAttrs)
, m_aValuePair(aType)
{
}
- ValueNode(OUString const& aName,uno::Any const& anAny, node::Attributes _aAttrs)
+ ValueNode(rtl::OUString const& aName,uno::Any const& anAny, node::Attributes _aAttrs)
: INode(aName, _aAttrs)
, m_aValuePair(anAny, selectMember(_aAttrs.isDefault()))
{
}
- ValueNode(OUString const& aName,uno::Any const& anAny,uno::Any const& aDefault, node::Attributes _aAttrs)
+ ValueNode(rtl::OUString const& aName,uno::Any const& anAny,uno::Any const& aDefault, node::Attributes _aAttrs)
: INode(aName, _aAttrs)
, m_aValuePair(anAny, aDefault)
{
@@ -276,8 +267,6 @@ namespace configmgr
virtual void dispatch(NodeAction& anAction) const { anAction.handle(*this); }
virtual void dispatch(NodeModification& anAction) { anAction.handle(*this); }
- // "rtti"
- RTTI(ValueNode, INode);
private:
static AnyPair::SelectMember selectValue() { return AnyPair::SELECT_FIRST; }
static AnyPair::SelectMember selectDeflt() { return AnyPair::SELECT_SECOND; }
diff --git a/configmgr/source/inc/valuenodeaccess.hxx b/configmgr/source/inc/valuenodeaccess.hxx
deleted file mode 100644
index 54301f9c61..0000000000
--- a/configmgr/source/inc/valuenodeaccess.hxx
+++ /dev/null
@@ -1,128 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: valuenodeaccess.hxx,v $
- * $Revision: 1.8 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef CONFIGMGR_VALUENODEACCESS_HXX
-#define CONFIGMGR_VALUENODEACCESS_HXX
-
-#include "nodeaccess.hxx"
-
-namespace configmgr
-{
-// -----------------------------------------------------------------------------
- namespace data
- {
- // -------------------------------------------------------------------------
- class ValueNodeAccess
- {
- public:
- ValueNodeAccess(const sharable::ValueNode *_pNodeRef)
- : m_pData(((sharable::Node *)_pNodeRef)->valueData()) {}
-
- explicit
- ValueNodeAccess(NodeAccess const & _aNode)
- : m_pData(check(_aNode)) {}
-
- static bool isInstance(NodeAccess const & _aNode)
- {
- return check(_aNode) != NULL;
- }
-
- bool isValid() const { return m_pData != NULL; }
-
- configuration::Name getName() const;
- node::Attributes getAttributes() const;
-
- bool isNull() const { return data().isNull(); }
- bool isDefault() const;
- bool isLocalized() const;
-
- bool hasUsableDefault() const { return data().hasUsableDefault(); }
-
- uno::Type getValueType() const { return data().getValueType(); }
- uno::Any getValue() const;
- uno::Any getUserValue() const;
- uno::Any getDefaultValue() const;
-
- static void setValue(ValueNodeAddress _aValueNode, uno::Any const& _aValue);
- static void setToDefault(ValueNodeAddress _aValueNode);
- static void changeDefault(ValueNodeAddress _aValueNode, uno::Any const& _aValue);
-
- sharable::ValueNode& data() const { return *m_pData; }
- operator ValueNodeAddress () const { return (ValueNodeAddress)m_pData; }
-
- operator NodeAccess() const { return NodeAccess(NodeAddress(m_pData)); }
- bool operator == (const NodeAddress &rAddr) const { return NodeAddress(m_pData) == rAddr; }
- bool operator == (const ValueNodeAddress &rAddr) const { return m_pData == rAddr; }
- private:
- static ValueNodeAddress check(sharable::Node *pNode)
- { return pNode ? const_cast<ValueNodeAddress>(pNode->valueData()) : NULL; }
- static ValueNodeAddress check(NodeAccess const&aRef)
- { return check(static_cast<sharable::Node *>(aRef)); }
-
- ValueNodeAddress m_pData;
- };
-
- // -------------------------------------------------------------------------
-
- inline
- configuration::Name ValueNodeAccess::getName() const
- { return NodeAccess::wrapName( data().info.getName() ); }
-
- inline
- node::Attributes ValueNodeAccess::getAttributes() const
- { return sharable::node(data()).getAttributes(); }
-
- inline
- bool ValueNodeAccess::isDefault() const
- { return data().info.isDefault(); }
-
- inline
- bool ValueNodeAccess::isLocalized() const
- { return data().info.isLocalized(); }
-
- inline
- uno::Any ValueNodeAccess::getValue() const
- { return data().getValue(); }
-
- inline
- uno::Any ValueNodeAccess::getUserValue() const
- { return data().getUserValue(); }
-
- inline
- uno::Any ValueNodeAccess::getDefaultValue() const
- { return data().getDefaultValue(); }
-
- // -------------------------------------------------------------------------
- }
-// -----------------------------------------------------------------------------
-} // namespace configmgr
-
-#endif // CONFIGMGR_VALUENODEACCESS_HXX
-
diff --git a/configmgr/source/inc/valueref.hxx b/configmgr/source/inc/valueref.hxx
index e7240f8391..a9c06782d9 100644
--- a/configmgr/source/inc/valueref.hxx
+++ b/configmgr/source/inc/valueref.hxx
@@ -40,18 +40,7 @@ namespace configmgr
namespace configuration
{
//-------------------------------------------------------------------------
- class Name;
- //-------------------------------------------------------------------------
-
- namespace argument { struct NoValidate; }
-
- typedef com::sun::star::uno::Type UnoType;
- typedef com::sun::star::uno::Any UnoAny;
- //-------------------------------------------------------------------------
-
- class TreeImpl;
-
- typedef unsigned int NodeOffset;
+ class Tree;
//-------------------------------------------------------------------------
/// represents a value node in some tree
@@ -61,6 +50,8 @@ namespace configmgr
/// constructs an empty (invalid) node
ValueRef();
+ ValueRef(rtl::OUString const& aName, unsigned int nParentPos);
+
/// copy a node (with reference semantics)
ValueRef(ValueRef const& rOther);
/// copy a node (with reference semantics)
@@ -73,23 +64,18 @@ namespace configmgr
/// checks, if this represents an existing node
inline bool isValid() const;
- private:
- friend class Tree;
- friend class TreeImplHelper;
- ValueRef(Name const& aName, NodeOffset nParentPos);
-
bool checkValidState() const;
- private:
- Name m_sNodeName;
- NodeOffset m_nParentPos;
+
+ rtl::OUString m_sNodeName;
+ unsigned int m_nParentPos;
};
//-------------------------------------------------------------------------
/** extract the value from a plain value
*/
inline
- UnoAny getSimpleValue(Tree const& aTree, ValueRef const& aNode)
- { return aTree.getNodeValue( aNode ); }
+ com::sun::star::uno::Any getSimpleValue(rtl::Reference< Tree > const& aTree, ValueRef const& aNode)
+ { return aTree->getNodeValue( aNode ); }
//-------------------------------------------------------------------------
inline bool ValueRef::isValid() const
@@ -104,8 +90,8 @@ namespace configmgr
{
public:
static SubNodeID createEmpty() { return SubNodeID(); }
- SubNodeID(TreeRef const& rTree, NodeRef const& rParentNode, Name const& aName);
- SubNodeID(NodeID const& rParentNodeID, Name const& aName);
+ SubNodeID(rtl::Reference< Tree > const& rTree, NodeRef const& rParentNode, rtl::OUString const& aName);
+ SubNodeID(NodeID const& rParentNodeID, rtl::OUString const& aName);
// comparison
// equality
@@ -120,17 +106,15 @@ namespace configmgr
// containing node this
NodeID getParentID() const { return m_aParentID; }
// containing node this
- Name getNodeName() const { return m_sNodeName; }
+ rtl::OUString getNodeName() const { return m_sNodeName; }
private:
SubNodeID(); // create an empty one
- friend class TreeImplHelper;
- Name m_sNodeName;
+ rtl::OUString m_sNodeName;
NodeID m_aParentID;
};
//-------------------------------------------------------------------------
- typedef std::vector<SubNodeID> SubNodeIDList;
- void getAllChildrenHelper(NodeID const& aNode, SubNodeIDList& aList);
+ void getAllChildrenHelper(NodeID const& aNode, std::vector<SubNodeID>& aList);
//-------------------------------------------------------------------------
inline bool operator!=(SubNodeID const& lhs, SubNodeID const& rhs)
diff --git a/configmgr/source/inc/valuetypeconverter.hxx b/configmgr/source/inc/valuetypeconverter.hxx
index 607126b098..097f1a6c3f 100644
--- a/configmgr/source/inc/valuetypeconverter.hxx
+++ b/configmgr/source/inc/valuetypeconverter.hxx
@@ -45,7 +45,6 @@ namespace configmgr
{
namespace uno = ::com::sun::star::uno;
namespace script = ::com::sun::star::script;
- using rtl::OUString;
// -----------------------------------------------------------------------------
class ValueConverter
@@ -54,11 +53,9 @@ namespace configmgr
uno::Reference< script::XTypeConverter > m_xTypeConverter;
/// Value info
uno::Type m_aType;
- OUString m_sSeparator;
+ rtl::OUString m_sSeparator;
bool m_bNull;
public:
- typedef std::vector< OUString > StringList;
- public:
/// construct a value converter with no initial type info
ValueConverter(const uno::Reference< script::XTypeConverter > & _xTC)
: m_xTypeConverter(_xTC)
@@ -76,7 +73,7 @@ namespace configmgr
}
/// provide access to the TypeConverter that is used for converting string format
- uno::Reference< script::XTypeConverter > const& getTypeConverter() const CFG_NOTHROW()
+ uno::Reference< script::XTypeConverter > const& getTypeConverter() const SAL_THROW(())
{
return m_xTypeConverter;
}
@@ -101,7 +98,7 @@ namespace configmgr
}
/// set the separator of this converter
- void setSeparator(OUString const & _aSeparator)
+ void setSeparator(rtl::OUString const & _aSeparator)
{
m_sSeparator = _aSeparator;
}
@@ -122,35 +119,35 @@ namespace configmgr
bool hasSeparator() const { return m_sSeparator.getLength() != 0; }
/// converting a value
- uno::Any convertToAny(OUString const& aContent) const
- CFG_UNO_THROW1( script::CannotConvertException );
+ uno::Any convertToAny(rtl::OUString const& aContent) const
+ SAL_THROW((script::CannotConvertException , com::sun::star::uno::RuntimeException));
/// converting a list
- uno::Any convertListToAny(uno::Sequence< OUString > const& aContentList) const
- CFG_UNO_THROW1( script::CannotConvertException );
+ uno::Any convertListToAny(uno::Sequence< rtl::OUString > const& aContentList) const
+ SAL_THROW((script::CannotConvertException , com::sun::star::uno::RuntimeException));
/// converting a binary value
- uno::Sequence<sal_Int8> parseBinary(OUString const& aBinaryString) const
- CFG_UNO_THROW1( script::CannotConvertException );
+ uno::Sequence<sal_Int8> parseBinary(rtl::OUString const& aBinaryString) const
+ SAL_THROW((script::CannotConvertException , com::sun::star::uno::RuntimeException));
/// splits a string list
- uno::Sequence< OUString > splitStringList(OUString const& aContent) const;
+ uno::Sequence< rtl::OUString > splitStringList(rtl::OUString const& aContent) const;
private:
/// converting a list
- bool convertListToAny(StringList const& aContentList, uno::Any& rValue) const
- CFG_UNO_THROW1( script::CannotConvertException );
+ bool convertListToAny(std::vector< rtl::OUString > const& aContentList, uno::Any& rValue) const
+ SAL_THROW((script::CannotConvertException , com::sun::star::uno::RuntimeException));
/// converting a scalar value
- bool convertScalarToAny(OUString const& aContent, uno::Any& rValue) const
- CFG_UNO_THROW1( script::CannotConvertException );
+ bool convertScalarToAny(rtl::OUString const& aContent, uno::Any& rValue) const
+ SAL_THROW((script::CannotConvertException , com::sun::star::uno::RuntimeException));
/// splitting a string list
- void splitListData(OUString const& aContent, StringList& rContentList) const
- CFG_NOTHROW( );
+ void splitListData(rtl::OUString const& aContent, std::vector< rtl::OUString >& rContentList) const
+ SAL_THROW(());
private:
- void implReset() CFG_NOTHROW()
+ void implReset() SAL_THROW(())
{
- m_sSeparator = OUString();
+ m_sSeparator = rtl::OUString();
m_bNull = false;
}
};
diff --git a/configmgr/source/localbe/localdataimportsvc.cxx b/configmgr/source/localbe/localdataimportsvc.cxx
index c76f9e370e..ee562a94f3 100644
--- a/configmgr/source/localbe/localdataimportsvc.cxx
+++ b/configmgr/source/localbe/localdataimportsvc.cxx
@@ -53,7 +53,7 @@ namespace configmgr
namespace backend = ::com::sun::star::configuration::backend;
// -----------------------------------------------------------------------------
-AsciiServiceName const aLocalDataImportServices[] =
+sal_Char const * const aLocalDataImportServices[] =
{
"com.sun.star.configuration.backend.LocalDataImporter",
0,
@@ -80,18 +80,18 @@ ServiceInfoHelper LocalDataImportService::getServiceInfo()
// -----------------------------------------------------------------------------
uno::Reference< uno::XInterface > SAL_CALL instantiateLocalDataImporter
-( CreationContext const& xContext )
+( uno::Reference< uno::XComponentContext > const& xContext )
{
return * new LocalDataImportService( xContext );
}
// -----------------------------------------------------------------------------
-LocalDataImportService::LocalDataImportService(CreationArg _xContext)
+LocalDataImportService::LocalDataImportService(uno::Reference< uno::XComponentContext > const & _xContext)
: m_xServiceFactory(_xContext->getServiceManager(), uno::UNO_QUERY)
{
if (!m_xServiceFactory.is())
{
- OUString sMessage = OUSTRING("Configuration Importer: Context has no service manager (or interface is missing)");
+ rtl::OUString sMessage = OUSTRING("Configuration Importer: Context has no service manager (or interface is missing)");
throw lang::NullPointerException(sMessage,NULL);
}
}
@@ -108,11 +108,11 @@ namespace
{
explicit JobDesc(task::XJob * pJob, const uno::Sequence< beans::NamedValue >& aArguments);
- OUString aLayerDataUrl;
- OUString aImporterService;
+ rtl::OUString aLayerDataUrl;
+ rtl::OUString aImporterService;
- OUString aComponent;
- OUString aEntity;
+ rtl::OUString aComponent;
+ rtl::OUString aEntity;
uno::Reference< backend::XLayer > xLayerFilter;
@@ -143,7 +143,7 @@ namespace
if (sal_Int32(nCount) != aArguments.getLength())
{
- OUString sMessage = OUSTRING("Too many arguments for LocalDataImporter Job");
+ rtl::OUString sMessage = OUSTRING("Too many arguments for LocalDataImporter Job");
throw lang::IllegalArgumentException(sMessage,pJob,0);
}
@@ -243,7 +243,7 @@ uno::Any SAL_CALL
{
JobDesc const aJob(this,Arguments);
- ServiceFactory aFactory = this->getServiceFactory();
+ uno::Reference< lang::XMultiServiceFactory > aFactory = this->getServiceFactory();
uno::Reference< backend::XLayer > xLayer = aJob.use_component ?
LocalSingleBackend::createSimpleLayer(aFactory,aJob.aLayerDataUrl, aJob.aComponent ):
@@ -251,7 +251,7 @@ uno::Any SAL_CALL
if (!xLayer.is())
{
- OUString sMessage = OUSTRING("LocalDataImportService - Cannot create layer to import from");
+ rtl::OUString sMessage = OUSTRING("LocalDataImportService - Cannot create layer to import from");
throw lang::NullPointerException(sMessage,*this);
}
@@ -259,7 +259,7 @@ uno::Any SAL_CALL
if (xFilterInit.is())
{
beans::NamedValue argvalue(
- OUString( RTL_CONSTASCII_USTRINGPARAM("Source") ),
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Source") ),
uno::makeAny( xLayer) );
uno::Sequence< uno::Any > args(1);
@@ -296,7 +296,7 @@ uno::Any SAL_CALL
if (!xImporter.is())
{
- OUString sMessage = OUSTRING("LocalDataImportService - Cannot create importer service: ") + aJob.aImporterService;
+ rtl::OUString sMessage = OUSTRING("LocalDataImportService - Cannot create importer service: ") + aJob.aImporterService;
throw lang::NullPointerException(sMessage,*this);
}
@@ -325,7 +325,7 @@ uno::Any SAL_CALL
// XServiceInfo
-OUString SAL_CALL
+rtl::OUString SAL_CALL
LocalDataImportService::getImplementationName( )
throw (uno::RuntimeException)
{
@@ -335,7 +335,7 @@ OUString SAL_CALL
sal_Bool SAL_CALL
- LocalDataImportService::supportsService( const OUString& ServiceName )
+ LocalDataImportService::supportsService( const rtl::OUString& ServiceName )
throw (uno::RuntimeException)
{
return getServiceInfo().supportsService( ServiceName );
diff --git a/configmgr/source/localbe/localdataimportsvc.hxx b/configmgr/source/localbe/localdataimportsvc.hxx
index 8da5fa4a53..187e6703e4 100644
--- a/configmgr/source/localbe/localdataimportsvc.hxx
+++ b/configmgr/source/localbe/localdataimportsvc.hxx
@@ -46,7 +46,6 @@ namespace configmgr
namespace localbe
{
// -----------------------------------------------------------------------------
- using rtl::OUString;
namespace uno = ::com::sun::star::uno;
namespace lang = ::com::sun::star::lang;
namespace task = ::com::sun::star::task;
@@ -59,22 +58,20 @@ namespace configmgr
>
{
public:
- typedef uno::Reference< uno::XComponentContext > const & CreationArg;
-
explicit
- LocalDataImportService(CreationArg _xContext);
+ LocalDataImportService(uno::Reference< uno::XComponentContext > const & _xContext);
~LocalDataImportService();
// XServiceInfo
- virtual OUString SAL_CALL
+ virtual rtl::OUString SAL_CALL
getImplementationName( )
throw (uno::RuntimeException);
virtual sal_Bool SAL_CALL
- supportsService( const OUString& ServiceName )
+ supportsService( const rtl::OUString& ServiceName )
throw (uno::RuntimeException);
- virtual uno::Sequence< OUString > SAL_CALL
+ virtual uno::Sequence< rtl::OUString > SAL_CALL
getSupportedServiceNames( )
throw (uno::RuntimeException);
@@ -84,13 +81,11 @@ namespace configmgr
throw (lang::IllegalArgumentException, uno::Exception, uno::RuntimeException);
protected:
- typedef uno::Reference< lang::XMultiServiceFactory > ServiceFactory;
-
- ServiceFactory getServiceFactory() const
+ uno::Reference< lang::XMultiServiceFactory > getServiceFactory() const
{ return m_xServiceFactory; }
private:
- ServiceFactory m_xServiceFactory;
+ uno::Reference< lang::XMultiServiceFactory > m_xServiceFactory;
static ServiceInfoHelper getServiceInfo();
};
diff --git a/configmgr/source/localbe/localfilehelper.cxx b/configmgr/source/localbe/localfilehelper.cxx
index 0c921a415e..6d8e9762c0 100644
--- a/configmgr/source/localbe/localfilehelper.cxx
+++ b/configmgr/source/localbe/localfilehelper.cxx
@@ -44,10 +44,8 @@ namespace configmgr
//------------------------------------------------------------------------------
bool isValidFileURL (rtl::OUString const& _sFileURL)
{
- using osl::File;
-
rtl::OUString sSystemPath;
- return _sFileURL.getLength() && (File::E_None == File::getSystemPathFromFileURL(_sFileURL, sSystemPath));
+ return _sFileURL.getLength() && (osl::File::E_None == osl::File::getSystemPathFromFileURL(_sFileURL, sSystemPath));
}
//------------------------------------------------------------------------------
void validateFileURL(const rtl::OUString& _sFileURL, const uno::Reference<uno::XInterface>& pContext)
@@ -95,13 +93,11 @@ namespace configmgr
// ---------------------------------------------------------------------------------------
bool implEnsureAbsoluteURL(rtl::OUString & _rsURL) // also strips embedded dots etc.
{
- using osl::File;
-
rtl::OUString sBasePath;
OSL_VERIFY(tools::getProcessWorkingDir(&sBasePath));
rtl::OUString sAbsolute;
- if ( File::E_None == File::getAbsoluteFileURL(sBasePath, _rsURL, sAbsolute))
+ if ( osl::File::E_None == osl::File::getAbsoluteFileURL(sBasePath, _rsURL, sAbsolute))
{
_rsURL = sAbsolute;
return true;
@@ -115,24 +111,22 @@ namespace configmgr
// ---------------------------------------------------------------------------------------
osl::DirectoryItem::RC implNormalizeURL(rtl::OUString & _sURL, osl::DirectoryItem& aDirItem)
{
- using namespace osl;
-
OSL_PRECOND(aDirItem.is(), "Opened DirItem required");
static const sal_uInt32 cFileStatusMask = FileStatusMask_FileURL;
- FileStatus aFileStatus(cFileStatusMask);
+ osl::FileStatus aFileStatus(cFileStatusMask);
- DirectoryItem::RC rc = aDirItem.getFileStatus(aFileStatus);
+ osl::DirectoryItem::RC rc = aDirItem.getFileStatus(aFileStatus);
- if (rc == DirectoryItem::E_None)
+ if (rc == osl::DirectoryItem::E_None)
{
rtl::OUString aNormalizedURL = aFileStatus.getFileURL();
if (aNormalizedURL.getLength() != 0)
_sURL = aNormalizedURL;
else
- rc = DirectoryItem::E_INVAL;
+ rc = osl::DirectoryItem::E_INVAL;
}
return rc;
}
@@ -142,26 +136,23 @@ namespace configmgr
bool normalizeURL(rtl::OUString & _sURL, const uno::Reference<uno::XInterface>& pContext, bool bNothrow )
throw (backend::InsufficientAccessRightsException, backend::BackendAccessException)
{
-
- using namespace osl;
-
if (_sURL.getLength() == 0)
return false;
- DirectoryItem aDirItem;
+ osl::DirectoryItem aDirItem;
- DirectoryItem::RC rc = DirectoryItem::get(_sURL, aDirItem);
+ osl::DirectoryItem::RC rc = osl::DirectoryItem::get(_sURL, aDirItem);
- if (rc == DirectoryItem::E_None)
+ if (rc == osl::DirectoryItem::E_None)
rc = implNormalizeURL(_sURL,aDirItem);
switch (rc)
{
- case DirectoryItem::E_None: return true;
+ case osl::DirectoryItem::E_None: return true;
- case DirectoryItem::E_NOENT: return true;
+ case osl::DirectoryItem::E_NOENT: return true;
- case DirectoryItem::E_ACCES:
+ case osl::DirectoryItem::E_ACCES:
if (!bNothrow)
{
rtl::OUStringBuffer msg;
diff --git a/configmgr/source/localbe/localfilehelper.hxx b/configmgr/source/localbe/localfilehelper.hxx
index bc82088719..f042150933 100644
--- a/configmgr/source/localbe/localfilehelper.hxx
+++ b/configmgr/source/localbe/localfilehelper.hxx
@@ -90,7 +90,7 @@ namespace configmgr
/**
Convert Component name to Path name
- @param aComponent Component Name
+ @param aComponent Component name
*/
rtl::OUString componentToPath(const rtl::OUString& aComponent);
diff --git a/configmgr/source/localbe/localfilelayer.cxx b/configmgr/source/localbe/localfilelayer.cxx
index 75977d11d4..f3470c5f77 100644
--- a/configmgr/source/localbe/localfilelayer.cxx
+++ b/configmgr/source/localbe/localfilelayer.cxx
@@ -98,7 +98,7 @@ BasicCompositeLocalFileLayer::BasicCompositeLocalFileLayer(
CompositeLocalFileLayer::CompositeLocalFileLayer(
const uno::Reference<lang::XMultiServiceFactory>& xFactory,
const rtl::OUString& aComponent,
- const SubLayerFiles& aSublayerDirectories)
+ const std::vector<rtl::OUString>& aSublayerDirectories)
: BasicCompositeLocalFileLayer(xFactory,rtl::OUString())
{
fillSubLayerLists(aSublayerDirectories, aComponent) ;
@@ -109,7 +109,7 @@ FullCompositeLocalFileLayer::FullCompositeLocalFileLayer(
const uno::Reference<lang::XMultiServiceFactory>& xFactory,
const rtl::OUString& aBaseDir,
const rtl::OUString& aComponent,
- const SubLayerFiles& aSublayerDirectories)
+ const std::vector<rtl::OUString>& aSublayerDirectories)
: BasicCompositeLocalFileLayer(xFactory,aBaseDir + aComponent)
, mLayerWriter( createLayerWriter() )
{
@@ -436,7 +436,7 @@ rtl::OUString FullCompositeLocalFileLayer::getTimestamp()
{
rtl::OUString sStamp = BasicLocalFileLayer::getTimestamp(getFileUrl());
#if 0 // thus far composite layers are only manipulated via the main layer
- for (SubLayerFiles::const_iterator it = mSubLayerFiles.begin();
+ for (std::vector<rtl::OUString>::const_iterator it = mSubLayerFiles.begin();
it != mSubLayerFiles.end();
++it)
{
@@ -449,14 +449,14 @@ rtl::OUString FullCompositeLocalFileLayer::getTimestamp()
}
//------------------------------------------------------------------------------
-void BasicCompositeLocalFileLayer::fillSubLayerLists( const SubLayerFiles& aSublayerDirectories,
+void BasicCompositeLocalFileLayer::fillSubLayerLists( const std::vector<rtl::OUString>& aSublayerDirectories,
const rtl::OUString& aComponent)
{
- SubLayerFiles::size_type const nSublayerCount = aSublayerDirectories.size();
+ std::vector<rtl::OUString>::size_type const nSublayerCount = aSublayerDirectories.size();
mSubLayers.realloc(nSublayerCount);
mSubLayerFiles.resize(nSublayerCount);
- for (SubLayerFiles::size_type i = 0; i < nSublayerCount; ++i)
+ for (std::vector<rtl::OUString>::size_type i = 0; i < nSublayerCount; ++i)
{
mSubLayers[i] = FileHelper::getFileName(aSublayerDirectories[i]);
@@ -474,7 +474,7 @@ void BasicCompositeLocalFileLayer::fillSubLayerLists( const SubLayerFiles& aSubl
//------------------------------------------------------------------------------
static bool findSubLayers(const rtl::OUString& aResDir,
- CompositeLocalFileLayer::SubLayerFiles& aSublayerDirectories)
+ std::vector<rtl::OUString>& aSublayerDirectories)
{
if (aResDir.getLength() == 0) return false;
@@ -508,7 +508,7 @@ uno::Reference<backend::XLayer> createReadonlyLocalFileLayer(
{
uno::Reference<backend::XLayer> xResult;
- CompositeLocalFileLayer::SubLayerFiles aSublayers;
+ std::vector<rtl::OUString> aSublayers;
if (aBaseDir.getLength() == 0)
{
findSubLayers(aResDir,aSublayers);
@@ -537,7 +537,7 @@ uno::Reference<backend::XUpdatableLayer> createUpdatableLocalFileLayer(
{
uno::Reference<backend::XUpdatableLayer> xResult;
- CompositeLocalFileLayer::SubLayerFiles aSublayers;
+ std::vector<rtl::OUString> aSublayers;
if (findSubLayers(aResDir,aSublayers))
{
xResult.set( new FullCompositeLocalFileLayer(xFactory,aBaseDir,aComponent,aSublayers) );
@@ -565,12 +565,9 @@ enum
// cppu::OPropertySetHelper
cppu::IPropertyArrayHelper * SAL_CALL LayerPropertyHelper::newInfoHelper()
{
- using com::sun::star::beans::Property;
- using namespace com::sun::star::beans::PropertyAttribute;
-
- Property properties[] =
+ com::sun::star::beans::Property properties[] =
{
- Property(PROPNAME("URL"), LAYER_PROPERTY_URL, PROPTYPE(rtl::OUString), READONLY)
+ com::sun::star::beans::Property(PROPNAME("URL"), LAYER_PROPERTY_URL, PROPTYPE(rtl::OUString), com::sun::star::beans::PropertyAttribute::READONLY)
};
return new cppu::OPropertyArrayHelper(properties, sizeof(properties)/sizeof(properties[0]));
diff --git a/configmgr/source/localbe/localfilelayer.hxx b/configmgr/source/localbe/localfilelayer.hxx
index e52de63bbb..64cd208030 100644
--- a/configmgr/source/localbe/localfilelayer.hxx
+++ b/configmgr/source/localbe/localfilelayer.hxx
@@ -138,7 +138,7 @@ protected:
virtual void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const uno::Any& rValue )
throw (uno::Exception);
- using apihelper::PropertySetHelper::getFastPropertyValue;
+ using PropertySetHelper::getFastPropertyValue;
virtual void SAL_CALL getFastPropertyValue( uno::Any& rValue, sal_Int32 nHandle ) const;
};
@@ -273,8 +273,6 @@ private :
*/
class BasicCompositeLocalFileLayer : public BasicLocalFileLayer
{
-public:
- typedef std::vector<rtl::OUString> SubLayerFiles;
protected:
/**
Constructor providing the base directory and the
@@ -308,13 +306,13 @@ protected:
@param aResDir resource directory containing potential sublayers
@param aComponent component subpath
*/
- void fillSubLayerLists(const SubLayerFiles& aSublayerDirectories,
+ void fillSubLayerLists(const std::vector<rtl::OUString>& aSublayerDirectories,
const rtl::OUString& aComponent) ;
private :
/** List of available sublayers... */
uno::Sequence<rtl::OUString> mSubLayers ;
/** .. and the corresponding file URLs. */
- SubLayerFiles mSubLayerFiles ;
+ std::vector<rtl::OUString> mSubLayerFiles ;
};
@@ -347,7 +345,7 @@ public :
CompositeLocalFileLayer(
const uno::Reference<lang::XMultiServiceFactory>& xFactory,
const rtl::OUString& aComponent,
- const SubLayerFiles& aSublayerDirectories) ;
+ const std::vector<rtl::OUString>& aSublayerDirectories) ;
/** Destructor */
~CompositeLocalFileLayer(void) ;
// XLayer
@@ -409,7 +407,7 @@ public :
const uno::Reference<lang::XMultiServiceFactory>& xFactory,
const rtl::OUString& aBaseDir,
const rtl::OUString& aComponent,
- const SubLayerFiles& aSublayerDirectories) ;
+ const std::vector<rtl::OUString>& aSublayerDirectories) ;
/** Destructor */
~FullCompositeLocalFileLayer(void) ;
// XLayer
diff --git a/configmgr/source/localbe/localhierarchybrowsersvc.cxx b/configmgr/source/localbe/localhierarchybrowsersvc.cxx
index 33d0f8038d..65e9bf8bef 100644
--- a/configmgr/source/localbe/localhierarchybrowsersvc.cxx
+++ b/configmgr/source/localbe/localhierarchybrowsersvc.cxx
@@ -53,7 +53,7 @@ namespace configmgr
{
// -----------------------------------------------------------------------------
-AsciiServiceName const aLocalHierarchyBrowserServices[] =
+sal_Char const * const aLocalHierarchyBrowserServices[] =
{
"com.sun.star.configuration.backend.LocalHierarchyBrowser",
0,
@@ -80,18 +80,18 @@ ServiceInfoHelper LocalHierarchyBrowserService::getServiceInfo()
// -----------------------------------------------------------------------------
uno::Reference< uno::XInterface > SAL_CALL instantiateLocalHierarchyBrowser
-( CreationContext const& rServiceManager )
+( uno::Reference< uno::XComponentContext > const& rServiceManager )
{
return * new LocalHierarchyBrowserService( rServiceManager );
}
// -----------------------------------------------------------------------------
-LocalHierarchyBrowserService::LocalHierarchyBrowserService(CreationArg _xContext)
+LocalHierarchyBrowserService::LocalHierarchyBrowserService(uno::Reference< uno::XComponentContext > const & _xContext)
: m_xServiceFactory(_xContext->getServiceManager(), uno::UNO_QUERY)
{
if (!m_xServiceFactory.is())
{
- OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Configuration Importer: Unexpected NULL context"));
+ rtl::OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Configuration Importer: Unexpected NULL context"));
throw lang::NullPointerException(sMessage,NULL);
}
}
@@ -110,8 +110,8 @@ namespace
enum Mode { findNone, findSchemas, findLayers };
enum Result { getDefault,getUrls, getNames };
- OUString aBaseDataUrl;
- uno::Sequence< OUString > aExcludeList;
+ rtl::OUString aBaseDataUrl;
+ uno::Sequence< rtl::OUString > aExcludeList;
Mode mode;
Result result_type;
};
@@ -126,7 +126,7 @@ namespace
if (sal_Int32(nCount) != aArguments.getLength())
{
- OUString sMessage = OUSTRING("Too many arguments for LocalHierarchyBrowser Job");
+ rtl::OUString sMessage = OUSTRING("Too many arguments for LocalHierarchyBrowser Job");
throw lang::IllegalArgumentException(sMessage,pJob,0);
}
@@ -145,12 +145,12 @@ namespace
{
bKnown = true;
- OUString aLayerBaseUrl;
+ rtl::OUString aLayerBaseUrl;
bGood = (aArguments[i].Value >>= aLayerBaseUrl);
if (aLayerBaseUrl.getLength())
{
- OUString aLocalizedSubDir;
+ rtl::OUString aLocalizedSubDir;
LocalSingleBackend::getLayerSubDirectories(aLayerBaseUrl,this->aBaseDataUrl,aLocalizedSubDir);
mode = findLayers;
@@ -170,7 +170,7 @@ namespace
{
case uno::TypeClass_STRING:
{
- OUString aComponent;
+ rtl::OUString aComponent;
bGood = (aArguments[i].Value >>= aComponent);
OSL_ASSERT(bGood);
@@ -182,7 +182,7 @@ namespace
case uno::TypeClass_SEQUENCE:
{
- uno::Sequence<OUString> aComponentList;
+ uno::Sequence<rtl::OUString> aComponentList;
bGood = (aArguments[i].Value >>= aComponentList);
if (bGood)
@@ -190,7 +190,7 @@ namespace
sal_Int32 const nCompListCount = aComponentList.getLength();
aExcludeList.realloc(nNextIndex + nCompListCount);
- OUString const * pSrc = aComponentList.getConstArray();
+ rtl::OUString const * pSrc = aComponentList.getConstArray();
std::copy(pSrc,pSrc+nCompListCount,aExcludeList.getArray());
}
}
@@ -246,13 +246,13 @@ namespace
static
inline
- OUString getDataFileExtension(JobDesc::Mode mode)
+ rtl::OUString getDataFileExtension(JobDesc::Mode mode)
{
switch (mode)
{
case JobDesc::findSchemas: return OUSTRING(".xcs");
case JobDesc::findLayers: return OUSTRING(".xcu");
- default: OSL_ASSERT(false); return OUString();
+ default: OSL_ASSERT(false); return rtl::OUString();
}
}
}
@@ -266,15 +266,13 @@ uno::Any SAL_CALL
{
JobDesc const aJob(this,Arguments);
- typedef uno::Sequence< OUString > (LocalHierarchyBrowserService::*Finder)( OUString const & _aBaseDirectory, OUString const & _aComponentFileExtension, uno::Sequence< OUString > const & aExcludeList);
-
OSL_ASSERT(JobDesc::getUrls == aJob.result_type || JobDesc::getNames == aJob.result_type);
- Finder const find = (JobDesc::getUrls == aJob.result_type) ?
+ uno::Sequence< rtl::OUString > (LocalHierarchyBrowserService::* const find)( rtl::OUString const & _aBaseDirectory, rtl::OUString const & _aComponentFileExtension, uno::Sequence< rtl::OUString > const & aExcludeList) = (JobDesc::getUrls == aJob.result_type) ?
&LocalHierarchyBrowserService::findLocalComponentUrls :
&LocalHierarchyBrowserService::findLocalComponentNames;
- uno::Sequence< OUString > aComponents = (this->*find)(aJob.aBaseDataUrl,getDataFileExtension(aJob.mode), aJob.aExcludeList);
+ uno::Sequence< rtl::OUString > aComponents = (this->*find)(aJob.aBaseDataUrl,getDataFileExtension(aJob.mode), aJob.aExcludeList);
return uno::makeAny(aComponents);
}
@@ -282,7 +280,7 @@ uno::Any SAL_CALL
// XServiceInfo
-OUString SAL_CALL
+rtl::OUString SAL_CALL
LocalHierarchyBrowserService::getImplementationName( )
throw (uno::RuntimeException)
{
@@ -291,7 +289,7 @@ OUString SAL_CALL
// -----------------------------------------------------------------------------
sal_Bool SAL_CALL
- LocalHierarchyBrowserService::supportsService( const OUString& ServiceName )
+ LocalHierarchyBrowserService::supportsService( const rtl::OUString& ServiceName )
throw (uno::RuntimeException)
{
return getServiceInfo().supportsService( ServiceName );
@@ -321,7 +319,6 @@ uno::Sequence< ::rtl::OUString > SAL_CALL
#include <vector>
// -----------------------------------------------------------------------------
- using rtl::OUString;
namespace uno = com::sun::star::uno;
// -----------------------------------------------------------------------------
@@ -329,7 +326,7 @@ uno::Sequence< ::rtl::OUString > SAL_CALL
//------------------------------------------------------------------------------
static
inline
- bool matchesExtension( OUString const & aFileName, OUString const & aExt )
+ bool matchesExtension( rtl::OUString const & aFileName, rtl::OUString const & aExt )
{
sal_Int32 const nExtStart = aFileName.getLength() - aExt.getLength();
return nExtStart > 0 && !!aFileName.copy(nExtStart).equalsIgnoreAsciiCase(aExt);
@@ -337,7 +334,7 @@ uno::Sequence< ::rtl::OUString > SAL_CALL
//------------------------------------------------------------------------------
static
inline
- OUString stripExtension( OUString const & aFileName, OUString const & aExt )
+ rtl::OUString stripExtension( rtl::OUString const & aFileName, rtl::OUString const & aExt )
{
OSL_PRECOND( matchesExtension(aFileName,aExt), "File name doesn't have expected extension");
@@ -347,7 +344,7 @@ uno::Sequence< ::rtl::OUString > SAL_CALL
//------------------------------------------------------------------------------
static
inline
- bool matchesExtension( osl::FileStatus const & aFileDescriptor, OUString const & aExt )
+ bool matchesExtension( osl::FileStatus const & aFileDescriptor, rtl::OUString const & aExt )
{
OSL_PRECOND( aFileDescriptor.isValid(FileStatusMask_Type | FileStatusMask_FileName),
"Not all required file-status fields available for filter" );
@@ -360,28 +357,26 @@ uno::Sequence< ::rtl::OUString > SAL_CALL
//------------------------------------------------------------------------------
static
- bool makeAbsoluteURL(OUString & rURL )
+ bool makeAbsoluteURL(rtl::OUString & rURL )
{
- using osl::File;
- OUString aBaseDir; tools::getProcessWorkingDir(&aBaseDir);
+ rtl::OUString aBaseDir; tools::getProcessWorkingDir(&aBaseDir);
- File::RC errcode = osl::File::getAbsoluteFileURL(aBaseDir,rURL,rURL);
+ osl::File::RC errcode = osl::File::getAbsoluteFileURL(aBaseDir,rURL,rURL);
- return File::E_None == errcode;
+ return osl::File::E_None == errcode;
}
//------------------------------------------------------------------------------
static
inline
bool getNextDirectoryItem(osl::Directory & aDirectory, osl::DirectoryItem & aItem, osl::Directory::RC & errcode)
{
- using osl::Directory;
switch (errcode = aDirectory.getNextItem(aItem))
{
- case Directory::E_None:
+ case osl::Directory::E_None:
return true;
- case Directory::E_NOENT:
- errcode = Directory::E_None;
+ case osl::Directory::E_NOENT:
+ errcode = osl::Directory::E_None;
return false;
default:
@@ -389,7 +384,7 @@ uno::Sequence< ::rtl::OUString > SAL_CALL
}
}
//------------------------------------------------------------------------------
- static inline bool isExcluded(OUString const & aName, uno::Sequence< OUString > const & aExcludeList)
+ static inline bool isExcluded(rtl::OUString const & aName, uno::Sequence< rtl::OUString > const & aExcludeList)
{
for (sal_Int32 i = 0; i<aExcludeList.getLength(); ++i)
{
@@ -399,23 +394,19 @@ uno::Sequence< ::rtl::OUString > SAL_CALL
}
//------------------------------------------------------------------------------
static
- osl::FileBase::RC findComponents( std::vector<OUString> * componentNames, std::vector<OUString> * componentUrls,
- OUString const& aDirectoryPath, OUString const& aComponentExtension,
- OUString const& aPackagePrefix, OUString const & aComponentSeparator,
- uno::Sequence< OUString > const & aExcludeList)
+ osl::FileBase::RC findComponents( std::vector<rtl::OUString> * componentNames, std::vector<rtl::OUString> * componentUrls,
+ rtl::OUString const& aDirectoryPath, rtl::OUString const& aComponentExtension,
+ rtl::OUString const& aPackagePrefix, rtl::OUString const & aComponentSeparator,
+ uno::Sequence< rtl::OUString > const & aExcludeList)
{
- using osl::Directory;
- using osl::DirectoryItem;
- using osl::FileStatus;
-
static sal_Unicode const chDirSep = '/';
- static OUString const sDirectorySeparator(&chDirSep,1);
+ static rtl::OUString const sDirectorySeparator(&chDirSep,1);
- Directory aDirectory(aDirectoryPath);
+ osl::Directory aDirectory(aDirectoryPath);
osl::Directory::RC errcode = aDirectory.open();
- if (errcode == Directory::E_None)
+ if (errcode == osl::Directory::E_None)
{
sal_uInt32 n_STATUS_FIELDS = FileStatusMask_Type | FileStatusMask_FileName;
if (componentUrls) n_STATUS_FIELDS |= FileStatusMask_FileURL;
@@ -424,10 +415,10 @@ uno::Sequence< ::rtl::OUString > SAL_CALL
while( getNextDirectoryItem(aDirectory,aItem,errcode) )
{
- FileStatus aItemDescriptor( n_STATUS_FIELDS );
+ osl::FileStatus aItemDescriptor( n_STATUS_FIELDS );
errcode = aItem.getFileStatus(aItemDescriptor);
- if ( errcode != DirectoryItem::E_None )
+ if ( errcode != osl::DirectoryItem::E_None )
{
OSL_TRACE("Locating Configuration Components - Error (%u) getting status of directory item - skipping\n", unsigned(errcode));
continue;
@@ -435,13 +426,13 @@ uno::Sequence< ::rtl::OUString > SAL_CALL
OSL_ENSURE( aItemDescriptor.isValid(FileStatusMask_Type), "Could not get type of directory item");
- if (aItemDescriptor.getFileType() == FileStatus::Directory)
+ if (aItemDescriptor.getFileType() == osl::FileStatus::Directory)
{
- OSL_ENSURE( aItemDescriptor.isValid(FileStatusMask_FileName), "Could not get Name of subdirectory");
+ OSL_ENSURE( aItemDescriptor.isValid(FileStatusMask_FileName), "Could not get name of subdirectory");
- OUString const aSubdirName = aItemDescriptor.getFileName();
- OUString const aSubdirPath = aDirectoryPath + sDirectorySeparator + aSubdirName;
- OUString const aSubpackagePrefix = aPackagePrefix + aSubdirName + aComponentSeparator;
+ rtl::OUString const aSubdirName = aItemDescriptor.getFileName();
+ rtl::OUString const aSubdirPath = aDirectoryPath + sDirectorySeparator + aSubdirName;
+ rtl::OUString const aSubpackagePrefix = aPackagePrefix + aSubdirName + aComponentSeparator;
// recurse
if (!isExcluded(aSubpackagePrefix,aExcludeList))
OSL_VERIFY_RC( findComponents( componentNames, componentUrls,
@@ -451,10 +442,10 @@ uno::Sequence< ::rtl::OUString > SAL_CALL
}
else if (matchesExtension(aItemDescriptor,aComponentExtension))
{
- OSL_ENSURE( aItemDescriptor.isValid(FileStatusMask_FileName), "Could not get Name of component found");
+ OSL_ENSURE( aItemDescriptor.isValid(FileStatusMask_FileName), "Could not get name of component found");
- OUString const aComponentName = stripExtension( aItemDescriptor.getFileName(), aComponentExtension );
- OUString const aFullComponentName = aPackagePrefix + aComponentName;
+ rtl::OUString const aComponentName = stripExtension( aItemDescriptor.getFileName(), aComponentExtension );
+ rtl::OUString const aFullComponentName = aPackagePrefix + aComponentName;
if (!isExcluded(aFullComponentName,aExcludeList))
{
@@ -478,18 +469,18 @@ uno::Sequence< ::rtl::OUString > SAL_CALL
}
// -----------------------------------------------------------------------------
- uno::Sequence< OUString > configmgr::localbe::LocalHierarchyBrowserService::findLocalComponentNames( OUString const & _aBaseDirectory, OUString const & _aComponentFileExtension, uno::Sequence< OUString > const & aExcludeList)
+ uno::Sequence< rtl::OUString > configmgr::localbe::LocalHierarchyBrowserService::findLocalComponentNames( rtl::OUString const & _aBaseDirectory, rtl::OUString const & _aComponentFileExtension, uno::Sequence< rtl::OUString > const & aExcludeList)
{
- OUString aBaseDirectory(_aBaseDirectory);
+ rtl::OUString aBaseDirectory(_aBaseDirectory);
OSL_VERIFY( makeAbsoluteURL(aBaseDirectory) );
static const sal_Unicode chPkgSep = '.';
- std::vector< OUString > components;
+ std::vector< rtl::OUString > components;
osl::Directory::RC errcode = findComponents(&components, NULL,
aBaseDirectory, _aComponentFileExtension,
- OUString(), OUString(&chPkgSep,1),
+ rtl::OUString(), rtl::OUString(&chPkgSep,1),
aExcludeList );
if (errcode != osl::Directory::E_None)
@@ -498,29 +489,29 @@ uno::Sequence< ::rtl::OUString > SAL_CALL
if (errcode != osl::Directory::E_NOENT)
{
- OUString sMsg = OUSTRING("LocalHierarchyBrowser - IO Error while scanning for components: ") +
+ rtl::OUString sMsg = OUSTRING("LocalHierarchyBrowser - IO Error while scanning for components: ") +
FileHelper::createOSLErrorString(errcode);
throw com::sun::star::io::IOException(sMsg,*this);
}
}
- return uno::Sequence< OUString >(&components.front(),components.size());
+ return uno::Sequence< rtl::OUString >(&components.front(),components.size());
}
// -----------------------------------------------------------------------------
- uno::Sequence< OUString > configmgr::localbe::LocalHierarchyBrowserService::findLocalComponentUrls( OUString const & _aBaseDirectory, OUString const & _aComponentFileExtension, uno::Sequence< OUString > const & aExcludeList)
+ uno::Sequence< rtl::OUString > configmgr::localbe::LocalHierarchyBrowserService::findLocalComponentUrls( rtl::OUString const & _aBaseDirectory, rtl::OUString const & _aComponentFileExtension, uno::Sequence< rtl::OUString > const & aExcludeList)
{
- OUString aBaseDirectory(_aBaseDirectory);
+ rtl::OUString aBaseDirectory(_aBaseDirectory);
OSL_VERIFY( makeAbsoluteURL(aBaseDirectory) );
static const sal_Unicode chPkgSep = '.';
- std::vector< OUString > components;
+ std::vector< rtl::OUString > components;
osl::Directory::RC errcode = findComponents(NULL, &components,
aBaseDirectory, _aComponentFileExtension,
- OUString(), OUString(&chPkgSep,1),
+ rtl::OUString(), rtl::OUString(&chPkgSep,1),
aExcludeList );
if (errcode != osl::Directory::E_None)
@@ -529,14 +520,14 @@ uno::Sequence< ::rtl::OUString > SAL_CALL
if (errcode != osl::Directory::E_NOENT)
{
- OUString sMsg = OUSTRING("LocalHierarchyBrowser - IO Error while scanning for component files: ") +
+ rtl::OUString sMsg = OUSTRING("LocalHierarchyBrowser - IO Error while scanning for component files: ") +
FileHelper::createOSLErrorString(errcode);
throw com::sun::star::io::IOException(sMsg,*this);
}
}
- return uno::Sequence< OUString >(&components.front(),components.size());
+ return uno::Sequence< rtl::OUString >(&components.front(),components.size());
}
//------------------------------------------------------------------------------
diff --git a/configmgr/source/localbe/localhierarchybrowsersvc.hxx b/configmgr/source/localbe/localhierarchybrowsersvc.hxx
index e26f1db9b7..478dc6c635 100644
--- a/configmgr/source/localbe/localhierarchybrowsersvc.hxx
+++ b/configmgr/source/localbe/localhierarchybrowsersvc.hxx
@@ -46,7 +46,6 @@ namespace configmgr
namespace localbe
{
// -----------------------------------------------------------------------------
- using rtl::OUString;
namespace uno = ::com::sun::star::uno;
namespace lang = ::com::sun::star::lang;
namespace task = ::com::sun::star::task;
@@ -59,22 +58,20 @@ namespace configmgr
>
{
public:
- typedef uno::Reference< uno::XComponentContext > const & CreationArg;
-
explicit
- LocalHierarchyBrowserService(CreationArg _xContext);
+ LocalHierarchyBrowserService(uno::Reference< uno::XComponentContext > const & _xContext);
~LocalHierarchyBrowserService();
// XServiceInfo
- virtual OUString SAL_CALL
+ virtual rtl::OUString SAL_CALL
getImplementationName( )
throw (uno::RuntimeException);
virtual sal_Bool SAL_CALL
- supportsService( const OUString& ServiceName )
+ supportsService( const rtl::OUString& ServiceName )
throw (uno::RuntimeException);
- virtual uno::Sequence< OUString > SAL_CALL
+ virtual uno::Sequence< rtl::OUString > SAL_CALL
getSupportedServiceNames( )
throw (uno::RuntimeException);
@@ -84,15 +81,13 @@ namespace configmgr
throw (lang::IllegalArgumentException, uno::Exception, uno::RuntimeException);
private:
- typedef uno::Reference< lang::XMultiServiceFactory > ServiceFactory;
-
- ServiceFactory getServiceFactory() const
+ uno::Reference< lang::XMultiServiceFactory > getServiceFactory() const
{ return m_xServiceFactory; }
- uno::Sequence< OUString > findLocalComponentNames( OUString const & _aBaseDirectory, OUString const & _aComponentFileExtension, uno::Sequence< OUString > const & aExcludeList);
- uno::Sequence< OUString > findLocalComponentUrls( OUString const & _aBaseDirectory, OUString const & _aComponentFileExtension, uno::Sequence< OUString > const & aExcludeList);
+ uno::Sequence< rtl::OUString > findLocalComponentNames( rtl::OUString const & _aBaseDirectory, rtl::OUString const & _aComponentFileExtension, uno::Sequence< rtl::OUString > const & aExcludeList);
+ uno::Sequence< rtl::OUString > findLocalComponentUrls( rtl::OUString const & _aBaseDirectory, rtl::OUString const & _aComponentFileExtension, uno::Sequence< rtl::OUString > const & aExcludeList);
private:
- ServiceFactory m_xServiceFactory;
+ uno::Reference< lang::XMultiServiceFactory > m_xServiceFactory;
static ServiceInfoHelper getServiceInfo();
};
diff --git a/configmgr/source/localbe/localmultistratum.cxx b/configmgr/source/localbe/localmultistratum.cxx
index 7a10752ba1..34700c0d40 100644
--- a/configmgr/source/localbe/localmultistratum.cxx
+++ b/configmgr/source/localbe/localmultistratum.cxx
@@ -67,7 +67,7 @@ rtl::OUString makeLayerId(rtl::OUString const & aComponent,rtl::OUString const &
}
LocalMultiStratum::LocalMultiStratum(const uno::Reference<uno::XComponentContext>& xContext)
-: MultiStratumImplBase(xContext)
+: cppu::ImplInheritanceHelper1< LocalStratumBase, backend::XMultiLayerStratum >(xContext)
{
}
//------------------------------------------------------------------------------
@@ -80,53 +80,50 @@ uno::Sequence< rtl::OUString > SAL_CALL
const rtl::OUString& /*aEntity*/ )
throw (backend::BackendAccessException, lang::IllegalArgumentException, uno::RuntimeException)
{
- typedef uno::Sequence< rtl::OUString > ResultType;
-
rtl::OUString const aLayerUrl = impl_getLayerDataDirectory(getBaseUrl());
rtl::OUString const aComponentUrl = aLayerUrl + componentToPath(aComponent);
- using namespace osl;
const sal_uInt32 k_STATUS_FIELDS = FileStatusMask_Type | FileStatusMask_FileName;
- Directory aComponentDirectory(aComponentUrl);
- DirectoryItem aItem;
+ osl::Directory aComponentDirectory(aComponentUrl);
+ osl::DirectoryItem aItem;
std::vector< rtl::OUString > aResult;
- Directory::RC errcode = aComponentDirectory.open();
+ osl::Directory::RC errcode = aComponentDirectory.open();
switch (errcode)
{
- case Directory::E_NOENT:
- return ResultType();
+ case osl::Directory::E_NOENT:
+ return uno::Sequence< rtl::OUString >();
- case Directory::E_None:
- while (Directory::E_None == (errcode=aComponentDirectory.getNextItem(aItem)))
+ case osl::Directory::E_None:
+ while (osl::Directory::E_None == (errcode=aComponentDirectory.getNextItem(aItem)))
{
- FileStatus aItemDescriptor( k_STATUS_FIELDS );
+ osl::FileStatus aItemDescriptor( k_STATUS_FIELDS );
errcode = aItem.getFileStatus(aItemDescriptor);
- if ( errcode != DirectoryItem::E_None )
+ if ( errcode != osl::DirectoryItem::E_None )
{
- OSL_ASSERT(errcode != Directory::E_NOENT); // unexpected failure for getFileStatus for existing file
- if (errcode == Directory::E_NOENT) continue;
+ OSL_ASSERT(errcode != osl::Directory::E_NOENT); // unexpected failure for getFileStatus for existing file
+ if (errcode == osl::Directory::E_NOENT) continue;
OSL_TRACE("Reading Component Directory - Error (%u) getting status of directory item.\n", unsigned(errcode));
break;
}
OSL_ENSURE( aItemDescriptor.isValid(FileStatusMask_Type), "Could not get type of directory item");
- if (aItemDescriptor.getFileType() != FileStatus::Regular)
+ if (aItemDescriptor.getFileType() != osl::FileStatus::Regular)
continue;
- OSL_ENSURE( aItemDescriptor.isValid(FileStatusMask_FileName), "Could not get Name of component found");
- OUString const aFileName = aItemDescriptor.getFileName();
+ OSL_ENSURE( aItemDescriptor.isValid(FileStatusMask_FileName), "Could not get name of component found");
+ rtl::OUString const aFileName = aItemDescriptor.getFileName();
if (!aFileName.endsWithIgnoreAsciiCaseAsciiL(RTL_CONSTASCII_STRINGPARAM(kLocalDataSuffix)))
continue;
aResult.push_back( makeLayerId(aComponent,aFileName) );
}
- OSL_ASSERT(errcode != Directory::E_None); // Loop postcond
+ OSL_ASSERT(errcode != osl::Directory::E_None); // Loop postcond
// joint error handling with open failure
- if (errcode != Directory::E_NOENT) // normal loop termination
+ if (errcode != osl::Directory::E_NOENT) // normal loop termination
{
default: // if open() truly failed we also go here
rtl::OUStringBuffer errbuf;
@@ -139,8 +136,8 @@ uno::Sequence< rtl::OUString > SAL_CALL
}
return aResult.empty()
- ? ResultType()
- : ResultType(
+ ? uno::Sequence< rtl::OUString >()
+ : uno::Sequence< rtl::OUString >(
&aResult.front(), static_cast<sal_Int32>(aResult.size()));
}
}
@@ -218,7 +215,7 @@ void LocalMultiStratum::getLayerDirectories(rtl::OUString& aLayerUrl,
rtl::OUString& aSubLayerUrl) const
{
aLayerUrl = impl_getLayerDataDirectory(getBaseUrl());
- aSubLayerUrl = OUString();
+ aSubLayerUrl = rtl::OUString();
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
@@ -230,14 +227,14 @@ static const sal_Char * const kBackendService =
static const sal_Char * const kLocalService =
"com.sun.star.configuration.backend.LocalMultiStratum" ;
-static AsciiServiceName kServiceNames [] = { kLocalService, 0, kBackendService, 0 } ;
+static sal_Char const * kServiceNames [] = { kLocalService, 0, kBackendService, 0 } ;
static const ServiceImplementationInfo kMultiStratumServiceInfo = { kMultiStratumImplementation , kServiceNames, kServiceNames + 2 } ;
const ServiceRegistrationInfo *getLocalMultiStratumServiceInfo()
{ return getRegistrationInfo(&kMultiStratumServiceInfo) ; }
uno::Reference<uno::XInterface> SAL_CALL
-instantiateLocalMultiStratum(const CreationContext& xContext) {
+instantiateLocalMultiStratum(const uno::Reference< uno::XComponentContext >& xContext) {
return *new LocalMultiStratum(xContext) ;
}
diff --git a/configmgr/source/localbe/localmultistratum.hxx b/configmgr/source/localbe/localmultistratum.hxx
index 94bdae9a8c..34c2235e12 100644
--- a/configmgr/source/localbe/localmultistratum.hxx
+++ b/configmgr/source/localbe/localmultistratum.hxx
@@ -45,14 +45,10 @@ namespace uno = css::uno ;
namespace lang = css::lang ;
namespace backend = css::configuration::backend ;
-typedef cppu::ImplInheritanceHelper1< LocalStratumBase,
- backend::XMultiLayerStratum
- > MultiStratumImplBase ;
-
/**
Implements the MultiLayerStratum service for local file access.
*/
-class LocalMultiStratum : public MultiStratumImplBase
+class LocalMultiStratum : public cppu::ImplInheritanceHelper1< LocalStratumBase, backend::XMultiLayerStratum >
{
public :
/**
diff --git a/configmgr/source/localbe/localschemasupplier.cxx b/configmgr/source/localbe/localschemasupplier.cxx
index 893612c2dc..8dda0e0d99 100644
--- a/configmgr/source/localbe/localschemasupplier.cxx
+++ b/configmgr/source/localbe/localschemasupplier.cxx
@@ -56,7 +56,7 @@ namespace configmgr { namespace localbe {
LocalSchemaSupplier::LocalSchemaSupplier(
const uno::Reference<uno::XComponentContext>& xContext)
- : SingleBackendBase(mMutex), mFactory(xContext->getServiceManager(),uno::UNO_QUERY) {
+ : cppu::WeakComponentImplHelper3<backend::XVersionedSchemaSupplier, lang::XInitialization, lang::XServiceInfo>(mMutex), mFactory(xContext->getServiceManager(),uno::UNO_QUERY) {
}
//------------------------------------------------------------------------------
@@ -94,7 +94,7 @@ void SAL_CALL LocalSchemaSupplier::initialize(
// Setting: schema diretory(ies)
uno::Any const aSchemaDataSetting = context->getValueByName(kSchemaDataUrl);
- uno::Sequence< OUString > aSchemas;
+ uno::Sequence< rtl::OUString > aSchemas;
rtl::OUString schemas;
if (aSchemaDataSetting >>= schemas)
@@ -167,7 +167,7 @@ uno::Reference<backend::XSchema> SAL_CALL
rtl::OUString subPath = componentToPath(aComponent) ;
osl::File * schemaFile = NULL;
- OUString errorMessage;
+ rtl::OUString errorMessage;
bool bInsufficientAccess = false;
for (sal_Int32 ix = 0; ix < mSchemaDataUrls.getLength(); ++ix)
{
@@ -175,7 +175,7 @@ uno::Reference<backend::XSchema> SAL_CALL
schemaUrl.append(subPath).append(kSchemaSuffix) ;
- OUString const aFileUrl = schemaUrl.makeStringAndClear();
+ rtl::OUString const aFileUrl = schemaUrl.makeStringAndClear();
std::auto_ptr<osl::File> checkFile( new osl::File(aFileUrl) );
osl::File::RC rc = checkFile->open(OpenFlag_Read) ;
@@ -252,14 +252,14 @@ static const sal_Char * const kSchemaService =
static const sal_Char * const kLocalService =
"com.sun.star.configuration.backend.LocalSchemaSupplier" ;
-static AsciiServiceName kServiceNames [] = {kLocalService, 0, kSchemaService, 0 } ;
+static sal_Char const * kServiceNames [] = {kLocalService, 0, kSchemaService, 0 } ;
static const ServiceImplementationInfo kServiceInfo = { kImplementation, kServiceNames,kServiceNames+2 } ;
const ServiceRegistrationInfo *getLocalSchemaSupplierServiceInfo()
{ return getRegistrationInfo(&kServiceInfo) ; }
uno::Reference<uno::XInterface> SAL_CALL
-instantiateLocalSchemaSupplier(const CreationContext& xContext) {
+instantiateLocalSchemaSupplier(const uno::Reference< uno::XComponentContext >& xContext) {
return *new LocalSchemaSupplier(xContext) ;
}
//------------------------------------------------------------------------------
diff --git a/configmgr/source/localbe/localschemasupplier.hxx b/configmgr/source/localbe/localschemasupplier.hxx
index 623247e4e4..2025c1c3d6 100644
--- a/configmgr/source/localbe/localschemasupplier.hxx
+++ b/configmgr/source/localbe/localschemasupplier.hxx
@@ -47,14 +47,10 @@ namespace uno = css::uno ;
namespace lang = css::lang ;
namespace backend = css::configuration::backend ;
-typedef cppu::WeakComponentImplHelper3<backend::XVersionedSchemaSupplier,
- lang::XInitialization,
- lang::XServiceInfo> SingleBackendBase ;
-
/**
Implements the SchemaSupplier service for local schema file access.
*/
-class LocalSchemaSupplier : public SingleBackendBase {
+class LocalSchemaSupplier : public cppu::WeakComponentImplHelper3<backend::XVersionedSchemaSupplier, lang::XInitialization, lang::XServiceInfo> {
public :
/**
Service constructor from a service factory.
diff --git a/configmgr/source/localbe/localsinglebackend.cxx b/configmgr/source/localbe/localsinglebackend.cxx
index fe184ec773..ca424fce8d 100644
--- a/configmgr/source/localbe/localsinglebackend.cxx
+++ b/configmgr/source/localbe/localsinglebackend.cxx
@@ -57,7 +57,7 @@ namespace configmgr { namespace localbe {
LocalSingleBackend::LocalSingleBackend(
const uno::Reference<uno::XComponentContext>& xContext)
- : SingleBackendBase(mMutex), mFactory(xContext->getServiceManager(),uno::UNO_QUERY) {
+ : cppu::WeakComponentImplHelper5<backend::XSchemaSupplier, backend::XMultiLayerStratum, backend::XBackendEntities, lang::XInitialization, lang::XServiceInfo>(mMutex), mFactory(xContext->getServiceManager(),uno::UNO_QUERY) {
}
//------------------------------------------------------------------------------
@@ -96,7 +96,7 @@ void SAL_CALL LocalSingleBackend::initialize(
// Setting: schema diretory(ies)
uno::Any const aSchemaDataSetting = context->getValueByName(kSchemaDataUrl);
- uno::Sequence< OUString > aSchemas;
+ uno::Sequence< rtl::OUString > aSchemas;
rtl::OUString schemas;
if (aSchemaDataSetting >>= schemas)
@@ -154,7 +154,7 @@ void SAL_CALL LocalSingleBackend::initialize(
// Setting: default layer(s)
uno::Any const aDefaultDataSetting = context->getValueByName(kDefaultDataUrl);
- uno::Sequence< OUString > aDefaults;
+ uno::Sequence< rtl::OUString > aDefaults;
rtl::OUString defaults;
if (aDefaultDataSetting >>= defaults)
@@ -248,7 +248,7 @@ void SAL_CALL LocalSingleBackend::initialize(
if (mUserDataUrl.getLength() == 0)
{
- mUserDataUrl = OUString::createFromAscii("*");
+ mUserDataUrl = rtl::OUString::createFromAscii("*");
OSL_ASSERT(!isValidFileURL(mUserDataUrl));
}
}
@@ -321,7 +321,7 @@ bool layerIdToUrl( const rtl::OUString& aLayerId,
aIndex = aLayerId.copy(0, sep).toInt32() ;
if (0 == aIndex || !isValidEntity(aIndex)) return false;
- OSL_ENSURE( aLayerId.copy(0, sep).equals(OUString::valueOf(aIndex)),
+ OSL_ENSURE( aLayerId.copy(0, sep).equals(rtl::OUString::valueOf(aIndex)),
"Invalid layer id was not detected");
}
aFileUrl = aLayerId.copy(sep + 1);
@@ -359,12 +359,12 @@ sal_Int32 LocalSingleBackend::findEntity(const rtl::OUString& aEntity)
return k_UserLayerEntity;
}
- OUString sNormalizedEntityUrl(aEntity);
+ rtl::OUString sNormalizedEntityUrl(aEntity);
normalizeURL(sNormalizedEntityUrl,*this);
for (sal_Int32 ix = 0; ix < mDefaultDataUrls.getLength(); ++ix)
{
- OUString sNormalizedDefaultUrl(mDefaultDataUrls[ix]);
+ rtl::OUString sNormalizedDefaultUrl(mDefaultDataUrls[ix]);
OSL_VERIFY(normalizeURL(sNormalizedDefaultUrl,*this,true));
if (sNormalizedEntityUrl.equals(sNormalizedDefaultUrl))
@@ -375,7 +375,7 @@ sal_Int32 LocalSingleBackend::findEntity(const rtl::OUString& aEntity)
}
//Try normalized version of mUserDataUrl
- OUString sNormalizedUserUrl(mUserDataUrl);
+ rtl::OUString sNormalizedUserUrl(mUserDataUrl);
if (normalizeURL(sNormalizedUserUrl,*this,true))
{
@@ -447,28 +447,28 @@ rtl::OUString SAL_CALL LocalSingleBackend::getUpdateLayerId(
}
//------------------------------------------------------------------------------
-OUString SAL_CALL LocalSingleBackend::getOwnerEntity()
+rtl::OUString SAL_CALL LocalSingleBackend::getOwnerEntity()
throw (uno::RuntimeException)
{
return mUserDataUrl ;
}
//------------------------------------------------------------------------------
-OUString SAL_CALL LocalSingleBackend::getAdminEntity()
+rtl::OUString SAL_CALL LocalSingleBackend::getAdminEntity()
throw (uno::RuntimeException)
{
return mDefaultDataUrls.getLength() > 0 ? mDefaultDataUrls[0] : mUserDataUrl;
}
//------------------------------------------------------------------------------
-sal_Bool SAL_CALL LocalSingleBackend::supportsEntity( const OUString& aEntity )
+sal_Bool SAL_CALL LocalSingleBackend::supportsEntity( const rtl::OUString& aEntity )
throw (backend::BackendAccessException, uno::RuntimeException)
{
return isValidEntity(findEntity(aEntity)) ;
}
//------------------------------------------------------------------------------
-sal_Bool SAL_CALL LocalSingleBackend::isEqualEntity(const OUString& aEntity, const OUString& aOtherEntity)
+sal_Bool SAL_CALL LocalSingleBackend::isEqualEntity(const rtl::OUString& aEntity, const rtl::OUString& aOtherEntity)
throw (backend::BackendAccessException, lang::IllegalArgumentException, uno::RuntimeException)
{
if (aEntity.getLength() == 0)
@@ -485,10 +485,10 @@ sal_Bool SAL_CALL LocalSingleBackend::isEqualEntity(const OUString& aEntity, con
throw lang::IllegalArgumentException(sMsg, *this, 2);
}
- OUString aNormalizedEntity(aEntity);
+ rtl::OUString aNormalizedEntity(aEntity);
normalizeURL(aNormalizedEntity,*this);
- OUString aNormalizedOther(aOtherEntity);
+ rtl::OUString aNormalizedOther(aOtherEntity);
normalizeURL(aNormalizedOther,*this);
return aNormalizedEntity == aNormalizedOther;
@@ -592,7 +592,7 @@ uno::Reference<backend::XSchema> SAL_CALL
rtl::OUString subPath = componentToPath(aComponent) ;
osl::File * schemaFile = NULL;
- OUString errorMessage;
+ rtl::OUString errorMessage;
bool bInsufficientAccess = false;
for (sal_Int32 ix = 0; ix < mSchemaDataUrls.getLength(); ++ix)
{
@@ -600,7 +600,7 @@ uno::Reference<backend::XSchema> SAL_CALL
schemaUrl.append(subPath).append(kSchemaSuffix) ;
- OUString const aFileUrl = schemaUrl.makeStringAndClear();
+ rtl::OUString const aFileUrl = schemaUrl.makeStringAndClear();
std::auto_ptr<osl::File> checkFile( new osl::File(aFileUrl) );
osl::File::RC rc = checkFile->open(OpenFlag_Read) ;
@@ -694,7 +694,7 @@ bool LocalSingleBackend::getLayerDirectories(sal_Int32 aLayerIndex,
rtl::OUString& aSubLayerUrl)
{
OSL_ASSERT(isValidEntity(aLayerIndex));
- OUString aLayerBaseUrl = (aLayerIndex == k_UserLayerEntity) ? mUserDataUrl : mDefaultDataUrls [entityToIndex(aLayerIndex)] ;
+ rtl::OUString aLayerBaseUrl = (aLayerIndex == k_UserLayerEntity) ? mUserDataUrl : mDefaultDataUrls [entityToIndex(aLayerIndex)] ;
return impl_getLayerSubDirectories(aLayerBaseUrl,aLayerUrl,aSubLayerUrl);
}
@@ -761,14 +761,14 @@ static const sal_Char * const kBackendService =
static const sal_Char * const kLocalService =
"com.sun.star.configuration.backend.LocalSingleBackend" ;
-static AsciiServiceName kServiceNames [] = { kLocalService, 0, kBackendService, 0 } ;
+static sal_Char const * kServiceNames [] = { kLocalService, 0, kBackendService, 0 } ;
static const ServiceImplementationInfo kServiceInfo = { kImplementation, kServiceNames, kServiceNames + 2 } ;
const ServiceRegistrationInfo *getLocalBackendServiceInfo()
{ return getRegistrationInfo(&kServiceInfo) ; }
uno::Reference<uno::XInterface> SAL_CALL
-instantiateLocalBackend(const CreationContext& xContext) {
+instantiateLocalBackend(const uno::Reference< uno::XComponentContext >& xContext) {
return *new LocalSingleBackend(xContext) ;
}
diff --git a/configmgr/source/localbe/localsinglebackend.hxx b/configmgr/source/localbe/localsinglebackend.hxx
index 6e80f3e2b2..f85ccf6007 100644
--- a/configmgr/source/localbe/localsinglebackend.hxx
+++ b/configmgr/source/localbe/localsinglebackend.hxx
@@ -49,17 +49,11 @@ namespace uno = css::uno ;
namespace lang = css::lang ;
namespace backend = css::configuration::backend ;
-typedef cppu::WeakComponentImplHelper5<backend::XSchemaSupplier,
- backend::XMultiLayerStratum,
- backend::XBackendEntities,
- lang::XInitialization,
- lang::XServiceInfo> SingleBackendBase ;
-
/**
Implements the SingleBackend service for local file access.
Layer identifiers in that backend are file URLs.
*/
-class LocalSingleBackend : public SingleBackendBase {
+class LocalSingleBackend : public cppu::WeakComponentImplHelper5<backend::XSchemaSupplier, backend::XMultiLayerStratum, backend::XBackendEntities, lang::XInitialization, lang::XServiceInfo> {
public :
/**
Service constructor from a service factory.
diff --git a/configmgr/source/localbe/localsinglestratum.cxx b/configmgr/source/localbe/localsinglestratum.cxx
index ceedd23c42..08786e3391 100644
--- a/configmgr/source/localbe/localsinglestratum.cxx
+++ b/configmgr/source/localbe/localsinglestratum.cxx
@@ -54,7 +54,7 @@ static inline rtl::OUString getLocalisedDataSubPath()
//------------------------------------------------------------------------------
LocalSingleStratumBase::LocalSingleStratumBase(const uno::Reference<uno::XComponentContext>& xContext)
-: SingleStratumImplBase(xContext)
+: cppu::ImplInheritanceHelper1< LocalStratumBase, backend::XSingleLayerStratum >(xContext)
{
}
//------------------------------------------------------------------------------
@@ -131,7 +131,7 @@ void LocalDataStratum::getLayerDirectories(rtl::OUString& aLayerUrl,
rtl::OUString& aSubLayerUrl) const
{
impl_getLayerDataDirectory(getBaseUrl(),aLayerUrl);
- aSubLayerUrl = OUString();
+ aSubLayerUrl = rtl::OUString();
}
//------------------------------------------------------------------------------
@@ -139,7 +139,7 @@ void LocalReadonlyStratum::getLayerDirectories(rtl::OUString& aLayerUrl,
rtl::OUString& aSubLayerUrl) const
{
impl_getLayerDataDirectory(getBaseUrl(),aLayerUrl);
- aSubLayerUrl = OUString();
+ aSubLayerUrl = rtl::OUString();
}
//------------------------------------------------------------------------------
@@ -152,7 +152,7 @@ void LocalResourceStratum::adjustBaseURL(rtl::OUString& aBaseUrl)
void LocalResourceStratum::getLayerDirectories(rtl::OUString& aLayerUrl,
rtl::OUString& aSubLayerUrl) const
{
- aLayerUrl = OUString();
+ aLayerUrl = rtl::OUString();
aSubLayerUrl = getBaseUrl();
// impl_getLayerResDirectory(getBaseUrl(),aSubLayerUrl);
}
@@ -172,7 +172,7 @@ static const sal_Char * const kBackendService =
static const sal_Char * const kLocalService =
"com.sun.star.configuration.backend.LocalSingleStratum" ;
-static AsciiServiceName kServiceNames [] = { kLocalService, 0, kBackendService, 0 } ;
+static sal_Char const * kServiceNames [] = { kLocalService, 0, kBackendService, 0 } ;
static const ServiceImplementationInfo kLegacyStratumServiceInfo = { kLegacyStratumImplementation , kServiceNames, kServiceNames + 2 } ;
static const ServiceImplementationInfo kDataStratumServiceInfo = { kDataStratumImplementation , kServiceNames, kServiceNames + 2 } ;
static const ServiceImplementationInfo kReadonlyStratumServiceInfo = { kReadonlyStratumImplementation, kServiceNames, kServiceNames + 2 } ;
@@ -191,22 +191,22 @@ const ServiceRegistrationInfo *getLocalResourceStratumServiceInfo()
{ return getRegistrationInfo(&kResourceStratumServiceInfo) ; }
uno::Reference<uno::XInterface> SAL_CALL
-instantiateLocalLegacyStratum(const CreationContext& xContext) {
+instantiateLocalLegacyStratum(const uno::Reference< uno::XComponentContext >& xContext) {
return *new LocalSingleStratum(xContext) ;
}
uno::Reference<uno::XInterface> SAL_CALL
-instantiateLocalDataStratum(const CreationContext& xContext) {
+instantiateLocalDataStratum(const uno::Reference< uno::XComponentContext >& xContext) {
return *new LocalDataStratum(xContext) ;
}
uno::Reference<uno::XInterface> SAL_CALL
-instantiateLocalReadonlyStratum(const CreationContext& xContext) {
+instantiateLocalReadonlyStratum(const uno::Reference< uno::XComponentContext >& xContext) {
return *new LocalReadonlyStratum(xContext) ;
}
uno::Reference<uno::XInterface> SAL_CALL
-instantiateLocalResourceStratum(const CreationContext& xContext) {
+instantiateLocalResourceStratum(const uno::Reference< uno::XComponentContext >& xContext) {
return *new LocalResourceStratum(xContext) ;
}
//------------------------------------------------------------------------------
diff --git a/configmgr/source/localbe/localsinglestratum.hxx b/configmgr/source/localbe/localsinglestratum.hxx
index c7d865a981..90285d42c5 100644
--- a/configmgr/source/localbe/localsinglestratum.hxx
+++ b/configmgr/source/localbe/localsinglestratum.hxx
@@ -45,14 +45,10 @@ namespace uno = css::uno ;
namespace lang = css::lang ;
namespace backend = css::configuration::backend ;
-typedef cppu::ImplInheritanceHelper1< LocalStratumBase,
- backend::XSingleLayerStratum
- > SingleStratumImplBase ;
-
/**
Implements the SingleLayerStratum service for local file access.
*/
-class LocalSingleStratumBase : public SingleStratumImplBase
+class LocalSingleStratumBase : public cppu::ImplInheritanceHelper1< LocalStratumBase, backend::XSingleLayerStratum >
{
public :
/**
diff --git a/configmgr/source/localbe/localstratumbase.cxx b/configmgr/source/localbe/localstratumbase.cxx
index 1a37f3fcfe..c57af960da 100644
--- a/configmgr/source/localbe/localstratumbase.cxx
+++ b/configmgr/source/localbe/localstratumbase.cxx
@@ -53,7 +53,7 @@ namespace configmgr { namespace localbe {
//------------------------------------------------------------------------------
LocalStratumBase::LocalStratumBase(const uno::Reference<uno::XComponentContext>& xContext)
-: LocalStratumImplBase(mMutex)
+: cppu::WeakComponentImplHelper3<lang::XInitialization, backend::XBackendEntities, lang::XServiceInfo>(mMutex)
, mFactory(xContext->getServiceManager(),uno::UNO_QUERY)
{
}
@@ -140,21 +140,21 @@ uno::Reference<backend::XLayer> SAL_CALL
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
-OUString SAL_CALL LocalStratumBase::getOwnerEntity()
+rtl::OUString SAL_CALL LocalStratumBase::getOwnerEntity()
throw (uno::RuntimeException)
{
return mStrataDataUrl ;
}
//------------------------------------------------------------------------------
-OUString SAL_CALL LocalStratumBase::getAdminEntity()
+rtl::OUString SAL_CALL LocalStratumBase::getAdminEntity()
throw (uno::RuntimeException)
{
- return OUString();
+ return rtl::OUString();
}
//------------------------------------------------------------------------------
-sal_Bool SAL_CALL LocalStratumBase::supportsEntity( const OUString& aEntity )
+sal_Bool SAL_CALL LocalStratumBase::supportsEntity( const rtl::OUString& aEntity )
throw (backend::BackendAccessException, uno::RuntimeException)
{
if(mStrataDataUrl.getLength() == 0)
@@ -169,7 +169,7 @@ sal_Bool SAL_CALL LocalStratumBase::supportsEntity( const OUString& aEntity )
}
//------------------------------------------------------------------------------
-sal_Bool SAL_CALL LocalStratumBase::isEqualEntity(const OUString& aEntity, const OUString& aOtherEntity)
+sal_Bool SAL_CALL LocalStratumBase::isEqualEntity(const rtl::OUString& aEntity, const rtl::OUString& aOtherEntity)
throw (backend::BackendAccessException, lang::IllegalArgumentException, uno::RuntimeException)
{
if (aEntity.getLength() == 0)
@@ -186,10 +186,10 @@ sal_Bool SAL_CALL LocalStratumBase::isEqualEntity(const OUString& aEntity, const
throw lang::IllegalArgumentException(sMsg, *this, 2);
}
- OUString aNormalizedEntity(aEntity);
+ rtl::OUString aNormalizedEntity(aEntity);
normalizeURL(aNormalizedEntity,*this);
- OUString aNormalizedOther(aOtherEntity);
+ rtl::OUString aNormalizedOther(aOtherEntity);
normalizeURL(aNormalizedOther,*this);
return aNormalizedEntity == aNormalizedOther;
diff --git a/configmgr/source/localbe/localstratumbase.hxx b/configmgr/source/localbe/localstratumbase.hxx
index 64be02f382..8c5fb02fad 100644
--- a/configmgr/source/localbe/localstratumbase.hxx
+++ b/configmgr/source/localbe/localstratumbase.hxx
@@ -55,11 +55,6 @@ namespace lang = css::lang ;
namespace backend = css::configuration::backend ;
//------------------------------------------------------------------------------
-
-typedef cppu::WeakComponentImplHelper3<lang::XInitialization,
- backend::XBackendEntities,
- lang::XServiceInfo> LocalStratumImplBase ;
-
struct LocalStratumMutexHolder { osl::Mutex mMutex; };
//------------------------------------------------------------------------------
static const char kLocalDataSuffix[] = ".xcu";
@@ -68,7 +63,7 @@ static const char kLocalDataSuffix[] = ".xcu";
/**
Helper for implementing the [Single|Multi]LayerStratum service for local file access.
*/
-class LocalStratumBase : protected LocalStratumMutexHolder, public LocalStratumImplBase
+class LocalStratumBase : protected LocalStratumMutexHolder, public cppu::WeakComponentImplHelper3<lang::XInitialization, backend::XBackendEntities, lang::XServiceInfo>
{
protected :
/**
diff --git a/configmgr/source/misc/anypair.cxx b/configmgr/source/misc/anypair.cxx
index 72061a2479..9b763debbf 100644
--- a/configmgr/source/misc/anypair.cxx
+++ b/configmgr/source/misc/anypair.cxx
@@ -61,7 +61,7 @@ namespace configmgr
}
// -----------------------------------------------------------------------------
- static inline void * impl_getDataPointer(cfgmgr_AnyPair_Data const * _pAnyPairData)
+ static inline void * impl_getDataPointer(const void * const * _pAnyPairData)
{
const void * const pResult = *_pAnyPairData;
@@ -69,7 +69,7 @@ namespace configmgr
}
// -----------------------------------------------------------------------------
- static inline void * impl_getData(cfgmgr_AnyPair_Data const * _pAnyPairData, bool _bStoredData)
+ static inline void * impl_getData(const void * const * _pAnyPairData, bool _bStoredData)
{
const void * const pResult = _bStoredData ? _pAnyPairData : *_pAnyPairData;
@@ -77,7 +77,7 @@ namespace configmgr
}
// -----------------------------------------------------------------------------
- static inline void impl_setDataPointer(cfgmgr_AnyPair_Data * _pAnyPairData, void* _pData)
+ static inline void impl_setDataPointer(const void * * _pAnyPairData, void* _pData)
{
*_pAnyPairData = _pData;
}
@@ -85,9 +85,9 @@ namespace configmgr
static const unsigned SHIFT_DATA_FLAG = 4;
// -----------------------------------------------------------------------------
static
- inline void impl_state_setState(cfgmgr_SelectorType* _pState, cfgmgr_SelectorType _nState, cfgmgr_SelectorType _nSelect)
+ inline void impl_state_setState(sal_uInt8* _pState, sal_uInt8 _nState, sal_uInt8 _nSelect)
{
- cfgmgr_SelectorType const nSelectMask = _nSelect | (_nSelect<<SHIFT_DATA_FLAG);
+ sal_uInt8 const nSelectMask = _nSelect | (_nSelect<<SHIFT_DATA_FLAG);
OSL_ENSURE( (_nState & nSelectMask) == _nState, "State specified does not belong to the selector");
*_pState &= ~nSelectMask;
@@ -96,23 +96,23 @@ namespace configmgr
// -----------------------------------------------------------------------------
static
- inline void impl_state_setNull(cfgmgr_SelectorType* _pState, cfgmgr_SelectorType _nSelect)
+ inline void impl_state_setNull(sal_uInt8* _pState, sal_uInt8 _nSelect)
{
- cfgmgr_SelectorType const nSelectMask = _nSelect | (_nSelect<<SHIFT_DATA_FLAG);
+ sal_uInt8 const nSelectMask = _nSelect | (_nSelect<<SHIFT_DATA_FLAG);
*_pState &= ~nSelectMask;
}
// -----------------------------------------------------------------------------
static inline
- void impl_state_setData(cfgmgr_SelectorType* _pState, cfgmgr_SelectorType _nSelect)
+ void impl_state_setData(sal_uInt8* _pState, sal_uInt8 _nSelect)
{
- cfgmgr_SelectorType const nSelectMask = _nSelect | (_nSelect<<SHIFT_DATA_FLAG);
+ sal_uInt8 const nSelectMask = _nSelect | (_nSelect<<SHIFT_DATA_FLAG);
*_pState |= nSelectMask;
}
// -----------------------------------------------------------------------------
static inline
- void impl_state_setValue(cfgmgr_SelectorType* _pState, cfgmgr_SelectorType _nSelect, bool _bStoresData)
+ void impl_state_setValue(sal_uInt8* _pState, sal_uInt8 _nSelect, bool _bStoresData)
{
*_pState |= _nSelect;
@@ -125,14 +125,14 @@ namespace configmgr
// -----------------------------------------------------------------------------
static
- inline bool impl_state_isNull(cfgmgr_SelectorType const _nState, cfgmgr_SelectorType _nSelect)
+ inline bool impl_state_isNull(sal_uInt8 const _nState, sal_uInt8 _nSelect)
{
return 0 == (_nState & _nSelect);
}
// -----------------------------------------------------------------------------
static
- inline bool impl_state_isData(cfgmgr_SelectorType const _nState, cfgmgr_SelectorType _nSelect)
+ inline bool impl_state_isData(sal_uInt8 const _nState, sal_uInt8 _nSelect)
{
return 0 != (_nState & (_nSelect<<SHIFT_DATA_FLAG));
}
@@ -166,7 +166,7 @@ namespace configmgr
// -----------------------------------------------------------------------------
static inline
- void anypair_empty_set_Data( cfgmgr_AnyPair_Data* _pAnyPairData )
+ void anypair_empty_set_Data( const void ** _pAnyPairData )
{
impl_setDataPointer(_pAnyPairData, NULL);
OSL_DEBUG_ONLY( impl_setDataPointer(_pAnyPairData, reinterpret_cast<void*>(0xdeadbeef)) );
@@ -175,11 +175,11 @@ namespace configmgr
// -----------------------------------------------------------------------------
// returns a state for the specified selector
static inline
- cfgmgr_SelectorType anypair_any_set_Data( cfgmgr_AnyPair_Data* _pAnyPairData,
- cfgmgr_SelectorType _nSelect,
+ sal_uInt8 anypair_any_set_Data( const void ** _pAnyPairData,
+ sal_uInt8 _nSelect,
uno_Any const *_pUnoAny)
{
- cfgmgr_SelectorType nState = 0;
+ sal_uInt8 nState = 0;
bool bValue = impl_Any_hasValue(_pUnoAny);
if (bValue)
@@ -201,12 +201,12 @@ namespace configmgr
// -----------------------------------------------------------------------------
static inline
- cfgmgr_SelectorType anypair_copy_Data( cfgmgr_AnyPair_Data* _pAnyPairData,
- cfgmgr_SelectorType _nSelect,
+ sal_uInt8 anypair_copy_Data( const void ** _pAnyPairData,
+ sal_uInt8 _nSelect,
cfgmgr_AnyPair_Desc const* _pAnyPairDescFrom,
- cfgmgr_AnyPair_Data const* _pAnyPairDataFrom )
+ const void * const* _pAnyPairDataFrom )
{
- cfgmgr_SelectorType nState = 0;
+ sal_uInt8 nState = 0;
if (impl_state_isNull(_pAnyPairDescFrom->nState, _nSelect))
{
@@ -244,8 +244,8 @@ namespace configmgr
// -----------------------------------------------------------------------------
static
- void anypair_clear_Data( cfgmgr_AnyPair_Data* _pAnyPairData,
- cfgmgr_SelectorType _nSelect,
+ void anypair_clear_Data( const void ** _pAnyPairData,
+ sal_uInt8 _nSelect,
cfgmgr_AnyPair_Desc const* _pAnyPairDesc
)
{
@@ -277,8 +277,8 @@ namespace configmgr
static
void anypair_Data_fill_Any( uno_Any* _pUnoAny,
cfgmgr_AnyPair_Desc const* _pAnyPairDesc,
- cfgmgr_AnyPair_Data const* _pAnyPairData,
- cfgmgr_SelectorType _nSelect )
+ const void * const* _pAnyPairData,
+ sal_uInt8 _nSelect )
{
if (impl_state_isNull(_pAnyPairDesc->nState,_nSelect))
{
@@ -325,8 +325,8 @@ namespace configmgr
// -----------------------------------------------------------------------------
static
sal_Bool anypair_any_assign_Data( cfgmgr_AnyPair_Desc* _pAnyPairDesc,
- cfgmgr_AnyPair_Data* _pAnyPairData,
- cfgmgr_SelectorType _nSelect,
+ const void ** _pAnyPairData,
+ sal_uInt8 _nSelect,
uno_Any const *_pUnoAny)
{
typelib_TypeDescriptionReference* pOldType = _pAnyPairDesc->pType;
@@ -345,7 +345,7 @@ namespace configmgr
reinterpret_cast< uno_AcquireFunc >( uno::cpp_acquire ),
reinterpret_cast< uno_AcquireFunc >( uno::cpp_release ));
- cfgmgr_SelectorType nNewState = anypair_any_set_Data(_pAnyPairData,_nSelect,&aTmpAny);
+ sal_uInt8 nNewState = anypair_any_set_Data(_pAnyPairData,_nSelect,&aTmpAny);
impl_state_setState(&_pAnyPairDesc->nState, nNewState, _nSelect);
uno_any_destruct(
@@ -452,7 +452,7 @@ namespace configmgr
anypair_type_construct_Desc(&_pAnyPair->desc, bHasFirst ? _pFirstAny->pType : _pSecondAny->pType);
- cfgmgr_SelectorType nState = 0;
+ sal_uInt8 nState = 0;
nState |= anypair_any_set_Data (&_pAnyPair->first, cfgmgr_SELECT_FIRST, _pFirstAny);
nState |= anypair_any_set_Data (&_pAnyPair->second, cfgmgr_SELECT_SECOND, _pSecondAny);
@@ -476,7 +476,7 @@ namespace configmgr
anypair_type_construct_Desc(&_pAnyPair->desc, _pAnyPairFrom->desc.pType);
- cfgmgr_SelectorType nState = 0;
+ sal_uInt8 nState = 0;
nState |= anypair_copy_Data(&_pAnyPair->first, cfgmgr_SELECT_FIRST,
&_pAnyPairFrom->desc, &_pAnyPairFrom->first );
@@ -567,8 +567,8 @@ namespace configmgr
static
inline
uno::Any anypair_Data_toAny(cfgmgr_AnyPair_Desc const* _pAnyPairDesc,
- cfgmgr_AnyPair_Data const* _pAnyPairData,
- cfgmgr_SelectorType _nSelect)
+ const void * const* _pAnyPairData,
+ sal_uInt8 _nSelect)
{
uno_Any aTmpAny;
anypair_Data_fill_Any(&aTmpAny,_pAnyPairDesc,_pAnyPairData,_nSelect);
diff --git a/configmgr/source/misc/bootstrap.cxx b/configmgr/source/misc/bootstrap.cxx
index 3a3bad05e9..bf927ed12c 100644
--- a/configmgr/source/misc/bootstrap.cxx
+++ b/configmgr/source/misc/bootstrap.cxx
@@ -70,8 +70,8 @@
#define SERVERTYPE_PLUGIN_COMPAT "plugin"
// ---------------------------------------------------------------------------------------
-#define NAME( N ) OUString(RTL_CONSTASCII_USTRINGPARAM(N))
-#define ITEM( N ) OUString(RTL_CONSTASCII_USTRINGPARAM(N))
+#define NAME( N ) rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(N))
+#define ITEM( N ) rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(N))
// ---------------------------------------------------------------------------------------
// -------------------------------------------------------------------------
@@ -100,7 +100,7 @@ namespace configmgr
const sal_Char k_BootstrapContextServiceName[] = "com.sun.star.configuration.bootstrap.BootstrapContext" ;
// -------------------------------------------------------------------------
- static AsciiServiceName const k_BootstrapContextServiceNames [] =
+ static sal_Char const * const k_BootstrapContextServiceNames [] =
{
k_BootstrapContextServiceName,
0
@@ -121,12 +121,12 @@ namespace configmgr
// ---------------------------------------------------------------------------------------
// ---------------------------------------------------------------------------------------
uno::Reference<uno::XInterface> SAL_CALL
- instantiateBootstrapContext( CreationContext const& xTargetContext )
+ instantiateBootstrapContext( uno::Reference< uno::XComponentContext > const& xTargetContext )
{
- CreationContext xContext = UnoContextTunnel::recoverContext(xTargetContext);
+ uno::Reference< uno::XComponentContext > xContext = UnoContextTunnel::recoverContext(xTargetContext);
BootstrapContext * pContext = new BootstrapContext(xContext);
- CreationContext xResult(pContext);
+ uno::Reference< uno::XComponentContext > xResult(pContext);
pContext->initialize();
@@ -163,13 +163,13 @@ namespace configmgr
aSingletonName.appendAscii( RTL_CONSTASCII_STRINGPARAM(SINGLETON_) );
aSingletonName.appendAscii(pSingletonInfo->singletonName);
- OUString const aServiceName = OUString::createFromAscii(pSingletonInfo->instantiatedServiceName);
+ rtl::OUString const aServiceName = rtl::OUString::createFromAscii(pSingletonInfo->instantiatedServiceName);
return cppu::ContextEntry_Init(aSingletonName.makeStringAndClear(), uno::makeAny(aServiceName), true);
}
// ---------------------------------------------------------------------------
-BootstrapContext::Context BootstrapContext::createWrapper(Context const & _xContext, Overrides const & _aOverrides)
+uno::Reference< uno::XComponentContext > BootstrapContext::createWrapper(uno::Reference< uno::XComponentContext > const & _xContext, uno::Sequence < beans::NamedValue > const & _aOverrides)
{
std::vector< cppu::ContextEntry_Init > aContextEntries;
aContextEntries.reserve(_aOverrides.getLength() + 5);
@@ -194,7 +194,7 @@ BootstrapContext::Context BootstrapContext::createWrapper(Context const & _xCont
}
// ---------------------------------------------------------------------------
-sal_Bool BootstrapContext::isWrapper(Context const & _xContext)
+sal_Bool BootstrapContext::isWrapper(uno::Reference< uno::XComponentContext > const & _xContext)
{
OSL_ASSERT(_xContext.is());
if (!_xContext.is()) return false;
@@ -211,7 +211,7 @@ sal_Bool BootstrapContext::isWrapper(Context const & _xContext)
// ---------------------------------------------------------------------------
// ---------------------------------------------------------------------------
-BootstrapContext::BootstrapContext(Context const & _xContext)
+BootstrapContext::BootstrapContext(uno::Reference< uno::XComponentContext > const & _xContext)
: ComponentContext(_xContext)
{
}
@@ -225,7 +225,7 @@ BootstrapContext::~BootstrapContext()
void BootstrapContext::initialize()
{
// get default Bootstrap URL
- OUString sURL;
+ rtl::OUString sURL;
uno::Any aExplicitURL;
if ( this->lookupInContext(aExplicitURL,NAME(CONTEXT_ITEM_PREFIX_ SETTING_INIFILE)) )
{
@@ -240,9 +240,9 @@ void BootstrapContext::initialize()
}
// ---------------------------------------------------------------------------
-static OUString getCurrentModuleDirectory() // URL including terminating slash
+static rtl::OUString getCurrentModuleDirectory() // URL including terminating slash
{
- OUString aFileURL;
+ rtl::OUString aFileURL;
if ( !osl::Module::getUrlFromAddress(reinterpret_cast< oslGenericFunction >( &getCurrentModuleDirectory ),aFileURL) )
{
OSL_TRACE(false, "Cannot locate current module - using executable instead");
@@ -256,13 +256,13 @@ static OUString getCurrentModuleDirectory() // URL including terminating slash
}
// ---------------------------------------------------------------------------------------
-OUString BootstrapContext::getDefaultConfigurationBootstrapURL()
+rtl::OUString BootstrapContext::getDefaultConfigurationBootstrapURL()
{
- return getCurrentModuleDirectory() + OUString(RTL_CONSTASCII_USTRINGPARAM(CONFIGMGR_INIFILE));
+ return getCurrentModuleDirectory() + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(CONFIGMGR_INIFILE));
}
// ---------------------------------------------------------------------------------------
-OUString BootstrapContext::makeContextName(OUString const & _aName)
+rtl::OUString BootstrapContext::makeContextName(rtl::OUString const & _aName)
{
// check that it isn't long already
OSL_ENSURE(!_aName.matchIgnoreAsciiCaseAsciiL( RTL_CONSTASCII_STRINGPARAM(CONTEXT_MODULE_PREFIX_) ),
@@ -272,7 +272,7 @@ OUString BootstrapContext::makeContextName(OUString const & _aName)
}
// ---------------------------------------------------------------------------
-OUString BootstrapContext::makeBootstrapName(OUString const & _aName)
+rtl::OUString BootstrapContext::makeBootstrapName(rtl::OUString const & _aName)
{
// check if already is short
if (!_aName.matchIgnoreAsciiCaseAsciiL( RTL_CONSTASCII_STRINGPARAM(CONTEXT_ITEM_PREFIX_) ) )
@@ -286,7 +286,7 @@ OUString BootstrapContext::makeBootstrapName(OUString const & _aName)
// ---------------------------------------------------------------------------
uno::Any SAL_CALL
- BootstrapContext::getValueByName( const OUString& aName )
+ BootstrapContext::getValueByName( const rtl::OUString& aName )
throw (uno::RuntimeException)
{
sal_Bool const bOurName = aName.matchIgnoreAsciiCaseAsciiL( RTL_CONSTASCII_STRINGPARAM(CONTEXT_MODULE_PREFIX_) );
@@ -304,7 +304,7 @@ uno::Any SAL_CALL
}
else if (aName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM(SINGLETON_ A_BootstrapContextSingletonName) ) )
{
- return uno::makeAny( Context(this) );
+ return uno::makeAny( uno::Reference< uno::XComponentContext >(this) );
}
uno::Any aResult;
@@ -325,7 +325,7 @@ uno::Any SAL_CALL
// class ContextReader
// ---------------------------------------------------------------------------
- ContextReader::ContextReader(Context const & context)
+ ContextReader::ContextReader(uno::Reference< uno::XComponentContext > const & context)
: m_basecontext(context)
, m_fullcontext()
{
@@ -345,20 +345,20 @@ uno::Any SAL_CALL
}
// ---------------------------------------------------------------------------
inline
- uno::Any ContextReader::getSetting(OUString const & _aSetting) const
+ uno::Any ContextReader::getSetting(rtl::OUString const & _aSetting) const
{
OSL_ASSERT(m_basecontext.is());
return getBestContext()->getValueByName(_aSetting);
}
inline
- sal_Bool ContextReader::hasSetting(OUString const & _aSetting) const
+ sal_Bool ContextReader::hasSetting(rtl::OUString const & _aSetting) const
{
return getSetting(_aSetting).hasValue();
}
inline
- sal_Bool ContextReader::getBoolSetting(OUString const & _aSetting, sal_Bool bValue = false) const
+ sal_Bool ContextReader::getBoolSetting(rtl::OUString const & _aSetting, sal_Bool bValue = false) const
{
uno::Any aValue = getSetting(_aSetting);
if (!(aValue >>= bValue))
@@ -368,7 +368,7 @@ uno::Any SAL_CALL
}
inline
- OUString ContextReader::getStringSetting(OUString const & _aSetting, OUString aValue = OUString()) const
+ rtl::OUString ContextReader::getStringSetting(rtl::OUString const & _aSetting, rtl::OUString aValue = rtl::OUString()) const
{
getSetting(_aSetting) >>= aValue;
return aValue;
@@ -377,9 +377,9 @@ uno::Any SAL_CALL
sal_Bool ContextReader::isUnoBackend() const
{
- OUString aSettingName = NAME(BOOTSTRAP_SERVERTYPE_COMPAT);
+ rtl::OUString aSettingName = NAME(BOOTSTRAP_SERVERTYPE_COMPAT);
- OUString aValue;
+ rtl::OUString aValue;
if (getSetting(aSettingName) >>= aValue)
{
return aValue.equalsAscii(SERVERTYPE_UNO_COMPAT);
@@ -414,16 +414,16 @@ uno::Any SAL_CALL
}
// ---------------------------------------------------------------------------------------
- OUString ContextReader::getUnoBackendService() const
+ rtl::OUString ContextReader::getUnoBackendService() const
{
return getStringSetting( NAME(CONTEXT_ITEM_PREFIX_ SETTING_UNOSERVICE) );
}
- OUString ContextReader::getUnoBackendWrapper() const
+ rtl::OUString ContextReader::getUnoBackendWrapper() const
{
return getStringSetting( NAME(CONTEXT_ITEM_PREFIX_ SETTING_UNOWRAPPER) );
}
- OUString ContextReader::getLocale() const
+ rtl::OUString ContextReader::getLocale() const
{
return getStringSetting( NAME(CONTEXT_ITEM_PREFIX_ SETTING_LOCALE_NEW) );
}
@@ -455,7 +455,7 @@ uno::Any SAL_CALL
}
// ---------------------------------------------------------------------------------------
- bool ContextReader::testAdminService(Context const & context, bool bAdmin)
+ bool ContextReader::testAdminService(uno::Reference< uno::XComponentContext > const & context, bool bAdmin)
{
OSL_ASSERT(context.is());
if (!context.is()) return false;
@@ -506,7 +506,7 @@ uno::Any SAL_CALL
// handle old servertype argument and filter the 'plugin' value
if (rValue.Name.equalsAscii(ARGUMENT_SERVERTYPE_COMPAT))
{
- OUString aServertype;
+ rtl::OUString aServertype;
if (! (rValue.Value >>= aServertype))
return false;
@@ -563,41 +563,41 @@ namespace {
};
// ---------------------------------------------------------------------------------------
static
- OUString getFallbackErrorMessage( BootstrapResult _rc )
+ rtl::OUString getFallbackErrorMessage( BootstrapResult _rc )
{
- OUString sMessage(RTL_CONSTASCII_USTRINGPARAM("The program cannot start. "));
+ rtl::OUString sMessage(RTL_CONSTASCII_USTRINGPARAM("The program cannot start. "));
switch (_rc)
{
case MISSING_BOOTSTRAP_FILE:
- sMessage = OUString(RTL_CONSTASCII_USTRINGPARAM("A main configuration file is missing"));
+ sMessage = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("A main configuration file is missing"));
break;
case INCOMPLETE_BOOTSTRAP_FILE:
- sMessage = OUString(RTL_CONSTASCII_USTRINGPARAM("A main configuration file is invalid"));
+ sMessage = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("A main configuration file is invalid"));
break;
case INCOMPLETE_BOOTSTRAP_DATA:
- sMessage = OUString(RTL_CONSTASCII_USTRINGPARAM("Required bootstrap data is not available"));
+ sMessage = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Required bootstrap data is not available"));
break;
default:
- sMessage = OUString(RTL_CONSTASCII_USTRINGPARAM("Unexpected bootstrap failure"));
+ sMessage = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Unexpected bootstrap failure"));
break;
case BOOTSTRAP_DATA_OK:
break;
}
- sMessage += OUString(RTL_CONSTASCII_USTRINGPARAM(" (No detailed error message available.)"));
+ sMessage += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" (No detailed error message available.)"));
return sMessage;
}
// ---------------------------------------------------------------------------------------
static
- uno::Any impl_makeBootstrapException( BootstrapResult _rc, OUString const& _sMessage, OUString const& _sURL, uno::Reference< uno::XInterface > _xContext )
+ uno::Any impl_makeBootstrapException( BootstrapResult _rc, rtl::OUString const& _sMessage, rtl::OUString const& _sURL, uno::Reference< uno::XInterface > _xContext )
{
- OUString sMessage(_sMessage);
+ rtl::OUString sMessage(_sMessage);
// ensure a message
if (sMessage.getLength()== 0)
{
@@ -606,21 +606,19 @@ namespace {
sMessage = getFallbackErrorMessage(_rc);
}
- using namespace com::sun::star::configuration;
-
// raise the error
switch (_rc)
{
case MISSING_BOOTSTRAP_FILE:
- return uno::makeAny( MissingBootstrapFileException(sMessage, _xContext, _sURL) );
+ return uno::makeAny( com::sun::star::configuration::MissingBootstrapFileException(sMessage, _xContext, _sURL) );
case INCOMPLETE_BOOTSTRAP_FILE:
- return uno::makeAny( InvalidBootstrapFileException(sMessage, _xContext, _sURL) );
+ return uno::makeAny( com::sun::star::configuration::InvalidBootstrapFileException(sMessage, _xContext, _sURL) );
default: OSL_ENSURE(false, "Undefined BootstrapResult code");
case INCOMPLETE_BOOTSTRAP_DATA:
case BOOTSTRAP_FAILURE:
- return uno::makeAny( CannotLoadConfigurationException(sMessage, _xContext) );
+ return uno::makeAny( com::sun::star::configuration::CannotLoadConfigurationException(sMessage, _xContext) );
case BOOTSTRAP_DATA_OK:
break;
@@ -631,7 +629,7 @@ namespace {
static
inline
- bool urlExists(OUString const& _sURL)
+ bool urlExists(rtl::OUString const& _sURL)
{
osl::DirectoryItem aCheck;
return (osl::DirectoryItem::get(_sURL,aCheck) == osl::DirectoryItem::E_None);
@@ -639,7 +637,7 @@ namespace {
// ---------------------------------------------------------------------------------------
static
- OUString buildBootstrapError( sal_Char const* _sWhat, OUString const& _sName, sal_Char const* _sHow)
+ rtl::OUString buildBootstrapError( sal_Char const* _sWhat, rtl::OUString const& _sName, sal_Char const* _sHow)
{
rtl::OUStringBuffer sMessage;
@@ -652,7 +650,7 @@ namespace {
}
// ---------------------------------------------------------------------------------------
- BootstrapResult getBootstrapErrorMessage(BootstrapContext const & aContext, ContextReader const & aSettings, OUString& _rMessage, OUString& _rIniFile )
+ BootstrapResult getBootstrapErrorMessage(BootstrapContext const & aContext, ContextReader const & aSettings, rtl::OUString& _rMessage, rtl::OUString& _rIniFile )
{
BootstrapResult eResult = BOOTSTRAP_DATA_OK;
@@ -670,7 +668,7 @@ namespace {
}
else if (!aSettings.isBootstrapValid() )
{
- _rMessage = buildBootstrapError("Needed information to access",OUString::createFromAscii("application"), "configuration data is missing");
+ _rMessage = buildBootstrapError("Needed information to access",rtl::OUString::createFromAscii("application"), "configuration data is missing");
eResult = INCOMPLETE_BOOTSTRAP_DATA;
}
@@ -685,7 +683,7 @@ uno::Any BootstrapContext::makeBootstrapException()
if (aReader.isBootstrapValid()) return uno::Any();
- OUString sMessage,sURL;
+ rtl::OUString sMessage,sURL;
BootstrapResult rc = getBootstrapErrorMessage(*this,aReader,sMessage,sURL);
diff --git a/configmgr/source/misc/bootstrapcontext.cxx b/configmgr/source/misc/bootstrapcontext.cxx
index 3d125fc743..5bd281f979 100644
--- a/configmgr/source/misc/bootstrapcontext.cxx
+++ b/configmgr/source/misc/bootstrapcontext.cxx
@@ -32,6 +32,7 @@
#include "precompiled_configmgr.hxx"
#include "bootstrapcontext.hxx"
+#include "datalock.hxx"
#include <uno/current_context.hxx>
#include <cppuhelper/implbase2.hxx>
#include <cppuhelper/exc_hlp.hxx>
@@ -50,19 +51,19 @@ namespace configmgr
#define A_SERVICEMANAGER "com.sun.star.lang.theServiceManager"
// ---------------------------------------------------------------------------
-#define OUSTR( text ) OUString( RTL_CONSTASCII_USTRINGPARAM( text ) )
+#define OUSTR( text ) rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( text ) )
#define OU2ASCII( str ) ( rtl::OUStringToOString(str,RTL_TEXTENCODING_ASCII_US) .getStr() )
// ---------------------------------------------------------------------------
#if 0
static void testComplete()
{
- uno::Reference< uno::XInterface > test = * new ComponentContext(ComponentContext::Context(),ComponentContext::Overrides(),true);
+ uno::Reference< uno::XInterface > test = * new ComponentContext(uno::Reference< uno::XComponentContext >,uno::Sequence < beans::NamedValue >(),true);
}
#endif
// ---------------------------------------------------------------------------
-ComponentContext::ComponentContext(Context const & _xContext)
-: ComponentContext_Base(UnoApiLock::getLock())
+ComponentContext::ComponentContext(uno::Reference< uno::XComponentContext > const & _xContext)
+: cppu::WeakComponentImplHelper3 < uno::XComponentContext, uno::XCurrentContext, lang::XServiceInfo >(UnoApiLock::getLock())
, m_xContext(_xContext)
, m_hBootstrapData(NULL)
, m_xServiceManager()
@@ -76,7 +77,7 @@ ComponentContext::~ComponentContext()
}
// ---------------------------------------------------------------------------
-void ComponentContext::initialize( const OUString& _aURL )
+void ComponentContext::initialize( const rtl::OUString& _aURL )
{
UnoApiLock aLock;
@@ -110,9 +111,9 @@ void SAL_CALL ComponentContext::disposing()
}
// ---------------------------------------------------------------------------
-OUString ComponentContext::getBootstrapURL() const
+rtl::OUString ComponentContext::getBootstrapURL() const
{
- OUString aResult;
+ rtl::OUString aResult;
UnoApiLock aLock;
@@ -137,11 +138,11 @@ uno::Reference< lang::XMultiComponentFactory > SAL_CALL
if (!m_xServiceManager.is())
{
- Context xBase = basecontext();
+ uno::Reference< uno::XComponentContext > xBase = basecontext();
if (!xBase.is())
throw lang::DisposedException(OUSTR("Parent context has been disposed"),*this);
- ServiceManager xBaseServiceManager = xBase->getServiceManager();
+ uno::Reference< lang::XMultiComponentFactory > xBaseServiceManager = xBase->getServiceManager();
OSL_ENSURE( xBaseServiceManager.is(), "Base context has no service manager");
if (xBaseServiceManager.is())
@@ -169,7 +170,7 @@ uno::Reference< lang::XMultiComponentFactory > SAL_CALL
// ---------------------------------------------------------------------------
-sal_Bool ComponentContext::isPassthrough(Context const & _xContext)
+sal_Bool ComponentContext::isPassthrough(uno::Reference< uno::XComponentContext > const & _xContext)
{
OSL_ENSURE(_xContext.is(),"Unexpected NULL context");
if (!_xContext.is()) return false;
@@ -186,9 +187,9 @@ beans::NamedValue ComponentContext::makePassthroughMarker(sal_Bool bPassthrough)
}
// ---------------------------------------------------------------------------
-bool ComponentContext::lookupInContext( uno::Any & _rValue, const OUString& _aName ) const
+bool ComponentContext::lookupInContext( uno::Any & _rValue, const rtl::OUString& _aName ) const
{
- Context xBase = basecontext();
+ uno::Reference< uno::XComponentContext > xBase = basecontext();
if (!xBase.is())
throw lang::DisposedException(OUSTR("Parent context has been disposed"),const_cast<ComponentContext&>(*this));
@@ -210,10 +211,10 @@ bool ComponentContext::lookupInContext( uno::Any & _rValue, const OUString& _aNa
}
// ---------------------------------------------------------------------------
-bool ComponentContext::lookupInBootstrap( uno::Any & _rValue, const OUString& _aName ) const
+bool ComponentContext::lookupInBootstrap( uno::Any & _rValue, const rtl::OUString& _aName ) const
{
UnoApiLock aLock;
- OUString sResult;
+ rtl::OUString sResult;
if ( rtl_bootstrap_get_from_handle( m_hBootstrapData, _aName.pData, &sResult.pData, 0) )
{
_rValue <<= sResult;
@@ -230,27 +231,27 @@ static const char k_TunneledContext[] = "/services/com.sun.star.configuration.bo
class UnoContextTunnel::Tunnel
: public ::cppu::WeakImplHelper2< uno::XCurrentContext, lang::XUnoTunnel >
{
- Context m_xTunneledContext;
- CurrentContext m_xOldContext;
+ uno::Reference< uno::XComponentContext > m_xTunneledContext;
+ uno::Reference< uno::XCurrentContext > m_xOldContext;
uno::Any m_aFailure;
public:
- Tunnel(Context const & xTunneledContext, CurrentContext const & xOldContext)
+ Tunnel(uno::Reference< uno::XComponentContext > const & xTunneledContext, uno::Reference< uno::XCurrentContext > const & xOldContext)
: m_xTunneledContext(xTunneledContext)
, m_xOldContext(xOldContext)
, m_aFailure()
{}
virtual uno::Any SAL_CALL
- getValueByName( const OUString& Name )
+ getValueByName( const rtl::OUString& name )
throw (uno::RuntimeException)
{
- if (Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM(k_TunneledContext) ) )
+ if (name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM(k_TunneledContext) ) )
{
return uno::makeAny(m_xTunneledContext);
}
else if (m_xOldContext.is())
{
- return m_xOldContext->getValueByName(Name);
+ return m_xOldContext->getValueByName(name);
}
else
{
@@ -268,7 +269,7 @@ public:
return 0;
}
- static uno::Any * getFailure(FailureTunnel const & xTunnel);
+ static uno::Any * getFailure(uno::Reference< lang::XUnoTunnel > const & xTunnel);
static uno::Sequence< sal_Int8 > getTunnelId();
};
@@ -281,7 +282,7 @@ uno::Sequence< sal_Int8 > UnoContextTunnel::Tunnel::getTunnelId()
}
// ---------------------------------------------------------------------------
-uno::Any * UnoContextTunnel::Tunnel::getFailure(FailureTunnel const & xTunnel)
+uno::Any * UnoContextTunnel::Tunnel::getFailure(uno::Reference< lang::XUnoTunnel > const & xTunnel)
{
if (xTunnel.is())
{
@@ -307,7 +308,7 @@ UnoContextTunnel::~UnoContextTunnel()
}
// ---------------------------------------------------------------------------
-void UnoContextTunnel::passthru(Context const & xContext)
+void UnoContextTunnel::passthru(uno::Reference< uno::XComponentContext > const & xContext)
{
OSL_ASSERT( xContext.is() );
if ( ComponentContext::isPassthrough(xContext) )
@@ -321,7 +322,7 @@ void UnoContextTunnel::passthru(Context const & xContext)
}
// ---------------------------------------------------------------------------
-void UnoContextTunnel::tunnel(Context const & xContext)
+void UnoContextTunnel::tunnel(uno::Reference< uno::XComponentContext > const & xContext)
{
Tunnel * pNewTunnel = new Tunnel(xContext,m_xOldContext);
m_xActiveTunnel = pNewTunnel;
@@ -329,16 +330,16 @@ void UnoContextTunnel::tunnel(Context const & xContext)
}
// ---------------------------------------------------------------------------
-UnoContextTunnel::Context UnoContextTunnel::recoverContext(Context const & xFallback )
+uno::Reference< uno::XComponentContext > UnoContextTunnel::recoverContext(uno::Reference< uno::XComponentContext > const & xFallback )
{
try
{
- CurrentContext const xCurrContext = uno::getCurrentContext();
+ uno::Reference< uno::XCurrentContext > const xCurrContext = uno::getCurrentContext();
if (xCurrContext.is())
{
- OUString aName(RTL_CONSTASCII_USTRINGPARAM(k_TunneledContext));
- Context xResult;
+ rtl::OUString aName(RTL_CONSTASCII_USTRINGPARAM(k_TunneledContext));
+ uno::Reference< uno::XComponentContext > xResult;
if (xCurrContext->getValueByName(aName) >>= xResult)
{
if (xResult.is())
@@ -383,7 +384,7 @@ bool UnoContextTunnel::tunnelFailure(uno::Any const & aException, bool bRaise)
{
OSL_ASSERT( !aException.hasValue() || aException.getValueTypeClass() == uno::TypeClass_EXCEPTION );
- FailureTunnel xTunnel( uno::getCurrentContext(), uno::UNO_QUERY );
+ uno::Reference< lang::XUnoTunnel > xTunnel( uno::getCurrentContext(), uno::UNO_QUERY );
if (uno::Any * pFail = Tunnel::getFailure(xTunnel))
{
diff --git a/configmgr/source/misc/configunoreg.cxx b/configmgr/source/misc/configunoreg.cxx
index d2804d7c10..b63e7b8429 100644
--- a/configmgr/source/misc/configunoreg.cxx
+++ b/configmgr/source/misc/configunoreg.cxx
@@ -37,19 +37,6 @@
#include <cppuhelper/factory.hxx>
#include <rtl/ustrbuf.hxx>
-using ::rtl::OUString;
-using ::rtl::OUStringBuffer;
-using ::com::sun::star::uno::Reference;
-using ::com::sun::star::uno::Exception;
-using ::com::sun::star::uno::XInterface;
-using ::com::sun::star::uno::Sequence;
-using ::com::sun::star::registry::XRegistryKey;
-using ::com::sun::star::lang::XSingleComponentFactory;
-using ::com::sun::star::lang::XMultiServiceFactory;
-using ::configmgr::ServiceRegistrationInfo;
-using ::configmgr::SingletonRegistrationInfo;
-using ::configmgr::AsciiServiceName;
-
// ***************************************************************************************
//
// Die vorgeschriebene C-Api muss erfuellt werden!
@@ -58,47 +45,47 @@ using ::configmgr::AsciiServiceName;
//---------------------------------------------------------------------------------------
void RegisterService(
- const ServiceRegistrationInfo* pInfo,
- const Reference< XRegistryKey > & xKey)
+ const configmgr::ServiceRegistrationInfo* pInfo,
+ const com::sun::star::uno::Reference< com::sun::star::registry::XRegistryKey > & xKey)
{
if (pInfo == 0 || pInfo->registeredServiceNames==0 || pInfo->implementationName==0)
return;
- OUStringBuffer aMainKeyName;
+ rtl::OUStringBuffer aMainKeyName;
aMainKeyName.appendAscii("/");
aMainKeyName.appendAscii(pInfo->implementationName);
aMainKeyName.appendAscii("/UNO/SERVICES");
- Reference< XRegistryKey > xNewKey( xKey->createKey(aMainKeyName.makeStringAndClear()) );
+ com::sun::star::uno::Reference< com::sun::star::registry::XRegistryKey > xNewKey( xKey->createKey(aMainKeyName.makeStringAndClear()) );
OSL_ENSURE(xNewKey.is(), "CONFMGR::component_writeInfo : could not create a registry key !");
- for(AsciiServiceName const* p = pInfo->registeredServiceNames ; *p; ++p)
+ for(sal_Char const * const* p = pInfo->registeredServiceNames ; *p; ++p)
{
- xNewKey->createKey(OUString::createFromAscii(*p));
+ xNewKey->createKey(rtl::OUString::createFromAscii(*p));
}
}
//---------------------------------------------------------------------------------------
void RegisterSingleton(
- const SingletonRegistrationInfo* pInfo,
- const Reference< XRegistryKey > & xKey)
+ const configmgr::SingletonRegistrationInfo* pInfo,
+ const com::sun::star::uno::Reference< com::sun::star::registry::XRegistryKey > & xKey)
{
if (pInfo == 0 || pInfo->singletonName ==0 ||
pInfo->implementationName ==0 ||
pInfo->instantiatedServiceName ==0 )
return;
- OUStringBuffer aSingletonKeyName;
+ rtl::OUStringBuffer aSingletonKeyName;
aSingletonKeyName.appendAscii("/");
aSingletonKeyName.appendAscii(pInfo->implementationName);
aSingletonKeyName.appendAscii("/UNO/SINGLETONS/");
aSingletonKeyName.appendAscii(pInfo->singletonName);
- Reference< XRegistryKey > xNewKey( xKey->createKey(aSingletonKeyName.makeStringAndClear()) );
+ com::sun::star::uno::Reference< com::sun::star::registry::XRegistryKey > xNewKey( xKey->createKey(aSingletonKeyName.makeStringAndClear()) );
OSL_ENSURE(xNewKey.is(), "CONFMGR::component_writeInfo : could not create a registry key !");
- xNewKey->setStringValue(OUString::createFromAscii(pInfo->instantiatedServiceName));
+ xNewKey->setStringValue(rtl::OUString::createFromAscii(pInfo->instantiatedServiceName));
if (pInfo->mappedImplementation != 0)
RegisterService(pInfo->mappedImplementation,xKey);
@@ -108,22 +95,22 @@ void RegisterSingleton(
//-----------------------------------------------------------------------------
struct ServiceImplementationRequest
{
- Reference< XInterface > xRet;
- Reference< XMultiServiceFactory > const m_xServiceManager;
- OUString const sImplementationName;
+ com::sun::star::uno::Reference< com::sun::star::uno::XInterface > xRet;
+ com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > const m_xServiceManager;
+ rtl::OUString const sImplementationName;
//-------------------------------------------------------------------------
ServiceImplementationRequest(
void* pServiceManager,
sal_Char const* pImplementationName
)
- : m_xServiceManager(reinterpret_cast<XMultiServiceFactory*>(pServiceManager))
- , sImplementationName(OUString::createFromAscii(pImplementationName))
+ : m_xServiceManager(reinterpret_cast<com::sun::star::lang::XMultiServiceFactory*>(pServiceManager))
+ , sImplementationName(rtl::OUString::createFromAscii(pImplementationName))
{
}
//-------------------------------------------------------------------------
inline
- sal_Bool shouldCreate(const ServiceRegistrationInfo* pInfo) const
+ sal_Bool shouldCreate(const configmgr::ServiceRegistrationInfo* pInfo) const
{
OSL_ENSURE(!xRet.is(), "CreateProvider : invalid creation request: we already have a return value !");
return !xRet.is() &&
@@ -134,7 +121,7 @@ struct ServiceImplementationRequest
//-------------------------------------------------------------------------
sal_Bool CreateProviderFactory(
- const ServiceRegistrationInfo* pInfo,
+ const configmgr::ServiceRegistrationInfo* pInfo,
bool bAdmin
)
{
@@ -143,13 +130,13 @@ struct ServiceImplementationRequest
{
configmgr::ServiceRegistrationHelper aInfo(pInfo);
- const Sequence< OUString > Services= aInfo.getRegisteredServiceNames();
+ const com::sun::star::uno::Sequence< rtl::OUString > Services= aInfo.getRegisteredServiceNames();
xRet = configmgr::createProviderFactory( aInfo.getImplementationName(), bAdmin);
OSL_ENSURE(xRet.is(), "CreateProvider : WHERE IS THE return value !");
}
- catch(Exception&)
+ catch(com::sun::star::uno::Exception&)
{
}
return xRet.is();
@@ -158,7 +145,7 @@ struct ServiceImplementationRequest
//-------------------------------------------------------------------------
sal_Bool CreateServiceFactory(
- const ServiceRegistrationInfo* pInfo,
+ const configmgr::ServiceRegistrationInfo* pInfo,
::cppu::ComponentFactoryFunc Factory
)
{
@@ -167,13 +154,13 @@ struct ServiceImplementationRequest
{
configmgr::ServiceRegistrationHelper aInfo(pInfo);
- const Sequence< OUString > Services= aInfo.getRegisteredServiceNames();
+ const com::sun::star::uno::Sequence< rtl::OUString > Services= aInfo.getRegisteredServiceNames();
xRet = cppu::createSingleComponentFactory( Factory, aInfo.getImplementationName(), Services, 0);
OSL_ENSURE(xRet.is(), "CreateProvider : WHERE IS THE return value !");
}
- catch(Exception&)
+ catch(com::sun::star::uno::Exception&)
{
}
return xRet.is();
@@ -182,7 +169,7 @@ struct ServiceImplementationRequest
//-------------------------------------------------------------------------
sal_Bool CreateSingletonMapperFactory(
- const SingletonRegistrationInfo* pInfo,
+ const configmgr::SingletonRegistrationInfo* pInfo,
::cppu::ComponentFactoryFunc Mapper
)
{
@@ -222,7 +209,7 @@ extern "C" sal_Bool SAL_CALL component_writeInfo(
if (pRegistryKey)
try
{
- Reference< XRegistryKey > xKey(reinterpret_cast<XRegistryKey*>(pRegistryKey));
+ com::sun::star::uno::Reference< com::sun::star::registry::XRegistryKey > xKey(reinterpret_cast<com::sun::star::registry::XRegistryKey*>(pRegistryKey));
// configuration access entry points: configuration provider
RegisterSingleton(configmgr::getDefaultProviderSingletonInfo(), xKey) ;
diff --git a/configmgr/source/misc/filehelper.cxx b/configmgr/source/misc/filehelper.cxx
index f27c27110f..a0e8a5ffa1 100644
--- a/configmgr/source/misc/filehelper.cxx
+++ b/configmgr/source/misc/filehelper.cxx
@@ -44,8 +44,6 @@
namespace configmgr
{
- using namespace ::osl;
-
//==========================================================================
//= FileHelper
//==========================================================================
@@ -56,21 +54,21 @@ namespace configmgr
if (tryBackupFirst)
{
rtl::OUString aBakURL = _aURL.concat( ASCII(".bak") );
- File::RC eBakError = File::move(_aURL,aBakURL);
- if (eBakError == File::E_None)
+ osl::File::RC eBakError = osl::File::move(_aURL,aBakURL);
+ if (eBakError == osl::File::E_None)
return true;
}
- File::RC eError = File::remove(_aURL);
- return eError == File::E_None || eError == File::E_NOENT;
+ osl::File::RC eError = osl::File::remove(_aURL);
+ return eError == osl::File::E_None || eError == osl::File::E_NOENT;
}
// -----------------------------------------------------------------------------
void FileHelper::replaceFile(
- const rtl::OUString& _aToURL, const rtl::OUString &_aFromURL) CFG_THROW1 (io::IOException)
+ const rtl::OUString& _aToURL, const rtl::OUString &_aFromURL) SAL_THROW((io::IOException))
{
- File::remove(_aToURL);
- File::RC eError = File::move(_aFromURL, _aToURL);
- if (eError != File::E_None &&
- eError != File::E_NOENT)
+ osl::File::remove(_aToURL);
+ osl::File::RC eError = osl::File::move(_aFromURL, _aToURL);
+ if (eError != osl::File::E_None &&
+ eError != osl::File::E_NOENT)
{
rtl::OUStringBuffer sErrorBuf;
sErrorBuf.appendAscii("Configmgr: replaceFile failed ");
@@ -88,14 +86,14 @@ namespace configmgr
// -----------------------------------------------------------------------------
bool FileHelper::fileExists(rtl::OUString const& _sFileURL)
{
- DirectoryItem aItem;
- return DirectoryItem::get(_sFileURL, aItem) == Directory::E_None;
+ osl::DirectoryItem aItem;
+ return osl::DirectoryItem::get(_sFileURL, aItem) == osl::Directory::E_None;
}
// -----------------------------------------------------------------------------
bool FileHelper::dirExists(rtl::OUString const& _sDirURL)
{
- return Directory(_sDirURL).open() == Directory::E_None;
+ return osl::Directory(_sDirURL).open() == osl::Directory::E_None;
}
// -----------------------------------------------------------------------------
@@ -105,10 +103,10 @@ namespace configmgr
sal_uInt64 aSize = 0;
rModifyTime = k_NullTime;
- DirectoryItem aItem;
- if (osl::FileBase::E_None == DirectoryItem::get(_sURL, aItem))
+ osl::DirectoryItem aItem;
+ if (osl::FileBase::E_None == osl::DirectoryItem::get(_sURL, aItem))
{
- FileStatus aStatus(osl_FileStatus_Mask_ModifyTime|osl_FileStatus_Mask_Type|osl_FileStatus_Mask_FileSize);
+ osl::FileStatus aStatus(osl_FileStatus_Mask_ModifyTime|osl_FileStatus_Mask_Type|osl_FileStatus_Mask_FileSize);
if (osl::FileBase::E_None == aItem.getFileStatus(aStatus))
{
if (aStatus.isValid(osl_FileStatus_Mask_ModifyTime))
@@ -122,189 +120,189 @@ namespace configmgr
}
// -----------------------------------------------------------------------------
- rtl::OUString FileHelper::createOSLErrorString(FileBase::RC eError)
+ rtl::OUString FileHelper::createOSLErrorString(osl::FileBase::RC eError)
{
rtl::OUString aRet;
switch(eError)
{
- case FileBase::E_None:
+ case osl::FileBase::E_None:
break;
- case FileBase::E_PERM:
+ case osl::FileBase::E_PERM:
aRet = ASCII("Operation not permitted");
break;
- case FileBase::E_NOENT:
+ case osl::FileBase::E_NOENT:
aRet = ASCII("No such file or directory");
break;
- case FileBase::E_SRCH:
+ case osl::FileBase::E_SRCH:
aRet = ASCII("unknown error: osl_File_E_SRCH");
break;
- case FileBase::E_INTR:
+ case osl::FileBase::E_INTR:
aRet = ASCII("function call was interrupted");
break;
- case FileBase::E_IO:
+ case osl::FileBase::E_IO:
aRet = ASCII("I/O error");
break;
- case FileBase::E_NXIO:
+ case osl::FileBase::E_NXIO:
aRet = ASCII("No such device or address");
break;
- case FileBase::E_2BIG:
+ case osl::FileBase::E_2BIG:
aRet = ASCII("unknown error: osl_File_E_2BIG");
break;
- case FileBase::E_NOEXEC:
+ case osl::FileBase::E_NOEXEC:
aRet = ASCII("unknown error: osl_File_E_NOEXEC");
break;
- case FileBase::E_BADF:
+ case osl::FileBase::E_BADF:
aRet = ASCII("Bad file");
break;
- case FileBase::E_CHILD:
+ case osl::FileBase::E_CHILD:
aRet = ASCII("unknown error: osl_File_E_CHILD");
break;
- case FileBase::E_AGAIN:
+ case osl::FileBase::E_AGAIN:
aRet = ASCII("Operation would block");
break;
- case FileBase::E_NOMEM:
+ case osl::FileBase::E_NOMEM:
aRet = ASCII("not enough memory for allocating structures");
break;
- case FileBase::E_ACCES:
+ case osl::FileBase::E_ACCES:
aRet = ASCII("Permission denied");
break;
- case FileBase::E_FAULT:
+ case osl::FileBase::E_FAULT:
aRet = ASCII("Bad address");
break;
- case FileBase::E_BUSY:
+ case osl::FileBase::E_BUSY:
aRet = ASCII("Text file busy");
break;
- case FileBase::E_EXIST:
+ case osl::FileBase::E_EXIST:
aRet = ASCII("File exists");
break;
- case FileBase::E_XDEV:
+ case osl::FileBase::E_XDEV:
aRet = ASCII("unknown error: osl_File_E_XDEV");
break;
- case FileBase::E_NODEV:
+ case osl::FileBase::E_NODEV:
aRet = ASCII("No such device");
break;
- case FileBase::E_NOTDIR:
+ case osl::FileBase::E_NOTDIR:
aRet = ASCII("Not a directory");
break;
- case FileBase::E_ISDIR:
+ case osl::FileBase::E_ISDIR:
aRet = ASCII("Is a director");
break;
- case FileBase::E_INVAL:
+ case osl::FileBase::E_INVAL:
aRet = ASCII("the format of the parameters was not valid");
break;
- case FileBase::E_NFILE:
+ case osl::FileBase::E_NFILE:
aRet = ASCII("too many open files in the system");
break;
- case FileBase::E_MFILE:
+ case osl::FileBase::E_MFILE:
aRet = ASCII("too many open files used by the process");
break;
- case FileBase::E_NOTTY:
+ case osl::FileBase::E_NOTTY:
aRet = ASCII("unknown error: osl_File_E_NOTTY");
break;
- case FileBase::E_FBIG:
+ case osl::FileBase::E_FBIG:
aRet = ASCII("File too large");
break;
- case FileBase::E_NOSPC:
+ case osl::FileBase::E_NOSPC:
aRet = ASCII("No space left on device");
break;
- case FileBase::E_SPIPE:
+ case osl::FileBase::E_SPIPE:
aRet = ASCII("unknown error: osl_File_E_SPIPE");
break;
- case FileBase::E_ROFS:
+ case osl::FileBase::E_ROFS:
aRet = ASCII("Read-only file system");
break;
- case FileBase::E_MLINK:
+ case osl::FileBase::E_MLINK:
aRet = ASCII("Too many links");
break;
- case FileBase::E_PIPE:
+ case osl::FileBase::E_PIPE:
aRet = ASCII("unknown error: osl_File_E_PIPE");
break;
- case FileBase::E_DOM:
+ case osl::FileBase::E_DOM:
aRet = ASCII("unknown error: osl_File_E_DOM");
break;
- case FileBase::E_RANGE:
+ case osl::FileBase::E_RANGE:
aRet = ASCII("unknown error: osl_File_E_RANGE");
break;
- case FileBase::E_DEADLK:
+ case osl::FileBase::E_DEADLK:
aRet = ASCII("unknown error: osl_File_E_DEADLK");
break;
- case FileBase::E_NAMETOOLONG:
+ case osl::FileBase::E_NAMETOOLONG:
aRet = ASCII("File name too long");
break;
- case FileBase::E_NOLCK:
+ case osl::FileBase::E_NOLCK:
aRet = ASCII("No record locks available");
break;
- case FileBase::E_NOSYS:
+ case osl::FileBase::E_NOSYS:
aRet = ASCII("Function not implemente");
break;
- case FileBase::E_NOTEMPTY:
+ case osl::FileBase::E_NOTEMPTY:
aRet = ASCII("Directory not empt");
break;
- case FileBase::E_LOOP:
+ case osl::FileBase::E_LOOP:
aRet = ASCII("Too many symbolic links encountered");
break;
- case FileBase::E_ILSEQ:
+ case osl::FileBase::E_ILSEQ:
aRet = ASCII("unknown error: osl_File_E_ILSEQ");
break;
- case FileBase::E_NOLINK:
+ case osl::FileBase::E_NOLINK:
aRet = ASCII("Link has been severed");
break;
- case FileBase::E_MULTIHOP:
+ case osl::FileBase::E_MULTIHOP:
aRet = ASCII("Multihop attempted");
break;
- case FileBase::E_USERS:
+ case osl::FileBase::E_USERS:
aRet = ASCII("unknown error: osl_File_E_USERS");
break;
- case FileBase::E_OVERFLOW:
+ case osl::FileBase::E_OVERFLOW:
aRet = ASCII("Value too large for defined data type");
break;
/* unmapped error: always last entry in enum! */
default: OSL_ENSURE(false, "Found unknown OSL File Error");
- case FileBase::E_invalidError:
+ case osl::FileBase::E_invalidError:
aRet = ASCII("unmapped Error");
break;
}
diff --git a/configmgr/source/misc/logger.cxx b/configmgr/source/misc/logger.cxx
index 44f6d23dd2..3b35c39f27 100644
--- a/configmgr/source/misc/logger.cxx
+++ b/configmgr/source/misc/logger.cxx
@@ -34,9 +34,9 @@
#include "logger.hxx"
#define CONFIG_LOGGER_SINGLETON "/singletons/com.sun.star.configuration.theLogger"
-#define OUSTR( lit ) OUString( RTL_CONSTASCII_USTRINGPARAM( lit ) )
+#define OUSTR( lit ) rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( lit ) )
#define OU2A( ustr ) rtl::OUStringToOString( ustr, RTL_TEXTENCODING_UTF8 ).getStr()
-#define A2OU( astr ) OUString::createFromAscii( astr )
+#define A2OU( astr ) rtl::OUString::createFromAscii( astr )
static const sal_Char k_unspecifiedClass[] = "configmgr";
static const sal_Char k_unspecifiedMethod[] = "log-message";
@@ -45,7 +45,7 @@ namespace configmgr
{
//--------------------------------------------------------------------------
-void Logger::log(Level nLevel, const char * msg, const char * sourceMethod, const char * sourceClass) const
+void Logger::log(sal_Int32 nLevel, const char * msg, const char * sourceMethod, const char * sourceClass) const
{
OSL_ASSERT(msg);
if (!msg) msg = "";
@@ -54,7 +54,7 @@ void Logger::log(Level nLevel, const char * msg, const char * sourceMethod, cons
}
//--------------------------------------------------------------------------
-void Logger::log(Level nLevel, const OUString & msg, const char * sourceMethod, const char * sourceClass) const
+void Logger::log(sal_Int32 nLevel, const rtl::OUString & msg, const char * sourceMethod, const char * sourceClass) const
{
if (!sourceClass) sourceClass = k_unspecifiedClass;
if (!sourceMethod) sourceMethod = k_unspecifiedMethod;
diff --git a/configmgr/source/misc/mergechange.cxx b/configmgr/source/misc/mergechange.cxx
index 8ae738ff85..53ff14512d 100644
--- a/configmgr/source/misc/mergechange.cxx
+++ b/configmgr/source/misc/mergechange.cxx
@@ -31,38 +31,30 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_configmgr.hxx"
-#include <stdio.h>
-
+#include "builddata.hxx"
#include "mergechange.hxx"
#include "updatehelper.hxx"
#include "treeactions.hxx"
+#include "treefragment.hxx"
#include "change.hxx"
#include "treechangefactory.hxx"
#include "treechangelist.hxx"
#include "configexcept.hxx"
-#include "treeaccessor.hxx"
-
-
#include "tracer.hxx"
#define ASCII(x) rtl::OUString::createFromAscii(x)
namespace configmgr
{
- using namespace com::sun::star::uno;
- using namespace configuration;
- using namespace std;
-
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
- class OMergeChanges : private ChangeTreeAction, private OPathCreator<RelativePath>
+ class OMergeChanges : private ChangeTreeAction, private OPathCreator<configuration::RelativePath>
{
SubtreeChange &m_rSubtreeChange; // ChangeList, which will be grown
SubtreeChange *m_pCurrentParent; // our current position
- typedef configuration::RelativePath RelativePath;
// ------- Helper for Path stack -------
SubtreeChange* pushTree(SubtreeChange& _rTree);
void popTree(SubtreeChange* _pSaveTree);
@@ -73,11 +65,11 @@ namespace configmgr
// start function, with the Change we want to do.
// WARNING this could be a big tree, because a change can contain subtreechanges!
- void mergeChanges(const SubtreeChange &_rChange, const RelativePath& _aPathToChange);
+ void mergeChanges(const SubtreeChange &_rChange, const configuration::RelativePath& _aPathToChange);
void mergeChanges(const SubtreeChange &_rChange);
private:
- void initRoot(const SubtreeChange &_rRootChange, const RelativePath& _aPathToChange);
+ void initRoot(const SubtreeChange &_rRootChange, const configuration::RelativePath& _aPathToChange);
private:
virtual void handle(ValueChange const& _rValueNode);
virtual void handle(AddNode const& _rAddNode);
@@ -93,23 +85,23 @@ namespace configmgr
}
// -----------------------------------------------------------------------------
- Path::Component ONameCreator::createName(Change const& _rChange, SubtreeChange const* _pParent)
+ configuration::Path::Component ONameCreator::createName(Change const& _rChange, SubtreeChange const* _pParent)
{
OSL_ENSURE(_pParent, "ONameCreator: Cannot create proper name without a parent");
if (_pParent && _pParent->isSetNodeChange())
{
- OUString sElementName = _rChange.getNodeName();
- OUString sTypeName = _pParent->getElementTemplateName();
+ rtl::OUString sElementName = _rChange.getNodeName();
+ rtl::OUString sTypeName = _pParent->getElementTemplateName();
- return Path::makeCompositeName(sElementName, sTypeName);
+ return configuration::Path::makeCompositeName(sElementName, sTypeName);
}
else
{
- OUString sElementName = _rChange.getNodeName();
+ rtl::OUString sElementName = _rChange.getNodeName();
// OSL_ENSURE(isSimpleName(sElementName),"Unexpected: Non-simple name in non-set node");
- return Path::wrapSafeName(sElementName);
+ return configuration::Path::wrapSafeName(sElementName);
}
}
@@ -198,7 +190,8 @@ namespace configmgr
else
{
// POST: Handle ValueChange in AddNode
- std::auto_ptr<INode> pAddedNode = _rAddNode.getNewTree().cloneData(false);
+ rtl::Reference< data::TreeSegment > seg(_rAddNode.getNewTree());
+ std::auto_ptr<INode> pAddedNode = data::convertTree(seg.is() ? seg->fragment : 0, false);
if (ValueNode *pValueNode = pAddedNode->asValueNode())
{
@@ -236,7 +229,7 @@ namespace configmgr
if (pAddedNode.get() != NULL)
{
- data::TreeSegment aNewTree = data::TreeSegment::createNew(_rAddNode.getNodeName(),pAddedNode);
+ rtl::Reference< data::TreeSegment > aNewTree = data::TreeSegment::create(_rAddNode.getNodeName(),pAddedNode);
std::auto_ptr<AddNode> pNewAdd( new AddNode(aNewTree,m_aValueChange.getNodeName(), m_aValueChange.isToDefault()) );
if (_rAddNode.isReplacing())
@@ -315,11 +308,11 @@ namespace configmgr
static
inline
- Change* findExistingChange(SubtreeChange* pCurrentParent, Path::Component const & _aName)
+ Change* findExistingChange(SubtreeChange* pCurrentParent, configuration::Path::Component const & _aName)
{
OSL_ASSERT(pCurrentParent);
- Change *pChange = pCurrentParent->getChange(_aName.getName().toString());
+ Change *pChange = pCurrentParent->getChange(_aName.getName());
if (!pChange && !_aName.isSimpleName())
{
@@ -332,7 +325,7 @@ namespace configmgr
static
inline
- Change* findExistingChange(SubtreeChange* pCurrentParent, OUString const & _aName)
+ Change* findExistingChange(SubtreeChange* pCurrentParent, rtl::OUString const & _aName)
{
OSL_ASSERT(pCurrentParent);
@@ -377,18 +370,18 @@ namespace configmgr
}
// -----------------------------------------------------------------------------
- void OMergeChanges::initRoot(const SubtreeChange &_rRootChange, const RelativePath& _aPathToChange)
+ void OMergeChanges::initRoot(const SubtreeChange &_rRootChange, const configuration::RelativePath& _aPathToChange)
{
SubtreeChange* pCurrentParent = &m_rSubtreeChange;
if (!_aPathToChange.isEmpty())
{
- OSL_PRECOND(_aPathToChange.getLocalName().getName().toString() == _rRootChange.getNodeName(),
+ OSL_PRECOND(_aPathToChange.getLocalName().getName() == _rRootChange.getNodeName(),
"Path to change root does not match change being merged" );
- RelativePath::Iterator const firstEnsure = _aPathToChange.begin();
- RelativePath::Iterator lastEnsure = _aPathToChange.end();
- RelativePath::Iterator it;
+ std::vector<configuration::Path::Component>::const_reverse_iterator const firstEnsure = _aPathToChange.begin();
+ std::vector<configuration::Path::Component>::const_reverse_iterator lastEnsure = _aPathToChange.end();
+ std::vector<configuration::Path::Component>::const_reverse_iterator it;
OSL_ASSERT( firstEnsure != lastEnsure );
--lastEnsure; // last to ensure is the actual root
@@ -402,10 +395,10 @@ namespace configmgr
if (!pChange)
{
OSL_ASSERT( it+1 != _aPathToChange.end());
- Name const aElementTypeName = (it+1)->getTypeName();
+ rtl::OUString const aElementTypeName = (it+1)->getTypeName();
// create a correspondens for the name, we did not find.
- auto_ptr<SubtreeChange> pNewChange =
+ std::auto_ptr<SubtreeChange> pNewChange =
OTreeChangeFactory::createDummyChange(it->getName(), aElementTypeName);
pChange = pNewChange.get();
@@ -416,12 +409,12 @@ namespace configmgr
"ERROR: Newly added change cannot be found in parent change");
}
- if (!pChange->ISA(SubtreeChange))
+ pCurrentParent = dynamic_cast<SubtreeChange*>( pChange);
+ if (pCurrentParent == 0)
{
OSL_ENSURE(false, "Change to merge does not point to a Subtree Change");
- throw InvalidName(_aPathToChange.toString(), "points to a non- subtree change in this changes list, but a subtree change is required as root.");
+ throw configuration::InvalidName(_aPathToChange.toString(), "points to a non- subtree change in this changes list, but a subtree change is required as root.");
}
- pCurrentParent = static_cast<SubtreeChange*>( pChange);
}
Change *pRootChange = findExistingChange(pCurrentParent,*lastEnsure);
@@ -429,8 +422,8 @@ namespace configmgr
if (!pRootChange)
{
// create a correspondens for the name, we did not find.
- auto_ptr<SubtreeChange> pNewChange(
- new SubtreeChange(_rRootChange, SubtreeChange::NoChildCopy()) );
+ std::auto_ptr<SubtreeChange> pNewChange(
+ new SubtreeChange(_rRootChange, treeop::NoChildCopy()) );
pRootChange = pNewChange.get();
@@ -440,12 +433,12 @@ namespace configmgr
"ERROR: Newly added change cannot be found in parent change");
}
- if (!pRootChange->ISA(SubtreeChange))
+ pCurrentParent = dynamic_cast<SubtreeChange*>( pRootChange);
+ if (pCurrentParent == 0)
{
OSL_ENSURE(false, "Change to merge does not point to a Subtree Change");
- throw InvalidName(_aPathToChange.toString(), "points to a non-subtree change in this changes list, but a subtree change is required as root.");
+ throw configuration::InvalidName(_aPathToChange.toString(), "points to a non-subtree change in this changes list, but a subtree change is required as root.");
}
- pCurrentParent = static_cast<SubtreeChange*>( pRootChange);
}
OSL_ENSURE(pCurrentParent->getNodeName() == _rRootChange.getNodeName(),
@@ -480,13 +473,13 @@ namespace configmgr
// WARNING this could be a big tree, because a change can contain subtreechanges!
void OMergeChanges::mergeChanges(const SubtreeChange &_rChange)
{
- mergeChanges(_rChange, RelativePath());
+ mergeChanges(_rChange, configuration::RelativePath());
}
// -----------------------------------------------------------------------------
// start function, with the Change we want to do.
// WARNING this could be a big tree, because a change can contain subtreechanges!
- void OMergeChanges::mergeChanges(const SubtreeChange &_rChange, const RelativePath& _aPathToChange)
+ void OMergeChanges::mergeChanges(const SubtreeChange &_rChange, const configuration::RelativePath& _aPathToChange)
{
initRoot(_rChange, _aPathToChange); // path location being merged must exist
@@ -506,7 +499,7 @@ namespace configmgr
void OMergeChanges::handle(ValueChange const& _rValueNode)
{
// Handle a ValueChange,
- OUString aNodeName = _rValueNode.getNodeName();
+ rtl::OUString aNodeName = _rValueNode.getNodeName();
if (Change *pChange = findExistingChange(m_pCurrentParent,aNodeName))
{
@@ -517,7 +510,7 @@ namespace configmgr
else
{
// there is no ValueChange in the List, insert new one
- auto_ptr<Change> pNewChange(new ValueChange(_rValueNode));
+ std::auto_ptr<Change> pNewChange(new ValueChange(_rValueNode));
m_pCurrentParent->addChange(pNewChange);
}
}
@@ -528,11 +521,11 @@ namespace configmgr
// Handle an AddNode
bool bReplacing = _rAddNode.isReplacing();
- OUString aNodeName = _rAddNode.getNodeName();
+ rtl::OUString aNodeName = _rAddNode.getNodeName();
if (Change *pChange = findExistingChange(m_pCurrentParent,aNodeName))
{
- OSL_ENSURE(pChange->ISA(RemoveNode) || bReplacing, "OMergeChanges::handle(AddNode): the changes tree given already contains a change for this!");
+ OSL_ENSURE(dynamic_cast< RemoveNode * >(pChange) != 0 || bReplacing, "OMergeChanges::handle(AddNode): the changes tree given already contains a change for this!");
m_pCurrentParent->removeChange(pChange->getNodeName());
@@ -540,13 +533,13 @@ namespace configmgr
}
// insert manually
- data::TreeSegment aAddedTree = _rAddNode.getNewTree().cloneSegment();
+ rtl::Reference< data::TreeSegment > aAddedTree = data::TreeSegment::create(_rAddNode.getNewTree());
- auto_ptr<AddNode> pNewAdd(new AddNode(aAddedTree, _rAddNode.getNodeName(), _rAddNode.isToDefault()));
+ std::auto_ptr<AddNode> pNewAdd(new AddNode(aAddedTree, _rAddNode.getNodeName(), _rAddNode.isToDefault()));
if (bReplacing)
pNewAdd->setReplacing();
- auto_ptr<Change> pNewChange( pNewAdd.release() );
+ std::auto_ptr<Change> pNewChange( pNewAdd.release() );
m_pCurrentParent->addChange(pNewChange);
}
// -----------------------------------------------------------------------------
@@ -554,7 +547,7 @@ namespace configmgr
void OMergeChanges::handle(RemoveNode const& _rRemoveNode)
{
// Handle a RemoveNode
- OUString aNodeName = _rRemoveNode.getNodeName();
+ rtl::OUString aNodeName = _rRemoveNode.getNodeName();
Change *pChange = findExistingChange(m_pCurrentParent,aNodeName);
@@ -578,7 +571,7 @@ namespace configmgr
// defaulting this so that the node will be marked as deleted
case OMergeRemoveNode::FlagDeleted:
{
- auto_ptr<Change> pNewChange(new RemoveNode(_rRemoveNode.getNodeName(),_rRemoveNode.isToDefault()));
+ std::auto_ptr<Change> pNewChange(new RemoveNode(_rRemoveNode.getNodeName(),_rRemoveNode.isToDefault()));
m_pCurrentParent->addChange(pNewChange);
}
break;
@@ -601,7 +594,7 @@ namespace configmgr
{
if (_rAddNode.isToDefault())
{
- data::TreeSegment::TreeDataPtr pAdded = _rAddNode.getNewTreeData();
+ sharable::TreeFragment const * pAdded = _rAddNode.getNewTreeData();
OSL_ENSURE(pAdded,"No Data in AddNode");
if (pAdded == NULL || pAdded->getAttributes().isDefault())
stripOne(_rAddNode);
@@ -623,9 +616,7 @@ namespace configmgr
OStripDefaults& OStripDefaults::strip()
{
- typedef SubtreeChange::MutatingChildIterator Iter;
-
- Iter it = m_rParent.begin_changes(), stop = m_rParent.end_changes();
+ SubtreeChange::MutatingChildIterator it = m_rParent.begin_changes(), stop = m_rParent.end_changes();
while (it != stop)
{
@@ -664,29 +655,30 @@ namespace configmgr
// with the pointer m_pCurrentParent we remember our SubtreeChange in witch we
// add all other Changes.
- OUString aNodeName = _rSubtree.getNodeName();
+ rtl::OUString aNodeName = _rSubtree.getNodeName();
Change *pChange = findExistingChange(m_pCurrentParent,aNodeName);
// const sal_Char* pType = pChange ? pChange->getType() : NULL;
SubtreeChange* pSubtreeChange = NULL;
- if (pChange == NULL || pChange->ISA(SubtreeChange))
+ if (pChange == NULL || dynamic_cast< SubtreeChange * >(pChange) != 0)
{
// need to create a new Subtreechange
if (!pChange)
{
// create a new SubtreeChange
- auto_ptr<SubtreeChange> pNewChange(new SubtreeChange(_rSubtree, SubtreeChange::NoChildCopy()));
+ std::auto_ptr<SubtreeChange> pNewChange(new SubtreeChange(_rSubtree, treeop::NoChildCopy()));
pSubtreeChange = pNewChange.get();
// add the new SubtreeChange in m_aTreeChangeList
- m_pCurrentParent->addChange(auto_ptr<Change>(pNewChange.release()));
+ m_pCurrentParent->addChange(std::auto_ptr<Change>(pNewChange.release()));
// check list for this new SubtreeChange
OSL_ASSERT(pSubtreeChange == findExistingChange(m_pCurrentParent,aNodeName));
}
- else // hard cast(!) to SubtreeChange because we are a SubtreeChange
+ else
{
- pSubtreeChange = static_cast<SubtreeChange*>(pChange);
+ pSubtreeChange = dynamic_cast<SubtreeChange*>(pChange);
+ OSL_ASSERT(pSubtreeChange != 0);
adjustElementTemplate(*pSubtreeChange,_rSubtree);
}
@@ -695,13 +687,10 @@ namespace configmgr
this->applyToChildren(_rSubtree);
popTree( pSaveParent );
}
- else if (pChange->ISA(AddNode))
+ else if (AddNode* pAddNode = dynamic_cast<AddNode*>(pChange))
{
- AddNode* pAddNode = static_cast<AddNode*>(pChange);
-
-// -----------------------------------------------------------------------------
-// -----------------------------------------------------------------------------
- std::auto_ptr<INode> pAddedNode = pAddNode->getNewTree().cloneData(false);
+ rtl::Reference< data::TreeSegment > seg(pAddNode->getNewTree());
+ std::auto_ptr<INode> pAddedNode = data::convertTree(seg.is() ? seg->fragment : 0, false);
ISubtree* pSubtree = pAddedNode.get() ? pAddedNode->asISubtree() : 0;
if (pSubtree)
{
@@ -712,7 +701,7 @@ namespace configmgr
aTreeUpdate.applyToChildren(_rSubtree);
// make a new subtree with the changed data
- data::TreeSegment aNewTree = data::TreeSegment::createNew(pAddNode->getNodeName(), pAddedNode);
+ rtl::Reference< data::TreeSegment > aNewTree = data::TreeSegment::create(pAddNode->getNodeName(), pAddedNode);
std::auto_ptr<AddNode> pNewAdd( new AddNode(aNewTree, pAddNode->getNodeName(), pAddNode->isToDefault()) );
if (pAddNode->isReplacing())
@@ -779,7 +768,8 @@ namespace configmgr
#endif
}
- auto_ptr<INode> pNode = auto_ptr<INode>(aAddNode.getNewTree().cloneData(true));
+ rtl::Reference< data::TreeSegment > seg(aAddNode.getNewTree());
+ std::auto_ptr<INode> pNode(data::convertTree(seg.is() ? seg->fragment : 0, true));
m_pCurrentSubtree->addChild(pNode);
}
diff --git a/configmgr/source/misc/oslstream.cxx b/configmgr/source/misc/oslstream.cxx
index 5221ba8176..ed4c7056c1 100644
--- a/configmgr/source/misc/oslstream.cxx
+++ b/configmgr/source/misc/oslstream.cxx
@@ -36,17 +36,15 @@
namespace configmgr
{
- using namespace osl;
-
static void raiseIOException(osl::File::RC error, staruno::Reference<staruno::XInterface> const & context)
{
const rtl::OUString message = FileHelper::createOSLErrorString(error);
switch (error)
{
- case File::E_NOMEM:
+ case osl::File::E_NOMEM:
throw stario::BufferSizeExceededException(message, context);
- case File::E_BADF:
+ case osl::File::E_BADF:
throw stario::NotConnectedException(message, context);
default:
@@ -54,14 +52,14 @@ namespace configmgr
}
}
//------------------------------------------------------------------
-OSLInputStreamWrapper::OSLInputStreamWrapper( File& _rFile )
+OSLInputStreamWrapper::OSLInputStreamWrapper( osl::File& _rFile )
:m_pFile(&_rFile)
,m_bFileOwner(sal_False)
{
}
//------------------------------------------------------------------
-OSLInputStreamWrapper::OSLInputStreamWrapper( File* pStream, sal_Bool bOwner )
+OSLInputStreamWrapper::OSLInputStreamWrapper( osl::File* pStream, sal_Bool bOwner )
:m_pFile( pStream )
,m_bFileOwner( bOwner )
{
@@ -89,8 +87,8 @@ sal_Int32 SAL_CALL OSLInputStreamWrapper::readBytes(staruno::Sequence< sal_Int8
aData.realloc(nBytesToRead);
sal_uInt64 nRead = 0;
- File::RC eError = m_pFile->read(aData.getArray(), nBytesToRead, nRead);
- if (eError != File::E_None)
+ osl::File::RC eError = m_pFile->read(aData.getArray(), nBytesToRead, nRead);
+ if (eError != osl::File::E_None)
throw stario::BufferSizeExceededException(::rtl::OUString(),static_cast<staruno::XWeak*>(this));
// Wenn gelesene Zeichen < MaxLength, staruno::Sequence anpassen
@@ -131,8 +129,8 @@ void SAL_CALL OSLInputStreamWrapper::skipBytes(sal_Int32 nBytesToSkip) throw( st
m_pFile->getPos(nCurrentPos);
sal_uInt64 nNewPos = nCurrentPos + nBytesToSkip;
- File::RC eError = m_pFile->setPos(osl_Pos_Absolut, nNewPos);
- if (eError != File::E_None)
+ osl::File::RC eError = m_pFile->setPos(osl_Pos_Absolut, nNewPos);
+ if (eError != osl::File::E_None)
{
throw stario::NotConnectedException(::rtl::OUString(), static_cast<staruno::XWeak*>(this));
}
@@ -146,23 +144,23 @@ sal_Int32 SAL_CALL OSLInputStreamWrapper::available() throw( stario::NotConnecte
throw stario::NotConnectedException(::rtl::OUString(), static_cast<staruno::XWeak*>(this));
sal_uInt64 nPos;
- File::RC eError = m_pFile->getPos(nPos);
- if (eError != File::E_None)
+ osl::File::RC eError = m_pFile->getPos(nPos);
+ if (eError != osl::File::E_None)
throw stario::NotConnectedException(::rtl::OUString(), static_cast<staruno::XWeak*>(this));
sal_uInt64 nDummy = 0;
eError = m_pFile->setPos(Pos_End, nDummy);
- if (eError != File::E_None)
+ if (eError != osl::File::E_None)
throw stario::NotConnectedException(::rtl::OUString(),static_cast<staruno::XWeak*>(this));
sal_uInt64 nAvailable;
eError = m_pFile->getPos(nAvailable);
- if (eError != File::E_None)
+ if (eError != osl::File::E_None)
throw stario::NotConnectedException(::rtl::OUString(),static_cast<staruno::XWeak*>(this));
nAvailable = nAvailable - nPos;
eError = m_pFile->setPos(Pos_Absolut, nPos);
- if (eError != File::E_None)
+ if (eError != osl::File::E_None)
throw stario::NotConnectedException(::rtl::OUString(),static_cast<staruno::XWeak*>(this));
return sal::static_int_cast<sal_Int32>( nAvailable );
}
@@ -189,8 +187,8 @@ void SAL_CALL OSLOutputStreamWrapper::writeBytes(const staruno::Sequence< sal_In
if (nLength != 0)
{
sal_uInt64 nWritten;
- File::RC eError = rFile.write(aData.getConstArray(),nLength, nWritten);
- if (eError != File::E_None || nWritten != nLength)
+ osl::File::RC eError = rFile.write(aData.getConstArray(),nLength, nWritten);
+ if (eError != osl::File::E_None || nWritten != nLength)
{
throw stario::BufferSizeExceededException(::rtl::OUString(),static_cast<staruno::XWeak*>(this));
}
@@ -217,7 +215,7 @@ BufferedFileOutputStream::BufferedFileOutputStream( rtl::OUString const & aFileU
sal_Int32 flags = bCreate ? OpenFlag_Write|OpenFlag_Create : OpenFlag_Write;
osl::File::RC rc = m_aFile.open(flags);
- if (rc != File::E_None)
+ if (rc != osl::File::E_None)
raiseIOException(rc,NULL);
}
@@ -235,12 +233,12 @@ void SAL_CALL BufferedFileOutputStream::writeBytes(const staruno::Sequence< sal_
sal_uInt64 written = 0;
osl::File::RC rc = m_aFile.write(aData.getConstArray(), size, written);
- if (rc != File::E_None)
+ if (rc != osl::File::E_None)
raiseIOException(rc,*this);
// we don't support special files where multiple write passes are needed
if (written < size)
- raiseIOException(File::E_IO,*this);
+ raiseIOException(osl::File::E_IO,*this);
}
void SAL_CALL BufferedFileOutputStream::flush()
@@ -248,7 +246,7 @@ void SAL_CALL BufferedFileOutputStream::flush()
stario::IOException, staruno::RuntimeException )
{
osl::File::RC rc = m_aFile.sync();
- if (rc != File::E_None)
+ if (rc != osl::File::E_None)
raiseIOException(rc,*this);
}
@@ -257,7 +255,7 @@ void SAL_CALL BufferedFileOutputStream::closeOutput()
stario::IOException, staruno::RuntimeException )
{
osl::File::RC rc = m_aFile.close();
- if (rc != File::E_None)
+ if (rc != osl::File::E_None)
raiseIOException(rc,*this);
}
diff --git a/configmgr/source/misc/providerfactory.cxx b/configmgr/source/misc/providerfactory.cxx
index 7de84aff9e..77f7432257 100644
--- a/configmgr/source/misc/providerfactory.cxx
+++ b/configmgr/source/misc/providerfactory.cxx
@@ -55,7 +55,7 @@ namespace configmgr
//---------------------------------------------------------------------------------------
- ProviderFactory::ProviderFactory(OUString const & aImplementationName, bool bAdmin)
+ ProviderFactory::ProviderFactory(rtl::OUString const & aImplementationName, bool bAdmin)
: m_aImplementationName(aImplementationName)
, m_bAdmin(bAdmin)
{
@@ -67,7 +67,7 @@ namespace configmgr
}
//---------------------------------------------------------------------------------------
- uno::Reference< uno::XInterface > ProviderFactory::getProviderAlways(Context const & xContext)
+ uno::Reference< uno::XInterface > ProviderFactory::getProviderAlways(uno::Reference< uno::XComponentContext > const & xContext)
{
RTL_LOGFILE_CONTEXT_AUTHOR(aLog, "configmgr::ProviderFactory", "jb99855", "configmgr::ProviderFactory::getProviderAlways()");
uno::Reference< uno::XInterface > xResult = getDefaultConfigProviderSingleton(xContext);
@@ -76,17 +76,15 @@ namespace configmgr
OSL_ENSURE(xResult.is(), "Context could not create provider, but returned NULL instead of throwing an exception");
if (!xResult.is())
{
- using ::com::sun::star::configuration::CannotLoadConfigurationException;
-
static sal_Char const sCannotCreate[] = "Cannot create ConfigurationProvider. Unknown backend or factory error.";
- throw CannotLoadConfigurationException( OUString(RTL_CONSTASCII_USTRINGPARAM(sCannotCreate)), *this );
+ throw com::sun::star::configuration::CannotLoadConfigurationException( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sCannotCreate)), *this );
}
return xResult;
}
//---------------------------------------------------------------------------------------
- uno::Reference< uno::XInterface > ProviderFactory::getProviderFromContext(Context const & xContext)
+ uno::Reference< uno::XInterface > ProviderFactory::getProviderFromContext(uno::Reference< uno::XComponentContext > const & xContext)
{
OSL_ENSURE(ContextReader::testAdminService(xContext, this->m_bAdmin),
"Creation context admin flag does not match service being created");
@@ -109,20 +107,20 @@ namespace configmgr
OSL_ASSERT(aContext.isBootstrapValid());
static const sal_Char sErrContext[] = "Cannot open Configuration: ";
- OUString const sContext(RTL_CONSTASCII_USTRINGPARAM(sErrContext));
+ rtl::OUString const sContext(RTL_CONSTASCII_USTRINGPARAM(sErrContext));
e.Message = sContext.concat(e.Message);
throw;
}
}
//---------------------------------------------------------------------------------------
- uno::Reference< uno::XInterface > ProviderFactory::createProviderWithArguments(Context const & xContext, Arguments const & _aArguments)
+ uno::Reference< uno::XInterface > ProviderFactory::createProviderWithArguments(uno::Reference< uno::XComponentContext > const & xContext, uno::Sequence < uno::Any > const & _aArguments)
{
RTL_LOGFILE_CONTEXT_AUTHOR(aLog, "configmgr::ProviderFactory", "jb99855", "configmgr::ProviderFactory::createProviderWithArguments()");
ContextReader aContext(xContext);
ArgumentHelper aParser(aContext.getBootstrapContext());
- NamedValues aValues(_aArguments.getLength() + 2);
+ uno::Sequence < beans::NamedValue > aValues(_aArguments.getLength() + 2);
sal_Int32 nCount = parseArguments(aParser,aValues,_aArguments);
bool bNeedNewBackend = aParser.hasBackendArguments();
@@ -140,7 +138,7 @@ namespace configmgr
if (bNeedNewBackend)
{
- Context xMergedContext = BootstrapContext::createWrapper(xContext,aValues);
+ uno::Reference< uno::XComponentContext > xMergedContext = BootstrapContext::createWrapper(xContext,aValues);
uno::Reference< uno::XInterface > xResult = getProviderFromContext(xMergedContext);
return xResult;
@@ -154,28 +152,28 @@ namespace configmgr
}
}
//---------------------------------------------------------------------------------------
- uno::Reference< uno::XInterface > ProviderFactory::createProvider(Context const & xContext, bool bAdmin)
+ uno::Reference< uno::XInterface > ProviderFactory::createProvider(uno::Reference< uno::XComponentContext > const & xContext, bool bAdmin)
{
RTL_LOGFILE_CONTEXT_AUTHOR(aLog, "configmgr::ProviderFactory", "jb99855", "configmgr::ProviderFactory::createProvider(bAdmin)");
- NamedValues aValues(2);
+ uno::Sequence < beans::NamedValue > aValues(2);
aValues[0] = ArgumentHelper::makeAdminServiceOverride(bAdmin);
aValues[1] = BootstrapContext::makePassthroughMarker(sal_False);
- Context xMergedContext = BootstrapContext::createWrapper(xContext,aValues);
+ uno::Reference< uno::XComponentContext > xMergedContext = BootstrapContext::createWrapper(xContext,aValues);
uno::Reference< uno::XInterface > xResult = getProviderFromContext(xMergedContext);
return xResult;
}
//---------------------------------------------------------------------------------------
- uno::Reference< uno::XInterface > ProviderFactory::createProvider(Context const & xContext)
+ uno::Reference< uno::XInterface > ProviderFactory::createProvider(uno::Reference< uno::XComponentContext > const & xContext)
{
RTL_LOGFILE_CONTEXT_AUTHOR(aLog, "configmgr::ProviderFactory", "jb99855", "configmgr::ProviderFactory::createProvider()");
if (BootstrapContext::isPassthrough(xContext))
{
// make sure this uses a new BootstrapContext !
- Context xPatchedContext = BootstrapContext::createWrapper(xContext,NamedValues());
+ uno::Reference< uno::XComponentContext > xPatchedContext = BootstrapContext::createWrapper(xContext,uno::Sequence < beans::NamedValue >());
return getProviderFromContext(xPatchedContext);
}
else
@@ -183,7 +181,7 @@ namespace configmgr
}
//---------------------------------------------------------------------------------------
- sal_Int32 ProviderFactory::parseArguments(ArgumentHelper & aParser, NamedValues & rValues, Arguments const & _aArguments)
+ sal_Int32 ProviderFactory::parseArguments(ArgumentHelper & aParser, uno::Sequence < beans::NamedValue > & rValues, uno::Sequence < uno::Any > const & _aArguments)
{
OSL_ASSERT(rValues.getLength() >= _aArguments.getLength());
@@ -234,7 +232,7 @@ namespace configmgr
//---------------------------------------------------------------------------------------
uno::Reference< lang::XSingleComponentFactory > SAL_CALL createProviderFactory(
- OUString const & aImplementationName,
+ rtl::OUString const & aImplementationName,
bool bAdmin
)
{
diff --git a/configmgr/source/misc/providerfactory.hxx b/configmgr/source/misc/providerfactory.hxx
index 67c6ebfb91..5703b06738 100644
--- a/configmgr/source/misc/providerfactory.hxx
+++ b/configmgr/source/misc/providerfactory.hxx
@@ -48,47 +48,40 @@ namespace configmgr
namespace uno = ::com::sun::star::uno;
namespace lang = ::com::sun::star::lang;
namespace beans = ::com::sun::star::beans;
- using rtl::OUString;
//------------------------------------------------------------------------
class ContextReader;
class ArgumentHelper;
//------------------------------------------------------------------------
//= OProviderFactory
//------------------------------------------------------------------------
- typedef ::cppu::WeakImplHelper1< lang::XSingleComponentFactory > ProviderFactory_Base;
-
/** a special factory for the configuration provider,
which maps creation arguments into a context.
*/
- class ProviderFactory : public ProviderFactory_Base
+ class ProviderFactory : public cppu::WeakImplHelper1< lang::XSingleComponentFactory >
{
- OUString const m_aImplementationName;
+ rtl::OUString const m_aImplementationName;
bool m_bAdmin;
public:
- typedef uno::Reference< uno::XComponentContext > Context;
- typedef uno::Sequence < uno::Any > Arguments;
- typedef uno::Sequence < beans::NamedValue > NamedValues;
- public:
explicit
- ProviderFactory(OUString const & aImplementationName, bool bAdmin);
+ ProviderFactory(rtl::OUString const & aImplementationName, bool bAdmin);
~ProviderFactory();
virtual uno::Reference< uno::XInterface >
- SAL_CALL createInstanceWithContext(Context const & xContext )
+ SAL_CALL createInstanceWithContext(uno::Reference< uno::XComponentContext > const & xContext )
throw (uno::Exception, uno::RuntimeException);
virtual uno::Reference< uno::XInterface > SAL_CALL
- createInstanceWithArgumentsAndContext( Arguments const & aArguments, Context const & xContext )
+ createInstanceWithArgumentsAndContext( uno::Sequence < uno::Any > const & aArguments, uno::Reference< uno::XComponentContext > const & xContext )
throw (uno::Exception, uno::RuntimeException);
private:
- uno::Reference< uno::XInterface > getProviderFromContext(Context const & aContext);
- uno::Reference< uno::XInterface > getProviderAlways(Context const & xContext);
- uno::Reference< uno::XInterface > createProviderWithArguments(Context const & xContext, Arguments const & _aArguments);
- uno::Reference< uno::XInterface > createProvider(Context const & xContext,bool bAdmin);
- uno::Reference< uno::XInterface > createProvider(Context const & xContext);
- sal_Int32 parseArguments(ArgumentHelper & aParser, NamedValues & rValues, Arguments const & _aArguments);
+ uno::Reference< uno::XInterface > getProviderFromContext(uno::Reference< uno::XComponentContext > const & aContext);
+ uno::Reference< uno::XInterface > getProviderAlways(uno::Reference< uno::XComponentContext > const & xContext);
+ uno::Reference< uno::XInterface > createProviderWithArguments(uno::Reference< uno::XComponentContext > const & xContext, uno::Sequence < uno::Any > const & _aArguments);
+ uno::Reference< uno::XInterface > createProvider(uno::Reference< uno::XComponentContext > const & xContext,bool bAdmin);
+ uno::Reference< uno::XInterface > createProvider(uno::Reference< uno::XComponentContext > const & xContext);
+ sal_Int32 parseArguments(ArgumentHelper & aParser, uno::Sequence < beans::NamedValue > & rValues, uno::Sequence < uno::Any > const & _aArguments);
};
//------------------------------------------------------------------------
} // namespace configmgr
diff --git a/configmgr/source/misc/providerwrapper.cxx b/configmgr/source/misc/providerwrapper.cxx
index 4bf598711b..5fdf876745 100644
--- a/configmgr/source/misc/providerwrapper.cxx
+++ b/configmgr/source/misc/providerwrapper.cxx
@@ -47,21 +47,20 @@ namespace configmgr
//==========================================================================
namespace uno = com::sun::star::uno;
namespace lang = com::sun::star::lang;
- using rtl::OUString;
//==========================================================================
//= ProviderWrapper
//==========================================================================
- uno::Reference< uno::XInterface > ProviderWrapper::create( uno::Reference< uno::XInterface > xDelegate, NamedValues const & aPresets)
+ uno::Reference< uno::XInterface > ProviderWrapper::create( uno::Reference< uno::XInterface > xDelegate, uno::Sequence< com::sun::star::beans::NamedValue > const & aPresets)
{
- Provider xProvDelegate(xDelegate, uno::UNO_QUERY);
+ uno::Reference< lang::XMultiServiceFactory > xProvDelegate(xDelegate, uno::UNO_QUERY);
if (!xProvDelegate.is())
{
- OUString sMsg(RTL_CONSTASCII_USTRINGPARAM("ProviderWrapper: Cannot wrap a NULL provider"));
+ rtl::OUString sMsg(RTL_CONSTASCII_USTRINGPARAM("ProviderWrapper: Cannot wrap a NULL provider"));
throw lang::NullPointerException(sMsg,NULL);
}
//Strip prefixes
- NamedValues aStrippedPresets = aPresets;
+ uno::Sequence< com::sun::star::beans::NamedValue > aStrippedPresets = aPresets;
for (sal_Int32 i = 0; i < aPresets.getLength(); ++i)
{
@@ -71,16 +70,15 @@ namespace configmgr
}
}
- Provider xResult( new ProviderWrapper(xProvDelegate,aStrippedPresets) );
+ uno::Reference< lang::XMultiServiceFactory > xResult( new ProviderWrapper(xProvDelegate,aStrippedPresets) );
- typedef uno::Reference< lang::XComponent > Comp;
- DisposingForwarder::forward( Comp::query(xProvDelegate),Comp::query(xResult) );
+ DisposingForwarder::forward( uno::Reference< lang::XComponent >::query(xProvDelegate),uno::Reference< lang::XComponent >::query(xResult) );
return uno::Reference< uno::XInterface >( xResult, uno::UNO_QUERY );
}
- ProviderWrapper::ProviderWrapper(Provider const & xDelegate, NamedValues const & aPresets)
- : ProviderWrapper_Base( PWMutexHolder::mutex )
+ ProviderWrapper::ProviderWrapper(uno::Reference< lang::XMultiServiceFactory > const & xDelegate, uno::Sequence< com::sun::star::beans::NamedValue > const & aPresets)
+ : cppu::WeakComponentImplHelper2< lang::XMultiServiceFactory, lang::XServiceInfo >( PWMutexHolder::mutex )
, m_xDelegate(xDelegate)
, m_aDefaults(aPresets.getLength())
{
@@ -100,12 +98,12 @@ namespace configmgr
m_xDelegate.clear();
}
- ProviderWrapper::Provider ProviderWrapper::getDelegate()
+ uno::Reference< lang::XMultiServiceFactory > ProviderWrapper::getDelegate()
{
osl::MutexGuard lock(mutex);
if (!m_xDelegate.is())
{
- OUString sMsg(RTL_CONSTASCII_USTRINGPARAM("ProviderWrapper: Delegate Provider has been disposed"));
+ rtl::OUString sMsg(RTL_CONSTASCII_USTRINGPARAM("ProviderWrapper: Delegate Provider has been disposed"));
throw lang::DisposedException(sMsg,*this);
}
return m_xDelegate;
@@ -117,28 +115,28 @@ namespace configmgr
uno::Reference<lang::XServiceInfo> xDelegate( this->getDelegate(), uno::UNO_QUERY );
if (!xDelegate.is())
{
- OUString sMsg(RTL_CONSTASCII_USTRINGPARAM("ProviderWrapper: Delegate Provider has no service info"));
+ rtl::OUString sMsg(RTL_CONSTASCII_USTRINGPARAM("ProviderWrapper: Delegate Provider has no service info"));
throw uno::RuntimeException(sMsg,*this);
}
return xDelegate;
}
/// XMultiServiceFactory
- static inline uno::Any const * begin(ProviderWrapper::Arguments const & aArgs)
+ static inline uno::Any const * begin(uno::Sequence< uno::Any > const & aArgs)
{ return aArgs.getConstArray(); }
- static inline uno::Any const * end(ProviderWrapper::Arguments const & aArgs)
+ static inline uno::Any const * end(uno::Sequence< uno::Any > const & aArgs)
{ return aArgs.getConstArray() + aArgs.getLength(); }
- static inline uno::Any * begin(ProviderWrapper::Arguments & aArgs)
+ static inline uno::Any * begin(uno::Sequence< uno::Any > & aArgs)
{ return aArgs.getArray(); }
- static inline uno::Any * end(ProviderWrapper::Arguments & aArgs)
+ static inline uno::Any * end(uno::Sequence< uno::Any > & aArgs)
{ return aArgs.getArray() + aArgs.getLength(); }
- ProviderWrapper::Arguments ProviderWrapper::patchArguments(Arguments const & aArgs) const
+ uno::Sequence< uno::Any > ProviderWrapper::patchArguments(uno::Sequence< uno::Any > const & aArgs) const
{
// rely on evaluation order front to back
if (m_aDefaults.getLength() == 0) return aArgs;
- Arguments aResult(m_aDefaults.getLength() + aArgs.getLength());
+ uno::Sequence< uno::Any > aResult(m_aDefaults.getLength() + aArgs.getLength());
uno::Any * pNext = std::copy(begin(m_aDefaults),end(m_aDefaults),begin(aResult));
pNext = std::copy(begin(aArgs),end(aArgs),pNext);
@@ -149,7 +147,7 @@ namespace configmgr
}
uno::Reference< uno::XInterface > SAL_CALL
- ProviderWrapper::createInstance( const OUString& aServiceSpecifier )
+ ProviderWrapper::createInstance( const rtl::OUString& aServiceSpecifier )
throw(uno::Exception, uno::RuntimeException)
{
return getDelegate()->createInstanceWithArguments(aServiceSpecifier,m_aDefaults);
@@ -162,7 +160,7 @@ namespace configmgr
return getDelegate()->createInstanceWithArguments(ServiceSpecifier,patchArguments(rArguments));
}
- uno::Sequence< OUString > SAL_CALL
+ uno::Sequence< rtl::OUString > SAL_CALL
ProviderWrapper::getAvailableServiceNames( )
throw(uno::RuntimeException)
{
@@ -170,11 +168,11 @@ namespace configmgr
}
/// XServiceInfo
- OUString SAL_CALL
+ rtl::OUString SAL_CALL
ProviderWrapper::getImplementationName( )
throw(uno::RuntimeException)
{
- return OUString::createFromAscii("com.sun.star.comp.configuration.ConfigurationProviderWrapper");
+ return rtl::OUString::createFromAscii("com.sun.star.comp.configuration.ConfigurationProviderWrapper");
}
sal_Bool SAL_CALL
@@ -184,7 +182,7 @@ namespace configmgr
return getDelegateInfo()->supportsService( ServiceName );
}
- uno::Sequence< OUString > SAL_CALL
+ uno::Sequence< rtl::OUString > SAL_CALL
ProviderWrapper::getSupportedServiceNames( )
throw(uno::RuntimeException)
{
diff --git a/configmgr/source/misc/providerwrapper.hxx b/configmgr/source/misc/providerwrapper.hxx
index 2b867d4c26..f402552a09 100644
--- a/configmgr/source/misc/providerwrapper.hxx
+++ b/configmgr/source/misc/providerwrapper.hxx
@@ -42,48 +42,38 @@ namespace configmgr
//==========================================================================
namespace uno = com::sun::star::uno;
namespace lang = com::sun::star::lang;
- using rtl::OUString;
//==========================================================================
//= ProviderWrapper
//==========================================================================
- typedef ::cppu::WeakComponentImplHelper2 < lang::XMultiServiceFactory,
- lang::XServiceInfo
- > ProviderWrapper_Base;
-
struct PWMutexHolder { osl::Mutex mutex; }; // ad hoc ...
- class ProviderWrapper : private PWMutexHolder, public ProviderWrapper_Base
+ class ProviderWrapper : private PWMutexHolder, public cppu::WeakComponentImplHelper2< lang::XMultiServiceFactory, lang::XServiceInfo >
{
- public:
- typedef uno::Reference< lang::XMultiServiceFactory > Provider;
- typedef uno::Sequence< com::sun::star::beans::NamedValue > NamedValues;
- typedef uno::Sequence< uno::Any > Arguments;
-
private:
- Provider m_xDelegate;
- Arguments m_aDefaults;
+ uno::Reference< lang::XMultiServiceFactory > m_xDelegate;
+ uno::Sequence< uno::Any > m_aDefaults;
private:
- ProviderWrapper(Provider const & xDelegate, NamedValues const & aPresets);
+ ProviderWrapper(uno::Reference< lang::XMultiServiceFactory > const & xDelegate, uno::Sequence< com::sun::star::beans::NamedValue > const & aPresets);
public:
- static uno::Reference< uno::XInterface > create( uno::Reference< uno::XInterface > xDelegate, NamedValues const & aPresets);
+ static uno::Reference< uno::XInterface > create( uno::Reference< uno::XInterface > xDelegate, uno::Sequence< com::sun::star::beans::NamedValue > const & aPresets);
~ProviderWrapper();
/// XMultiServiceFactory
virtual uno::Reference< uno::XInterface > SAL_CALL
- createInstance( const OUString& aServiceSpecifier )
+ createInstance( const rtl::OUString& aServiceSpecifier )
throw(uno::Exception, uno::RuntimeException);
virtual uno::Reference< uno::XInterface > SAL_CALL
createInstanceWithArguments( const ::rtl::OUString& ServiceSpecifier, const uno::Sequence< uno::Any >& Arguments )
throw(uno::Exception, uno::RuntimeException);
- virtual uno::Sequence< OUString > SAL_CALL
+ virtual uno::Sequence< rtl::OUString > SAL_CALL
getAvailableServiceNames( )
throw(uno::RuntimeException);
/// XServiceInfo
- virtual OUString SAL_CALL
+ virtual rtl::OUString SAL_CALL
getImplementationName( )
throw(uno::RuntimeException);
@@ -91,16 +81,16 @@ namespace configmgr
supportsService( const ::rtl::OUString& ServiceName )
throw(uno::RuntimeException);
- virtual uno::Sequence< OUString > SAL_CALL
+ virtual uno::Sequence< rtl::OUString > SAL_CALL
getSupportedServiceNames( )
throw(uno::RuntimeException);
protected:
virtual void SAL_CALL disposing();
private:
- Provider getDelegate();
+ uno::Reference< lang::XMultiServiceFactory > getDelegate();
uno::Reference<lang::XServiceInfo> getDelegateInfo();
- Arguments patchArguments(Arguments const & aArgs) const;
+ uno::Sequence< uno::Any > patchArguments(uno::Sequence< uno::Any > const & aArgs) const;
};
diff --git a/configmgr/source/misc/requestoptions.cxx b/configmgr/source/misc/requestoptions.cxx
index da0209e9f4..6302e943c5 100644
--- a/configmgr/source/misc/requestoptions.cxx
+++ b/configmgr/source/misc/requestoptions.cxx
@@ -40,7 +40,7 @@ namespace configmgr
{
// ---------------------------------------------------------------------------
- RequestOptions::LocaleString RequestOptions::getIsoLocale() const
+ rtl::OUString RequestOptions::getIsoLocale() const
{
return localehelper::makeIsoLocale( m_sLocale );
}
@@ -52,7 +52,7 @@ namespace configmgr
}
// ---------------------------------------------------------------------------
- void RequestOptions::setIsoLocale(LocaleString const & _sLocale)
+ void RequestOptions::setIsoLocale(rtl::OUString const & _sLocale)
{
setLocale( localehelper::makeLocale( _sLocale ) );
}
@@ -72,14 +72,14 @@ namespace configmgr
// ---------------------------------------------------------------------------
static inline
- sal_Int32 hashRequestLocale(RequestOptions::Locale const & aLocale)
+ sal_Int32 hashRequestLocale(com::sun::star::lang::Locale const & aLocale)
{
return aLocale.Language.hashCode() ^ aLocale.Country.hashCode();
}
// ---------------------------------------------------------------------------
static inline
- sal_Int32 compareRequestLocale(RequestOptions::Locale const& lhs, RequestOptions::Locale const& rhs)
+ sal_Int32 compareRequestLocale(com::sun::star::lang::Locale const& lhs, com::sun::star::lang::Locale const& rhs)
{
sal_Int32 nDiff = lhs.Language.compareTo(rhs.Language);
if (nDiff == 0)
diff --git a/configmgr/source/misc/serviceinfohelper.cxx b/configmgr/source/misc/serviceinfohelper.cxx
index bf9aa7e7d6..8a379b01f4 100644
--- a/configmgr/source/misc/serviceinfohelper.cxx
+++ b/configmgr/source/misc/serviceinfohelper.cxx
@@ -43,7 +43,7 @@ namespace configmgr
return 0;
sal_Int32 nCount = 0;
- if (AsciiServiceName const* p= m_info->registeredServiceNames)
+ if (sal_Char const * const* p= m_info->registeredServiceNames)
{
while (*p != 0)
{
@@ -51,7 +51,7 @@ namespace configmgr
++p;
}
}
- if (AsciiServiceName const* p= m_info->additionalServiceNames)
+ if (sal_Char const * const* p= m_info->additionalServiceNames)
{
while (*p != 0)
{
@@ -64,22 +64,22 @@ namespace configmgr
}
// ---------------------------------------------------------------------------
- OUString ServiceInfoHelper::getImplementationName( ) const
+ rtl::OUString ServiceInfoHelper::getImplementationName( ) const
throw(uno::RuntimeException)
{
- AsciiServiceName p= m_info ? m_info->implementationName : 0;
+ sal_Char const * p= m_info ? m_info->implementationName : 0;
- return p ? OUString::createFromAscii(p) : OUString();
+ return p ? rtl::OUString::createFromAscii(p) : rtl::OUString();
}
// ---------------------------------------------------------------------------
- sal_Bool ServiceInfoHelper::supportsService( OUString const & ServiceName ) const
+ sal_Bool ServiceInfoHelper::supportsService( rtl::OUString const & ServiceName ) const
throw(uno::RuntimeException)
{
if (m_info == 0)
return false;
- if (AsciiServiceName const* p= m_info->registeredServiceNames)
+ if (sal_Char const * const* p= m_info->registeredServiceNames)
{
while (*p != 0)
{
@@ -88,7 +88,7 @@ namespace configmgr
++p;
}
}
- if (AsciiServiceName const* p= m_info->additionalServiceNames)
+ if (sal_Char const * const* p= m_info->additionalServiceNames)
{
while (*p != 0)
{
@@ -102,29 +102,29 @@ namespace configmgr
}
// ---------------------------------------------------------------------------
- uno::Sequence< OUString > ServiceInfoHelper::getSupportedServiceNames( ) const
+ uno::Sequence< rtl::OUString > ServiceInfoHelper::getSupportedServiceNames( ) const
throw(uno::RuntimeException)
{
sal_Int32 const nCount = countServices();
- uno::Sequence< OUString > aServices( nCount );
+ uno::Sequence< rtl::OUString > aServices( nCount );
if (nCount)
{
OSL_ASSERT(m_info);
sal_Int32 i = 0;
- if (AsciiServiceName const* p= m_info->registeredServiceNames)
+ if (sal_Char const * const* p= m_info->registeredServiceNames)
{
while (*p != 0)
{
- aServices[i++] = OUString::createFromAscii(*p++);
+ aServices[i++] = rtl::OUString::createFromAscii(*p++);
}
}
- if (AsciiServiceName const* p= m_info->additionalServiceNames)
+ if (sal_Char const * const* p= m_info->additionalServiceNames)
{
while (*p != 0)
{
- aServices[i++] = OUString::createFromAscii(*p++);
+ aServices[i++] = rtl::OUString::createFromAscii(*p++);
}
}
OSL_ASSERT( i == nCount );
@@ -141,7 +141,7 @@ namespace configmgr
return 0;
sal_Int32 nCount = 0;
- if (AsciiServiceName const* p= m_info->registeredServiceNames)
+ if (sal_Char const * const* p= m_info->registeredServiceNames)
{
while (*p != 0)
{
@@ -154,31 +154,31 @@ namespace configmgr
}
// ---------------------------------------------------------------------------
- OUString ServiceRegistrationHelper::getImplementationName( ) const
+ rtl::OUString ServiceRegistrationHelper::getImplementationName( ) const
throw(uno::RuntimeException)
{
- AsciiServiceName p= m_info ? m_info->implementationName : 0;
+ sal_Char const * p= m_info ? m_info->implementationName : 0;
- return p ? OUString::createFromAscii(p) : OUString();
+ return p ? rtl::OUString::createFromAscii(p) : rtl::OUString();
}
// ---------------------------------------------------------------------------
- uno::Sequence< OUString > ServiceRegistrationHelper::getRegisteredServiceNames( ) const
+ uno::Sequence< rtl::OUString > ServiceRegistrationHelper::getRegisteredServiceNames( ) const
throw(uno::RuntimeException)
{
sal_Int32 const nCount = countServices();
- uno::Sequence< OUString > aServices( nCount );
+ uno::Sequence< rtl::OUString > aServices( nCount );
if (nCount)
{
OSL_ASSERT(m_info);
sal_Int32 i = 0;
- if (AsciiServiceName const* p= m_info->registeredServiceNames)
+ if (sal_Char const * const* p= m_info->registeredServiceNames)
{
while (*p != 0)
{
- aServices[i++] = OUString::createFromAscii(*p++);
+ aServices[i++] = rtl::OUString::createFromAscii(*p++);
}
}
OSL_ASSERT( i == nCount );
diff --git a/configmgr/source/misc/simpleinteractionrequest.cxx b/configmgr/source/misc/simpleinteractionrequest.cxx
index 30e5adf7f4..4a3ddf1329 100644
--- a/configmgr/source/misc/simpleinteractionrequest.cxx
+++ b/configmgr/source/misc/simpleinteractionrequest.cxx
@@ -40,7 +40,7 @@ namespace task = com::sun::star::task;
//=========================================================================
SimpleInteractionRequest::SimpleInteractionRequest(
const uno::Any & rRequest,
- const Continuation nContinuations )
+ const sal_uInt32 nContinuations )
: InteractionRequest( rRequest )
{
// Set continuations.
@@ -53,16 +53,16 @@ SimpleInteractionRequest::SimpleInteractionRequest(
uno::Reference< task::XInteractionContinuation > xContinuations[ k_NumContinuationTypes ];
if ( nContinuations & CONTINUATION_ABORT )
- xContinuations[nLength++] = new InteractionAbort( this );
+ xContinuations[nLength++] = new InteractionContinuation< task::XInteractionAbort >( this );
if ( nContinuations & CONTINUATION_RETRY )
- xContinuations[nLength++] = new InteractionRetry( this );
+ xContinuations[nLength++] = new InteractionContinuation< task::XInteractionRetry >( this );
if ( nContinuations & CONTINUATION_APPROVE )
- xContinuations[nLength++] = new InteractionApprove( this );
+ xContinuations[nLength++] = new InteractionContinuation< task::XInteractionApprove >( this );
if ( nContinuations & CONTINUATION_DISAPPROVE )
- xContinuations[nLength++] = new InteractionDisapprove( this );
+ xContinuations[nLength++] = new InteractionContinuation< task::XInteractionDisapprove >( this );
OSL_ENSURE( nLength > 0,
"SimpleInteractionRequest - No continuation!" );
@@ -74,7 +74,7 @@ SimpleInteractionRequest::SimpleInteractionRequest(
}
//=========================================================================
-SimpleInteractionRequest::Continuation SimpleInteractionRequest::getResponse() const
+const sal_uInt32 SimpleInteractionRequest::getResponse() const
{
uno::Reference< task::XInteractionContinuation > xSelection = this->getSelection();
if ( xSelection.is() )
diff --git a/configmgr/source/misc/tracer.cxx b/configmgr/source/misc/tracer.cxx
index 43e98a1c59..0632ce0887 100644
--- a/configmgr/source/misc/tracer.cxx
+++ b/configmgr/source/misc/tracer.cxx
@@ -38,10 +38,6 @@
#include <rtl/string.hxx>
#include <map>
-namespace configmgr
-{
- typedef ::std::map< ::rtl::OString, void*, ::std::less< ::rtl::OString > > VirtualDevices;
-}
#include "tracer.hxx"
#ifdef CFG_ENABLE_TRACING
@@ -83,7 +79,7 @@ struct OTracerSetup
sal_Bool m_bInitialized;
oslThreadKey m_nThreadKey;
- VirtualDevices m_aDevices;
+ ::std::map< ::rtl::OString, void*, ::std::less< ::rtl::OString > > m_aDevices;
OTracerSetup()
:m_nTraceMask(WARNING | ERROR)
diff --git a/configmgr/source/platformbe/componentdefn.cxx b/configmgr/source/platformbe/componentdefn.cxx
index 8508ce4e73..e693a1ae0f 100644
--- a/configmgr/source/platformbe/componentdefn.cxx
+++ b/configmgr/source/platformbe/componentdefn.cxx
@@ -36,14 +36,11 @@
#include <cppuhelper/implementationentry.hxx>
#endif // _CPPUHELPER_IMPLEMENTATIONENTRY_HXX_
-
-using namespace configmgr::backend ;
-
//==============================================================================
-static uno::Reference<uno::XInterface> SAL_CALL createSystemIntegrationManager(
- const uno::Reference<uno::XComponentContext>& aContext) {
- return * new SystemIntegrationManager(aContext) ;
+static com::sun::star::uno::Reference<com::sun::star::uno::XInterface> SAL_CALL createSystemIntegrationManager(
+ const com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext>& aContext) {
+ return * new configmgr::backend::SystemIntegrationManager(aContext) ;
}
//==============================================================================
@@ -53,8 +50,8 @@ static const cppu::ImplementationEntry kImplementations_entries[] =
{
{
createSystemIntegrationManager,
- SystemIntegrationManager::getSystemIntegrationManagerName,
- SystemIntegrationManager::getServiceNames,
+ configmgr::backend::SystemIntegrationManager::getSystemIntegrationManagerName,
+ configmgr::backend::SystemIntegrationManager::getServiceNames,
cppu::createSingleComponentFactory,
NULL,
0
diff --git a/configmgr/source/platformbe/systemintegrationmanager.cxx b/configmgr/source/platformbe/systemintegrationmanager.cxx
index 08d83547db..0fee745f4e 100644
--- a/configmgr/source/platformbe/systemintegrationmanager.cxx
+++ b/configmgr/source/platformbe/systemintegrationmanager.cxx
@@ -42,7 +42,7 @@ namespace configmgr { namespace backend {
//==============================================================================
#define OU2A( oustr ) (rtl::OUStringToOString( oustr, RTL_TEXTENCODING_ASCII_US ).getStr())
//==============================================================================
-PlatformBackend BackendRef::getBackend(uno::Reference<uno::XComponentContext> const & xContext)
+uno::Reference<backenduno::XSingleLayerStratum> BackendRef::getBackend(uno::Reference<uno::XComponentContext> const & xContext)
{
if (!mBackend.is() && mFactory.is())
try
@@ -71,7 +71,7 @@ void BackendRef::disposeBackend()
}
//==============================================================================
SystemIntegrationManager::SystemIntegrationManager(const uno::Reference<uno::XComponentContext>& xContext)
-: BackendBase(mMutex)
+: cppu::WeakComponentImplHelper4< backenduno::XBackend, backenduno::XBackendChangesNotifier, lang::XInitialization, lang::XServiceInfo>(mMutex)
, mMutex()
, mContext(xContext)
, mPlatformBackends()
@@ -115,7 +115,7 @@ void SystemIntegrationManager::buildLookupTable()
osl::MutexGuard lock(mMutex);
while (xEnum->hasMoreElements())
{
- BackendFactory xServiceFactory( xEnum->nextElement(),uno::UNO_QUERY);
+ uno::Reference<lang::XSingleComponentFactory> xServiceFactory( xEnum->nextElement(),uno::UNO_QUERY);
if (xServiceFactory.is())
{
uno::Sequence<rtl::OUString> aKeys = getSupportedComponents(xServiceFactory);
@@ -125,7 +125,7 @@ void SystemIntegrationManager::buildLookupTable()
BackendRef aBackendRef(xServiceFactory);
//OSL_TRACE("SystemInteg -Adding Factory Backend to map for key %s",
//rtl::OUStringToOString(aKeys[i], RTL_TEXTENCODING_ASCII_US).getStr() );
- mPlatformBackends.insert( BackendFactoryList::value_type(aKeys[i],aBackendRef));
+ mPlatformBackends.insert( std::multimap<rtl::OUString, BackendRef>::value_type(aKeys[i],aBackendRef));
}
}
}
@@ -134,7 +134,7 @@ void SystemIntegrationManager::buildLookupTable()
//---------------------------------------------------------------------------------------------
uno::Sequence<rtl::OUString>
-SystemIntegrationManager::getSupportedComponents(const BackendFactory& xFactory)
+SystemIntegrationManager::getSupportedComponents(const uno::Reference<lang::XSingleComponentFactory>& xFactory)
{
static const rtl::OUString kProperSubkeyName( RTL_CONSTASCII_USTRINGPARAM("/DATA/SupportedComponents")) ;
static const rtl::OUString kImplKeyPropertyName( RTL_CONSTASCII_USTRINGPARAM("ImplementationKey")) ;
@@ -186,19 +186,16 @@ uno::Reference<backenduno::XUpdateHandler> SAL_CALL
}
//------------------------------------------------------------------------------
-SystemIntegrationManager::PlatformBackendList SystemIntegrationManager::getSupportingBackends(const rtl::OUString& aComponent)
+std::vector< uno::Reference<backenduno::XSingleLayerStratum> > SystemIntegrationManager::getSupportingBackends(const rtl::OUString& aComponent)
{
- typedef BackendFactoryList::iterator BFIter;
- typedef std::pair<BFIter, BFIter> BFRange;
-
- PlatformBackendList backends;
+ std::vector< uno::Reference<backenduno::XSingleLayerStratum> > backends;
osl::MutexGuard lock(mMutex);
- BFRange aRange = mPlatformBackends.equal_range(aComponent);
- for (BFIter it=aRange.first; it != aRange.second; )
+ std::pair<std::multimap<rtl::OUString, BackendRef>::iterator, std::multimap<rtl::OUString, BackendRef>::iterator> aRange = mPlatformBackends.equal_range(aComponent);
+ for (std::multimap<rtl::OUString, BackendRef>::iterator it=aRange.first; it != aRange.second; )
{
- BFIter cur = it++; // increment here, as erase() may invalidate cur
- PlatformBackend xBackend = cur->second.getBackend(mContext);
+ std::multimap<rtl::OUString, BackendRef>::iterator cur = it++; // increment here, as erase() may invalidate cur
+ uno::Reference<backenduno::XSingleLayerStratum> xBackend = cur->second.getBackend(mContext);
if (xBackend.is())
backends.push_back(xBackend);
@@ -215,17 +212,17 @@ uno::Sequence<uno::Reference<backenduno::XLayer> > SAL_CALL
lang::IllegalArgumentException,
uno::RuntimeException)
{
- PlatformBackendList const aUniversalBackends = getSupportingBackends(getAllComponentsName());
- PlatformBackendList const aSpecialBackends = getSupportingBackends(aComponent);
+ std::vector< uno::Reference<backenduno::XSingleLayerStratum> > const aUniversalBackends = getSupportingBackends(getAllComponentsName());
+ std::vector< uno::Reference<backenduno::XSingleLayerStratum> > const aSpecialBackends = getSupportingBackends(aComponent);
uno::Sequence< uno::Reference<backenduno::XLayer> > aLayers(aUniversalBackends.size() + aSpecialBackends.size());
uno::Reference<backenduno::XLayer> * pLayer = aLayers.getArray();
- for (PlatformBackendList::size_type i=0 ; i< aUniversalBackends.size(); ++i, ++pLayer)
+ for (std::vector< uno::Reference<backenduno::XSingleLayerStratum> >::size_type i=0 ; i< aUniversalBackends.size(); ++i, ++pLayer)
*pLayer = aUniversalBackends[i]->getLayer(aComponent, rtl::OUString());
- for (PlatformBackendList::size_type j=0 ; j< aSpecialBackends.size(); ++j, ++pLayer)
+ for (std::vector< uno::Reference<backenduno::XSingleLayerStratum> >::size_type j=0 ; j< aSpecialBackends.size(); ++j, ++pLayer)
*pLayer = aSpecialBackends[j]->getLayer(aComponent, rtl::OUString());
OSL_ASSERT( aLayers.getConstArray()+aLayers.getLength() == pLayer );
@@ -252,7 +249,7 @@ uno::Reference<backenduno::XUpdateHandler> SAL_CALL
void SAL_CALL SystemIntegrationManager::disposing()
{
osl::MutexGuard lock(mMutex);
- for (BackendFactoryList::iterator it = mPlatformBackends.begin(); it != mPlatformBackends.end(); ++it)
+ for (std::multimap<rtl::OUString, BackendRef>::iterator it = mPlatformBackends.begin(); it != mPlatformBackends.end(); ++it)
it->second.disposeBackend();
mPlatformBackends.clear();
@@ -322,7 +319,7 @@ void SAL_CALL SystemIntegrationManager::addChangesListener(
//Simply forward listener to platform backend that support listening
{
- PlatformBackendList aUniversalBackends = getSupportingBackends(getAllComponentsName());
+ std::vector< uno::Reference<backenduno::XSingleLayerStratum> > aUniversalBackends = getSupportingBackends(getAllComponentsName());
for (sal_uInt32 i=0; i< aUniversalBackends.size(); i++)
{
uno::Reference<backenduno::XBackendChangesNotifier> xBackend( aUniversalBackends[i], uno::UNO_QUERY) ;
@@ -331,7 +328,7 @@ void SAL_CALL SystemIntegrationManager::addChangesListener(
}
}
{
- PlatformBackendList aSpecialBackends = getSupportingBackends(aComponent);
+ std::vector< uno::Reference<backenduno::XSingleLayerStratum> > aSpecialBackends = getSupportingBackends(aComponent);
for (sal_uInt32 i=0; i< aSpecialBackends.size(); i++)
{
uno::Reference<backenduno::XBackendChangesNotifier> xBackend( aSpecialBackends[i], uno::UNO_QUERY) ;
@@ -348,7 +345,7 @@ void SAL_CALL SystemIntegrationManager::removeChangesListener(
{
osl::MutexGuard aGuard(mMutex);
{
- PlatformBackendList aUniversalBackends = getSupportingBackends(getAllComponentsName());
+ std::vector< uno::Reference<backenduno::XSingleLayerStratum> > aUniversalBackends = getSupportingBackends(getAllComponentsName());
for (sal_uInt32 i=0; i< aUniversalBackends.size(); i++)
{
uno::Reference<backenduno::XBackendChangesNotifier> xBackend( aUniversalBackends[i], uno::UNO_QUERY) ;
@@ -357,7 +354,7 @@ void SAL_CALL SystemIntegrationManager::removeChangesListener(
}
}
{
- PlatformBackendList aSpecialBackends = getSupportingBackends(aComponent);
+ std::vector< uno::Reference<backenduno::XSingleLayerStratum> > aSpecialBackends = getSupportingBackends(aComponent);
for (sal_uInt32 i=0; i< aSpecialBackends.size(); i++)
{
uno::Reference<backenduno::XBackendChangesNotifier> xBackend( aSpecialBackends[i], uno::UNO_QUERY) ;
diff --git a/configmgr/source/platformbe/systemintegrationmanager.hxx b/configmgr/source/platformbe/systemintegrationmanager.hxx
index 1295cb8359..b2c62b7d29 100644
--- a/configmgr/source/platformbe/systemintegrationmanager.hxx
+++ b/configmgr/source/platformbe/systemintegrationmanager.hxx
@@ -25,12 +25,6 @@ namespace uno = css::uno ;
namespace lang = css::lang ;
namespace backenduno = css::configuration::backend ;
-
-
-typedef uno::Reference<lang::XSingleComponentFactory> BackendFactory;
-typedef uno::Reference<backenduno::XSingleLayerStratum> PlatformBackend;
-
-
/* Class containing a reference to a service factory(XSingleComponentFactory)
object and a platform backend (XSingleLayerStratum).
The reference to the platform backend will be NULL until the platform backend
@@ -38,30 +32,24 @@ typedef uno::Reference<backenduno::XSingleLayerStratum> PlatformBackend;
*/
class BackendRef
{
- BackendFactory mFactory;
- PlatformBackend mBackend;
+ uno::Reference<lang::XSingleComponentFactory> mFactory;
+ uno::Reference<backenduno::XSingleLayerStratum> mBackend;
public:
explicit
- BackendRef(const BackendFactory& aFactory)
+ BackendRef(const uno::Reference<lang::XSingleComponentFactory>& aFactory)
:mFactory(aFactory)
,mBackend()
{}
- PlatformBackend getBackend(uno::Reference<uno::XComponentContext> const & xContext);
+ uno::Reference<backenduno::XSingleLayerStratum> getBackend(uno::Reference<uno::XComponentContext> const & xContext);
void disposeBackend();
};
-typedef cppu::WeakComponentImplHelper4< backenduno::XBackend,
- backenduno::XBackendChangesNotifier,
- lang::XInitialization,
- lang::XServiceInfo> BackendBase ;
-
-
/**
Class implementing the Backend service for system integration backend access.
It creates the required backends and coordinates access to them.
*/
-class SystemIntegrationManager : public BackendBase
+class SystemIntegrationManager : public cppu::WeakComponentImplHelper4< backenduno::XBackend, backenduno::XBackendChangesNotifier, lang::XInitialization, lang::XServiceInfo>
{
public:
/**
@@ -146,21 +134,18 @@ protected:
// ComponentHelper
virtual void SAL_CALL disposing();
private :
- typedef std::multimap<rtl::OUString, BackendRef> BackendFactoryList;
- typedef std::vector<PlatformBackend> PlatformBackendList;
-
/** build lookup up table
*/
void buildLookupTable();
/** get list of supported components
*/
- uno::Sequence<rtl::OUString> getSupportedComponents(const BackendFactory& xFactory);
+ uno::Sequence<rtl::OUString> getSupportedComponents(const uno::Reference<lang::XSingleComponentFactory>& xFactory);
/**
get supporting backends from lookup table
*/
- PlatformBackendList getSupportingBackends(const rtl::OUString& aComponent);
+ std::vector< uno::Reference<backenduno::XSingleLayerStratum> > getSupportingBackends(const rtl::OUString& aComponent);
private :
/** Mutex for resource protection */
@@ -168,7 +153,7 @@ private :
/** Component Context */
uno::Reference<uno::XComponentContext> mContext ;
- BackendFactoryList mPlatformBackends;
+ std::multimap<rtl::OUString, BackendRef> mPlatformBackends;
} ;
} } // configmgr.backend
diff --git a/configmgr/source/registry/cfgregistrykey.cxx b/configmgr/source/registry/cfgregistrykey.cxx
index 3f07dfc0f7..6b2f6e566c 100644
--- a/configmgr/source/registry/cfgregistrykey.cxx
+++ b/configmgr/source/registry/cfgregistrykey.cxx
@@ -31,11 +31,10 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_configmgr.hxx"
#include "cfgregistrykey.hxx"
+#include "datalock.hxx"
#include "typeconverter.hxx"
#include <osl/diagnose.h>
-#ifndef _CPPUHELPER_EXTRACT_HXX_
#include <cppuhelper/extract.hxx>
-#endif
#include <com/sun/star/container/XNameContainer.hpp>
#include <com/sun/star/container/XNamed.hpp>
#include <com/sun/star/container/XChild.hpp>
@@ -50,11 +49,7 @@
#include <com/sun/star/uno/Sequence.hxx>
#include <typelib/typedescription.hxx>
-#ifndef INCLUDED_LIMITS
#include <limits>
-#define INCLUDED_LIMITS
-#endif
-
#define THISREF() static_cast< ::cppu::OWeakObject* >(this)
#define UNISTRING(c) ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(c) )
@@ -64,22 +59,12 @@ namespace configmgr
{
//..........................................................................
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::lang;
-using namespace ::com::sun::star::util;
-using namespace ::com::sun::star::beans;
-using namespace ::com::sun::star::registry;
-using namespace ::com::sun::star::container;
-using namespace ::osl;
-using namespace ::cppu;
-using ::rtl::OUString;
-
//--------------------------------------------------------------------------
namespace {
inline
- Type getBinaryDataType()
+ com::sun::star::uno::Type getBinaryDataType()
{
- Sequence<sal_Int8> const * const p= 0;
+ com::sun::star::uno::Sequence<sal_Int8> const * const p= 0;
return ::getCppuType(p);
}
inline
@@ -96,12 +81,12 @@ namespace {
return true;
}
inline
- bool isAscii(OUString const& str)
+ bool isAscii(rtl::OUString const& str)
{
return isAscii(str.getStr(),str.getLength());
}
inline
- bool isAscii(Sequence< OUString > const& strList)
+ bool isAscii(com::sun::star::uno::Sequence< rtl::OUString > const& strList)
{
for (int i= 0; i< strList.getLength(); ++i)
if ( !isAscii( strList[i] ) )
@@ -117,22 +102,22 @@ inline static void checkNullable() {}
//==========================================================================
static
-OUString getNodeName(const Reference< XNameAccess >& _xNode)
+rtl::OUString getNodeName(const com::sun::star::uno::Reference< com::sun::star::container::XNameAccess >& _xNode)
{
- Reference< XNamed > xName( _xNode, UNO_QUERY );
+ com::sun::star::uno::Reference< com::sun::star::container::XNamed > xName( _xNode, com::sun::star::uno::UNO_QUERY );
if (xName.is())
return xName->getName();
OSL_ENSURE( !_xNode.is(), "Cannot get name of node");
- return OUString();
+ return rtl::OUString();
}
//--------------------------------------------------------------------------
-static bool splitPath(const OUString& _sPath, OUString& _rsParentPath, OUString& _rsLocalName);
+static bool splitPath(const rtl::OUString& _sPath, rtl::OUString& _rsParentPath, rtl::OUString& _rsLocalName);
//--------------------------------------------------------------------------
OConfigurationRegistryKey::OConfigurationRegistryKey
- (const Reference< XNameAccess >& _rxRootNode
+ (const com::sun::star::uno::Reference< com::sun::star::container::XNameAccess >& _rxRootNode
,sal_Bool _bWriteable
,SubtreeRoot
)
@@ -146,7 +131,7 @@ OConfigurationRegistryKey::OConfigurationRegistryKey
//--------------------------------------------------------------------------
OConfigurationRegistryKey::OConfigurationRegistryKey
- (const Reference< XNameAccess >& _rxNode
+ (const com::sun::star::uno::Reference< com::sun::star::container::XNameAccess >& _rxNode
,sal_Bool _bWriteable
)
:m_bReadOnly(!_bWriteable)
@@ -159,8 +144,8 @@ OConfigurationRegistryKey::OConfigurationRegistryKey
//--------------------------------------------------------------------------
OConfigurationRegistryKey::OConfigurationRegistryKey(
- Any _rCurrentValue,
- const Reference< XNameAccess >& _rxParentNode,
+ com::sun::star::uno::Any _rCurrentValue,
+ const com::sun::star::uno::Reference< com::sun::star::container::XNameAccess >& _rxParentNode,
const ::rtl::OUString& _rLocalName,
sal_Bool _bWriteable)
:m_bReadOnly(!_bWriteable)
@@ -177,18 +162,18 @@ OConfigurationRegistryKey::OConfigurationRegistryKey(
}
//--------------------------------------------------------------------------
-Reference<XPropertySetInfo> OConfigurationRegistryKey::implGetParentPropertyInfo() throw(RuntimeException)
+com::sun::star::uno::Reference<com::sun::star::beans::XPropertySetInfo> OConfigurationRegistryKey::implGetParentPropertyInfo() throw(com::sun::star::uno::RuntimeException)
{
if (!m_xParentNode.is())
{
- Reference< XChild > xChild(m_xNode, UNO_QUERY);
+ com::sun::star::uno::Reference< com::sun::star::container::XChild > xChild(m_xNode, com::sun::star::uno::UNO_QUERY);
if (xChild.is())
m_xParentNode = m_xParentNode.query(xChild->getParent());
}
- Reference< XPropertySetInfo > xParentInfo; // the result
+ com::sun::star::uno::Reference< com::sun::star::beans::XPropertySetInfo > xParentInfo; // the result
- Reference< XPropertySet > xParentProperties(m_xParentNode, UNO_QUERY);
+ com::sun::star::uno::Reference< com::sun::star::beans::XPropertySet > xParentProperties(m_xParentNode, com::sun::star::uno::UNO_QUERY);
if (xParentProperties.is())
{
xParentInfo = xParentProperties->getPropertySetInfo();
@@ -204,19 +189,19 @@ Reference<XPropertySetInfo> OConfigurationRegistryKey::implGetParentPropertyInfo
//--------------------------------------------------------------------------
static
-sal_Bool isNodeReadOnly(Reference< XInterface > const& _xNode) throw(RuntimeException)
+sal_Bool isNodeReadOnly(com::sun::star::uno::Reference< com::sun::star::uno::XInterface > const& _xNode) throw(com::sun::star::uno::RuntimeException)
{
OSL_ASSERT( _xNode.is() );
- Reference< XProperty > xProperty(_xNode, UNO_QUERY);
+ com::sun::star::uno::Reference< com::sun::star::beans::XProperty > xProperty(_xNode, com::sun::star::uno::UNO_QUERY);
if (xProperty.is())
{
- Property aProperty = xProperty->getAsProperty();
+ com::sun::star::beans::Property aProperty = xProperty->getAsProperty();
- return (aProperty.Attributes & PropertyAttribute::READONLY) != 0;
+ return (aProperty.Attributes & com::sun::star::beans::PropertyAttribute::READONLY) != 0;
}
- Reference< XServiceInfo > xServiceInfo( _xNode, UNO_QUERY );
+ com::sun::star::uno::Reference< com::sun::star::lang::XServiceInfo > xServiceInfo( _xNode, com::sun::star::uno::UNO_QUERY );
if (xServiceInfo.is())
{
// does it announce update capability ?
@@ -234,7 +219,7 @@ sal_Bool isNodeReadOnly(Reference< XInterface > const& _xNode) throw(RuntimeExce
//--------------------------------------------------------------------------
-sal_Bool OConfigurationRegistryKey::implIsReadOnly() throw (RuntimeException)
+sal_Bool OConfigurationRegistryKey::implIsReadOnly() throw (com::sun::star::uno::RuntimeException)
{
sal_Bool bResult = m_bReadOnly;;
@@ -253,13 +238,13 @@ sal_Bool OConfigurationRegistryKey::implIsReadOnly() throw (RuntimeException)
// else use the parent
else if (m_xParentNode.is())
{
- Reference< XPropertySetInfo > xParentInfo = implGetParentPropertyInfo();
+ com::sun::star::uno::Reference< com::sun::star::beans::XPropertySetInfo > xParentInfo = implGetParentPropertyInfo();
if (xParentInfo.is())
{
- Property aProperty = xParentInfo->getPropertyByName(m_sLocalName);
+ com::sun::star::beans::Property aProperty = xParentInfo->getPropertyByName(m_sLocalName);
- bResult = m_bReadOnly = ((aProperty.Attributes & PropertyAttribute::READONLY) != 0);
+ bResult = m_bReadOnly = ((aProperty.Attributes & com::sun::star::beans::PropertyAttribute::READONLY) != 0);
}
else
{
@@ -280,7 +265,7 @@ sal_Bool OConfigurationRegistryKey::implIsReadOnly() throw (RuntimeException)
}
//--------------------------------------------------------------------------
-sal_Bool OConfigurationRegistryKey::implEnsureNode() throw (InvalidRegistryException,RuntimeException)
+sal_Bool OConfigurationRegistryKey::implEnsureNode() throw (com::sun::star::registry::InvalidRegistryException,com::sun::star::uno::RuntimeException)
{
if (!m_xNode.is())
{
@@ -289,22 +274,22 @@ sal_Bool OConfigurationRegistryKey::implEnsureNode() throw (InvalidRegistryExcep
{
try
{
- Any aNode = m_xParentNode->getByName( m_sLocalName );
+ com::sun::star::uno::Any aNode = m_xParentNode->getByName( m_sLocalName );
if ( !(aNode >>= m_xNode) )
- OSL_ENSURE( ! (aNode.hasValue() && aNode.getValueTypeClass() == TypeClass_INTERFACE),
+ OSL_ENSURE( ! (aNode.hasValue() && aNode.getValueTypeClass() == com::sun::star::uno::TypeClass_INTERFACE),
"OConfigurationRegistryKey: Node object does not implement expected interface");
}
- catch (NoSuchElementException& e)
+ catch (com::sun::star::container::NoSuchElementException& e)
{
m_xParentNode.clear();
- OUString sMessage = UNISTRING("Invalid OConfigurationRegistryKey. The node \"");
+ rtl::OUString sMessage = UNISTRING("Invalid OConfigurationRegistryKey. The node \"");
sMessage += m_sLocalName;
sMessage += UNISTRING("\" was not found in the parent. Parent error message: \n");
sMessage += e.Message;
- throw InvalidRegistryException(sMessage, THISREF());
+ throw com::sun::star::registry::InvalidRegistryException(sMessage, THISREF());
}
}
}
@@ -312,9 +297,9 @@ sal_Bool OConfigurationRegistryKey::implEnsureNode() throw (InvalidRegistryExcep
}
//--------------------------------------------------------------------------
-Type OConfigurationRegistryKey::implGetUnoType() throw (RuntimeException)
+com::sun::star::uno::Type OConfigurationRegistryKey::implGetUnoType() throw (com::sun::star::uno::RuntimeException)
{
- Type aType;
+ com::sun::star::uno::Type aType;
if (m_xNode.is())
{
aType = getCppuType(&m_xNode); // Its just an interface type
@@ -322,7 +307,7 @@ Type OConfigurationRegistryKey::implGetUnoType() throw (RuntimeException)
else if (m_xParentNode.is())
{
- Reference< XPropertySetInfo > xParentInfo = implGetParentPropertyInfo();
+ com::sun::star::uno::Reference< com::sun::star::beans::XPropertySetInfo > xParentInfo = implGetParentPropertyInfo();
if (xParentInfo.is())
{
aType = xParentInfo->getPropertyByName( m_sLocalName ).Type;
@@ -334,14 +319,14 @@ Type OConfigurationRegistryKey::implGetUnoType() throw (RuntimeException)
}
else
{
- OSL_ASSERT( aType.getTypeClass() == TypeClass_VOID );
+ OSL_ASSERT( aType.getTypeClass() == com::sun::star::uno::TypeClass_VOID );
OSL_ENSURE( false, "implGetUnoType called for invalid registry key");
}
return aType;
}
//--------------------------------------------------------------------------
-sal_Bool OConfigurationRegistryKey::implEnsureValue() throw (RuntimeException)
+sal_Bool OConfigurationRegistryKey::implEnsureValue() throw (com::sun::star::uno::RuntimeException)
{
if (m_xNode.is())
return false;
@@ -352,29 +337,29 @@ sal_Bool OConfigurationRegistryKey::implEnsureValue() throw (RuntimeException)
switch (implGetUnoType().getTypeClass())
{
- case TypeClass_INTERFACE:
+ case com::sun::star::uno::TypeClass_INTERFACE:
return false;
- case TypeClass_BYTE:
- case TypeClass_UNSIGNED_SHORT:
- case TypeClass_UNSIGNED_LONG:
- case TypeClass_UNSIGNED_HYPER:
- case TypeClass_FLOAT:
+ case com::sun::star::uno::TypeClass_BYTE:
+ case com::sun::star::uno::TypeClass_UNSIGNED_SHORT:
+ case com::sun::star::uno::TypeClass_UNSIGNED_LONG:
+ case com::sun::star::uno::TypeClass_UNSIGNED_HYPER:
+ case com::sun::star::uno::TypeClass_FLOAT:
OSL_ENSURE(false, "Unexpected (UNSIGNED INTERGRAL or FLOAT) type found for configuration node");
- case TypeClass_STRING:
- case TypeClass_BOOLEAN:
- case TypeClass_SHORT:
- case TypeClass_LONG:
- case TypeClass_HYPER:
- case TypeClass_DOUBLE:
- case TypeClass_SEQUENCE:
+ case com::sun::star::uno::TypeClass_STRING:
+ case com::sun::star::uno::TypeClass_BOOLEAN:
+ case com::sun::star::uno::TypeClass_SHORT:
+ case com::sun::star::uno::TypeClass_LONG:
+ case com::sun::star::uno::TypeClass_HYPER:
+ case com::sun::star::uno::TypeClass_DOUBLE:
+ case com::sun::star::uno::TypeClass_SEQUENCE:
return true;
- case TypeClass_ANY:
+ case com::sun::star::uno::TypeClass_ANY:
return true;
- case TypeClass_VOID:
+ case com::sun::star::uno::TypeClass_VOID:
OSL_ENSURE(false, "OConfigurationRegistryKey: Key does not exist or has VOID type");
return false;
@@ -391,33 +376,33 @@ sal_Bool OConfigurationRegistryKey::implIsValid() throw ()
}
//--------------------------------------------------------------------------
-void OConfigurationRegistryKey::checkValid(KEY_ACCESS_TYPE _eIntentedAccess) throw (InvalidRegistryException,RuntimeException)
+void OConfigurationRegistryKey::checkValid(KEY_ACCESS_TYPE _eIntentedAccess) throw (com::sun::star::registry::InvalidRegistryException,com::sun::star::uno::RuntimeException)
{
if (!implIsValid())
- throw InvalidRegistryException(UNISTRING("The registry is not bound to a configuration node anymore."), THISREF());
+ throw com::sun::star::registry::InvalidRegistryException(UNISTRING("The registry is not bound to a configuration node anymore."), THISREF());
// "anymore", because at the moment the ctor was called it probably was bound ....
switch (_eIntentedAccess)
{
case KAT_VALUE_WRITE:
if (implIsReadOnly())
- throw InvalidRegistryException(UNISTRING("This configuration node is not writeable."), THISREF());
+ throw com::sun::star::registry::InvalidRegistryException(UNISTRING("This configuration node is not writeable."), THISREF());
// !!! NO !!! BREAK !!!
case KAT_VALUE:
if (m_xNode.is())
- throw InvalidRegistryException(UNISTRING("This configuration node is not a value, but an internal container."), THISREF());
+ throw com::sun::star::registry::InvalidRegistryException(UNISTRING("This configuration node is not a value, but an internal container."), THISREF());
if (!m_xParentNode.is())
- throw InvalidRegistryException(UNISTRING("This configuration node is invalid. It has no parent."), THISREF());
+ throw com::sun::star::registry::InvalidRegistryException(UNISTRING("This configuration node is invalid. It has no parent."), THISREF());
if (!implEnsureValue())
- throw InvalidRegistryException(UNISTRING("This configuration does not have a legal value type."), THISREF());
+ throw com::sun::star::registry::InvalidRegistryException(UNISTRING("This configuration does not have a legal value type."), THISREF());
break;
case KAT_CHILD:
if (!implEnsureNode())
- throw InvalidRegistryException(UNISTRING("This configuration node does not have children, it is a value node."), THISREF());
+ throw com::sun::star::registry::InvalidRegistryException(UNISTRING("This configuration node does not have children, it is a value node."), THISREF());
break;
case KAT_META:
@@ -426,96 +411,96 @@ void OConfigurationRegistryKey::checkValid(KEY_ACCESS_TYPE _eIntentedAccess) thr
}
//--------------------------------------------------------------------------
-Any OConfigurationRegistryKey::implCreateDefaultElement(Type const& _aValueType) throw (RuntimeException)
+com::sun::star::uno::Any OConfigurationRegistryKey::implCreateDefaultElement(com::sun::star::uno::Type const& _aValueType) throw (com::sun::star::uno::RuntimeException)
{
- Any aReturn;
+ com::sun::star::uno::Any aReturn;
switch (_aValueType.getTypeClass())
{
- case TypeClass_STRING:
- aReturn <<= OUString();
+ case com::sun::star::uno::TypeClass_STRING:
+ aReturn <<= rtl::OUString();
break;
// we don't distinguish between the different integer types or boolean
// (the RegistryKeyType is not granular enough),
// but we can't handle them all the same way here
- case TypeClass_BYTE:
- case TypeClass_UNSIGNED_SHORT:
- case TypeClass_SHORT:
+ case com::sun::star::uno::TypeClass_BYTE:
+ case com::sun::star::uno::TypeClass_UNSIGNED_SHORT:
+ case com::sun::star::uno::TypeClass_SHORT:
aReturn <<= (sal_Int16)0;
break;
- case TypeClass_UNSIGNED_LONG:
- case TypeClass_LONG:
+ case com::sun::star::uno::TypeClass_UNSIGNED_LONG:
+ case com::sun::star::uno::TypeClass_LONG:
aReturn <<= (sal_Int32)0;
break;
- case TypeClass_BOOLEAN:
+ case com::sun::star::uno::TypeClass_BOOLEAN:
aReturn <<= sal_Bool(false);
break;
// we cannot really handle 64-bit ints in the registry (but here we can)
- case TypeClass_UNSIGNED_HYPER:
- case TypeClass_HYPER:
+ case com::sun::star::uno::TypeClass_UNSIGNED_HYPER:
+ case com::sun::star::uno::TypeClass_HYPER:
OSL_ENSURE(false, "Warning: cannot handle 64-bit values correctly in registry");
aReturn <<= (sal_Int64)0;
break;
// we cannot really handle doubles in the registry (but here we can)
- case TypeClass_FLOAT:
- case TypeClass_DOUBLE:
+ case com::sun::star::uno::TypeClass_FLOAT:
+ case com::sun::star::uno::TypeClass_DOUBLE:
OSL_ENSURE(false, "Warning: cannot handle DOUBLE correctly in registry");
aReturn <<= (double)0;
break;
// we really want to leave an Any as NULL - hopefully this is acceptable to the set
- case TypeClass_ANY:
+ case com::sun::star::uno::TypeClass_ANY:
break;
- case TypeClass_SEQUENCE:
+ case com::sun::star::uno::TypeClass_SEQUENCE:
if (_aValueType == getBinaryDataType())
- aReturn <<= Sequence< sal_Int8 >();
+ aReturn <<= com::sun::star::uno::Sequence< sal_Int8 >();
else
{
- Type aElementType = getSequenceElementType(_aValueType);
+ com::sun::star::uno::Type aElementType = getSequenceElementType(_aValueType);
switch (aElementType.getTypeClass())
{
- case TypeClass_STRING:
- aReturn <<= Sequence< OUString >();
+ case com::sun::star::uno::TypeClass_STRING:
+ aReturn <<= com::sun::star::uno::Sequence< rtl::OUString >();
break;
- case TypeClass_BYTE:
- case TypeClass_UNSIGNED_SHORT:
- case TypeClass_SHORT:
- aReturn <<= Sequence< sal_Int16 >();
+ case com::sun::star::uno::TypeClass_BYTE:
+ case com::sun::star::uno::TypeClass_UNSIGNED_SHORT:
+ case com::sun::star::uno::TypeClass_SHORT:
+ aReturn <<= com::sun::star::uno::Sequence< sal_Int16 >();
break;
- case TypeClass_UNSIGNED_LONG:
- case TypeClass_LONG:
- aReturn <<= Sequence< sal_Int32 >();
+ case com::sun::star::uno::TypeClass_UNSIGNED_LONG:
+ case com::sun::star::uno::TypeClass_LONG:
+ aReturn <<= com::sun::star::uno::Sequence< sal_Int32 >();
break;
- case TypeClass_BOOLEAN:
- aReturn <<= Sequence< sal_Bool >();
+ case com::sun::star::uno::TypeClass_BOOLEAN:
+ aReturn <<= com::sun::star::uno::Sequence< sal_Bool >();
break;
- case TypeClass_UNSIGNED_HYPER:
- case TypeClass_HYPER:
- aReturn <<= Sequence< sal_Int64 >();
+ case com::sun::star::uno::TypeClass_UNSIGNED_HYPER:
+ case com::sun::star::uno::TypeClass_HYPER:
+ aReturn <<= com::sun::star::uno::Sequence< sal_Int64 >();
break;
- case TypeClass_FLOAT:
- case TypeClass_DOUBLE:
- aReturn <<= Sequence< double >();
+ case com::sun::star::uno::TypeClass_FLOAT:
+ case com::sun::star::uno::TypeClass_DOUBLE:
+ aReturn <<= com::sun::star::uno::Sequence< double >();
break;
- case TypeClass_SEQUENCE:
+ case com::sun::star::uno::TypeClass_SEQUENCE:
OSL_ENSURE(false, "Warning: cannot handle Sequence< BINARY > correctly in registry");
if (aElementType == getBinaryDataType())
{
OSL_ENSURE(false, "Warning: cannot handle Sequence< BINARY > correctly in registry");
- aReturn <<= Sequence< Sequence< sal_Int8 > >();
+ aReturn <<= com::sun::star::uno::Sequence< com::sun::star::uno::Sequence< sal_Int8 > >();
break;
}
@@ -528,7 +513,7 @@ Any OConfigurationRegistryKey::implCreateDefaultElement(Type const& _aValueType)
}
break;
- case TypeClass_INTERFACE:
+ case com::sun::star::uno::TypeClass_INTERFACE:
OSL_ENSURE(false, "Invalid call to OConfigurationRegistryKey::implCreateDefaultElement. Inner nodes must be created by a factory");
break;
@@ -538,15 +523,15 @@ Any OConfigurationRegistryKey::implCreateDefaultElement(Type const& _aValueType)
break;
}
- OSL_ENSURE( aReturn.getValueType() == _aValueType || (_aValueType.getTypeClass() == TypeClass_ANY && !aReturn.hasValue()),
+ OSL_ENSURE( aReturn.getValueType() == _aValueType || (_aValueType.getTypeClass() == com::sun::star::uno::TypeClass_ANY && !aReturn.hasValue()),
"Warning: Unexpected data type found in Registry - returning similar value or NULL");
return aReturn;
}
//--------------------------------------------------------------------------
-Any OConfigurationRegistryKey::implGetDescendant(const OUString& _rDescendantName) throw(InvalidRegistryException, RuntimeException)
+com::sun::star::uno::Any OConfigurationRegistryKey::implGetDescendant(const rtl::OUString& _rDescendantName) throw(com::sun::star::registry::InvalidRegistryException, com::sun::star::uno::RuntimeException)
{
- Any aElementReturn;
+ com::sun::star::uno::Any aElementReturn;
try
{
@@ -556,7 +541,7 @@ Any OConfigurationRegistryKey::implGetDescendant(const OUString& _rDescendantNam
OSL_ENSURE(sal_False, "OConfigurationRegistryKey::getDescendant : invalid call !");
// this method should not be called if the object does not represent a container node ...
- throw InvalidRegistryException(UNISTRING("invalid object."), THISREF());
+ throw com::sun::star::registry::InvalidRegistryException(UNISTRING("invalid object."), THISREF());
}
try
@@ -564,129 +549,129 @@ Any OConfigurationRegistryKey::implGetDescendant(const OUString& _rDescendantNam
// look for a local member first
aElementReturn = m_xNode->getByName(_rDescendantName);
}
- catch(NoSuchElementException&)
+ catch(com::sun::star::container::NoSuchElementException&)
{
// is it a (possibly) hierarchical name ?
if ( _rDescendantName.indexOf('/') <0 ) throw;
// Yes, so try deep access
- Reference< XHierarchicalNameAccess > xDeepAccess( m_xNode, UNO_QUERY );
+ com::sun::star::uno::Reference< com::sun::star::container::XHierarchicalNameAccess > xDeepAccess( m_xNode, com::sun::star::uno::UNO_QUERY );
if (!xDeepAccess.is())
- throw InvalidRegistryException(UNISTRING("Nested element access not supported by this node."), THISREF());
+ throw com::sun::star::registry::InvalidRegistryException(UNISTRING("Nested element access not supported by this node."), THISREF());
aElementReturn = xDeepAccess->getByHierarchicalName(_rDescendantName);
}
}
- catch(NoSuchElementException&)
+ catch(com::sun::star::container::NoSuchElementException&)
{ // not allowed to leave the method, wrap it
- OUString sMessage(UNISTRING("There is no element named "));
+ rtl::OUString sMessage(UNISTRING("There is no element named "));
sMessage += _rDescendantName;
sMessage += UNISTRING(".");
- throw InvalidRegistryException(sMessage, THISREF());
+ throw com::sun::star::registry::InvalidRegistryException(sMessage, THISREF());
}
- catch(WrappedTargetException& wte)
+ catch(com::sun::star::lang::WrappedTargetException& wte)
{ // allowed to be thrown by XNameAccess::getByName, but not allowed to leave this method
- OUString sMessage(UNISTRING("The configuration node could not provide an element for "));
+ rtl::OUString sMessage(UNISTRING("The configuration node could not provide an element for "));
sMessage += _rDescendantName;
sMessage += UNISTRING(". Original Error: ");
sMessage += wte.Message;
- throw InvalidRegistryException(sMessage, THISREF());
+ throw com::sun::star::registry::InvalidRegistryException(sMessage, THISREF());
}
return aElementReturn;
}
//--------------------------------------------------------------------------
-void OConfigurationRegistryKey::implSetValue(const Any& _rValue) throw(InvalidRegistryException, RuntimeException)
+void OConfigurationRegistryKey::implSetValue(const com::sun::star::uno::Any& _rValue) throw(com::sun::star::registry::InvalidRegistryException, com::sun::star::uno::RuntimeException)
{
checkValid(KAT_VALUE_WRITE);
// one possible interface
- Reference< XNameReplace > xParentValueAccess(m_xParentNode, UNO_QUERY);
+ com::sun::star::uno::Reference< com::sun::star::container::XNameReplace > xParentValueAccess(m_xParentNode, com::sun::star::uno::UNO_QUERY);
if (xParentValueAccess.is())
{
try
{
xParentValueAccess->replaceByName(m_sLocalName, _rValue);
}
- catch(IllegalArgumentException& iae)
+ catch(com::sun::star::lang::IllegalArgumentException& iae)
{
- OUString sMessage = UNISTRING("Unable to replace the old value. The configuration node threw an ");
+ rtl::OUString sMessage = UNISTRING("Unable to replace the old value. The configuration node threw an ");
sMessage += UNISTRING("IllegalArgumentException: ");
sMessage += iae.Message;
- throw InvalidRegistryException(sMessage, THISREF());
+ throw com::sun::star::registry::InvalidRegistryException(sMessage, THISREF());
}
- catch(NoSuchElementException& nse)
+ catch(com::sun::star::container::NoSuchElementException& nse)
{
OSL_ENSURE(false, "OConfigurationRegistryKey::writeValueNode : a NoSuchElementException should be impossible !");
- OUString sMessage = UNISTRING("Unable to replace the old value. The configuration node threw an ");
+ rtl::OUString sMessage = UNISTRING("Unable to replace the old value. The configuration node threw an ");
sMessage += UNISTRING("NoSuchElementException: ");
sMessage += nse.Message;
- throw InvalidRegistryException(sMessage, THISREF());
+ throw com::sun::star::registry::InvalidRegistryException(sMessage, THISREF());
}
- catch(WrappedTargetException& wte)
+ catch(com::sun::star::lang::WrappedTargetException& wte)
{
- OUString sMessage = UNISTRING("Unable to replace the old value. The configuration node threw an ");
+ rtl::OUString sMessage = UNISTRING("Unable to replace the old value. The configuration node threw an ");
sMessage += UNISTRING("WrappedTargetException: ");
sMessage += wte.Message;
- throw InvalidRegistryException(sMessage, THISREF());
+ throw com::sun::star::registry::InvalidRegistryException(sMessage, THISREF());
}
return;
}
// not found - try other interface
- Reference< XPropertySet > xParentPropertySet(m_xParentNode, UNO_QUERY);
+ com::sun::star::uno::Reference< com::sun::star::beans::XPropertySet > xParentPropertySet(m_xParentNode, com::sun::star::uno::UNO_QUERY);
if (xParentPropertySet.is())
{
try
{
xParentPropertySet->setPropertyValue(m_sLocalName, _rValue);
}
- catch(IllegalArgumentException& iae)
+ catch(com::sun::star::lang::IllegalArgumentException& iae)
{
- OUString sMessage = UNISTRING("Unable to set a new value. The configuration node threw an ");
+ rtl::OUString sMessage = UNISTRING("Unable to set a new value. The configuration node threw an ");
sMessage += UNISTRING("IllegalArgumentException: ");
sMessage += iae.Message;
- throw InvalidRegistryException(sMessage, THISREF());
+ throw com::sun::star::registry::InvalidRegistryException(sMessage, THISREF());
}
- catch(UnknownPropertyException& upe)
+ catch(com::sun::star::beans::UnknownPropertyException& upe)
{
OSL_ENSURE(false, "OConfigurationRegistryKey::writeValueNode : a UnknownPropertyException should be impossible !");
- OUString sMessage = UNISTRING("Unable to set a new value. The configuration node threw an ");
+ rtl::OUString sMessage = UNISTRING("Unable to set a new value. The configuration node threw an ");
sMessage += UNISTRING("UnknownPropertyException: ");
sMessage += upe.Message;
- throw InvalidRegistryException(sMessage, THISREF());
+ throw com::sun::star::registry::InvalidRegistryException(sMessage, THISREF());
}
- catch(PropertyVetoException& pve)
+ catch(com::sun::star::beans::PropertyVetoException& pve)
{
- OUString sMessage = UNISTRING("Unable to set a new value. The configuration node threw an ");
+ rtl::OUString sMessage = UNISTRING("Unable to set a new value. The configuration node threw an ");
sMessage += UNISTRING("PropertyVetoException: ");
sMessage += pve.Message;
- throw InvalidRegistryException(sMessage, THISREF());
+ throw com::sun::star::registry::InvalidRegistryException(sMessage, THISREF());
}
- catch(WrappedTargetException& wte)
+ catch(com::sun::star::lang::WrappedTargetException& wte)
{
- OUString sMessage = UNISTRING("Unable to set a new value. The configuration node threw an ");
+ rtl::OUString sMessage = UNISTRING("Unable to set a new value. The configuration node threw an ");
sMessage += UNISTRING("WrappedTargetException: ");
sMessage += wte.Message;
- throw InvalidRegistryException(sMessage, THISREF());
+ throw com::sun::star::registry::InvalidRegistryException(sMessage, THISREF());
}
return;
}
- throw InvalidRegistryException(UNISTRING("No interface found on parent node for writing to configuration value node."), THISREF());
+ throw com::sun::star::registry::InvalidRegistryException(UNISTRING("No interface found on parent node for writing to configuration value node."), THISREF());
}
//--------------------------------------------------------------------------
-::rtl::OUString SAL_CALL OConfigurationRegistryKey::getKeyName() throw(RuntimeException)
+::rtl::OUString SAL_CALL OConfigurationRegistryKey::getKeyName() throw(com::sun::star::uno::RuntimeException)
{
return m_sLocalName;
}
//--------------------------------------------------------------------------
-sal_Bool SAL_CALL OConfigurationRegistryKey::isReadOnly() throw(InvalidRegistryException, RuntimeException)
+sal_Bool SAL_CALL OConfigurationRegistryKey::isReadOnly() throw(com::sun::star::registry::InvalidRegistryException, com::sun::star::uno::RuntimeException)
{
OSL_ASSERT(UnoApiLock::isHeld());
checkValid(KAT_META);
@@ -694,7 +679,7 @@ sal_Bool SAL_CALL OConfigurationRegistryKey::isReadOnly() throw(InvalidRegistryE
}
//--------------------------------------------------------------------------
-sal_Bool SAL_CALL OConfigurationRegistryKey::isValid() throw(RuntimeException)
+sal_Bool SAL_CALL OConfigurationRegistryKey::isValid() throw(com::sun::star::uno::RuntimeException)
{
OSL_ASSERT(UnoApiLock::isHeld());
// TODO : perhaps if the registry we're a part of is closed ....
@@ -702,7 +687,7 @@ sal_Bool SAL_CALL OConfigurationRegistryKey::isValid() throw(RuntimeException)
}
//--------------------------------------------------------------------------
-RegistryKeyType SAL_CALL OConfigurationRegistryKey::getKeyType( const ::rtl::OUString& /*_rKeyName*/ ) throw(InvalidRegistryException, RuntimeException)
+com::sun::star::registry::RegistryKeyType SAL_CALL OConfigurationRegistryKey::getKeyType( const ::rtl::OUString& /*_rKeyName*/ ) throw(com::sun::star::registry::InvalidRegistryException, com::sun::star::uno::RuntimeException)
{
OSL_ASSERT(UnoApiLock::isHeld());
@@ -710,87 +695,87 @@ RegistryKeyType SAL_CALL OConfigurationRegistryKey::getKeyType( const ::rtl::OUS
// Maybe we should check only KAT_META for consistency ?
checkValid(KAT_CHILD);
- return RegistryKeyType_KEY;
+ return com::sun::star::registry::RegistryKeyType_KEY;
}
//--------------------------------------------------------------------------
-RegistryValueType SAL_CALL OConfigurationRegistryKey::getValueType() throw(InvalidRegistryException, RuntimeException)
+com::sun::star::registry::RegistryValueType SAL_CALL OConfigurationRegistryKey::getValueType() throw(com::sun::star::registry::InvalidRegistryException, com::sun::star::uno::RuntimeException)
{
checkValid(KAT_META);
- const Type aUnoType = implGetUnoType();
+ const com::sun::star::uno::Type aUnoType = implGetUnoType();
switch (aUnoType.getTypeClass())
{
- case TypeClass_INTERFACE: // this is really a case of 'no value type'
- return RegistryValueType_NOT_DEFINED;
+ case com::sun::star::uno::TypeClass_INTERFACE: // this is really a case of 'no value type'
+ return com::sun::star::registry::RegistryValueType_NOT_DEFINED;
- case TypeClass_ANY: // this is really a case of 'all value types allowed'
- return RegistryValueType_NOT_DEFINED;
+ case com::sun::star::uno::TypeClass_ANY: // this is really a case of 'all value types allowed'
+ return com::sun::star::registry::RegistryValueType_NOT_DEFINED;
- case TypeClass_STRING:
- return RegistryValueType_STRING;
+ case com::sun::star::uno::TypeClass_STRING:
+ return com::sun::star::registry::RegistryValueType_STRING;
- case TypeClass_BYTE:
- case TypeClass_UNSIGNED_SHORT:
- case TypeClass_UNSIGNED_LONG:
+ case com::sun::star::uno::TypeClass_BYTE:
+ case com::sun::star::uno::TypeClass_UNSIGNED_SHORT:
+ case com::sun::star::uno::TypeClass_UNSIGNED_LONG:
OSL_ENSURE(false, "Unexpected UNSIGNED type found for configuration node");
// FALL THRU
- case TypeClass_BOOLEAN:
- case TypeClass_SHORT:
- case TypeClass_LONG:
- return RegistryValueType_LONG;
+ case com::sun::star::uno::TypeClass_BOOLEAN:
+ case com::sun::star::uno::TypeClass_SHORT:
+ case com::sun::star::uno::TypeClass_LONG:
+ return com::sun::star::registry::RegistryValueType_LONG;
- case TypeClass_FLOAT:
- case TypeClass_DOUBLE:
+ case com::sun::star::uno::TypeClass_FLOAT:
+ case com::sun::star::uno::TypeClass_DOUBLE:
OSL_ENSURE(sal_False, "OConfigurationRegistryKey::getValueType : registry does not support floating point numbers !");
- return RegistryValueType_LONG;
+ return com::sun::star::registry::RegistryValueType_LONG;
- case TypeClass_UNSIGNED_HYPER:
- case TypeClass_HYPER:
+ case com::sun::star::uno::TypeClass_UNSIGNED_HYPER:
+ case com::sun::star::uno::TypeClass_HYPER:
OSL_ENSURE(sal_False, "OConfigurationRegistryKey::getValueType : registry does not support 64-bit integer numbers !");
- return RegistryValueType_LONG;
+ return com::sun::star::registry::RegistryValueType_LONG;
- case TypeClass_SEQUENCE:
+ case com::sun::star::uno::TypeClass_SEQUENCE:
if ( aUnoType.equals( getBinaryDataType() ) )
- return RegistryValueType_BINARY;
+ return com::sun::star::registry::RegistryValueType_BINARY;
else
{
- Type aElementType = getSequenceElementType(aUnoType);
+ com::sun::star::uno::Type aElementType = getSequenceElementType(aUnoType);
switch (aElementType.getTypeClass())
{
- case TypeClass_STRING:
- return RegistryValueType_STRINGLIST;
+ case com::sun::star::uno::TypeClass_STRING:
+ return com::sun::star::registry::RegistryValueType_STRINGLIST;
- case TypeClass_BYTE:
+ case com::sun::star::uno::TypeClass_BYTE:
OSL_ASSERT(false); // this is caught by the 'binary' case
- case TypeClass_UNSIGNED_SHORT:
- case TypeClass_UNSIGNED_LONG:
+ case com::sun::star::uno::TypeClass_UNSIGNED_SHORT:
+ case com::sun::star::uno::TypeClass_UNSIGNED_LONG:
OSL_ENSURE(false, "Unexpected UNSIGNED-List type found for configuration node");
// FALL THRU
- case TypeClass_BOOLEAN:
- case TypeClass_SHORT:
- case TypeClass_LONG:
- return RegistryValueType_LONGLIST;
+ case com::sun::star::uno::TypeClass_BOOLEAN:
+ case com::sun::star::uno::TypeClass_SHORT:
+ case com::sun::star::uno::TypeClass_LONG:
+ return com::sun::star::registry::RegistryValueType_LONGLIST;
- case TypeClass_FLOAT:
- case TypeClass_DOUBLE:
+ case com::sun::star::uno::TypeClass_FLOAT:
+ case com::sun::star::uno::TypeClass_DOUBLE:
OSL_ENSURE(sal_False, "OConfigurationRegistryKey::getValueType : registry does not support floating point number lists !");
- return RegistryValueType_LONGLIST;
+ return com::sun::star::registry::RegistryValueType_LONGLIST;
- case TypeClass_UNSIGNED_HYPER:
- case TypeClass_HYPER:
+ case com::sun::star::uno::TypeClass_UNSIGNED_HYPER:
+ case com::sun::star::uno::TypeClass_HYPER:
OSL_ENSURE(sal_False, "OConfigurationRegistryKey::getValueType : registry does not support 64-bit integer number lists !");
- return RegistryValueType_LONGLIST;
+ return com::sun::star::registry::RegistryValueType_LONGLIST;
- case TypeClass_ANY:
+ case com::sun::star::uno::TypeClass_ANY:
OSL_ENSURE(sal_False, "OConfigurationRegistryKey::getValueType : Unexpected: Any as sequence element type !");
- return RegistryValueType_NOT_DEFINED;
+ return com::sun::star::registry::RegistryValueType_NOT_DEFINED;
default:
if (aElementType.equals(getBinaryDataType()))
@@ -798,19 +783,19 @@ RegistryValueType SAL_CALL OConfigurationRegistryKey::getValueType() throw(Inval
else
OSL_ENSURE(sal_False, "OConfigurationRegistryKey::getValueType : unknown sequence element type !");
- return RegistryValueType_NOT_DEFINED;
+ return com::sun::star::registry::RegistryValueType_NOT_DEFINED;
}
}
default:
OSL_ENSURE(sal_False, "OConfigurationRegistryKey::getValueType : unknown entry type !");
- return RegistryValueType_NOT_DEFINED;
+ return com::sun::star::registry::RegistryValueType_NOT_DEFINED;
}
}
//--------------------------------------------------------------------------
-Any OConfigurationRegistryKey::implGetValue() throw(InvalidRegistryException, RuntimeException)
+com::sun::star::uno::Any OConfigurationRegistryKey::implGetValue() throw(com::sun::star::registry::InvalidRegistryException, com::sun::star::uno::RuntimeException)
{
checkValid(KAT_VALUE);
@@ -818,22 +803,22 @@ Any OConfigurationRegistryKey::implGetValue() throw(InvalidRegistryException, Ru
}
//--------------------------------------------------------------------------
-sal_Int32 SAL_CALL OConfigurationRegistryKey::getLongValue() throw(InvalidRegistryException, InvalidValueException, RuntimeException)
+sal_Int32 SAL_CALL OConfigurationRegistryKey::getLongValue() throw(com::sun::star::registry::InvalidRegistryException, com::sun::star::registry::InvalidValueException, com::sun::star::uno::RuntimeException)
{
- Any aValue = implGetValue();
+ com::sun::star::uno::Any aValue = implGetValue();
sal_Int32 nLongValue(0);
switch (aValue.getValueTypeClass())
{
// integral types that are small enough are straightforward
- case TypeClass_BYTE : { sal_Int8 nNativeValue = 0; aValue >>= nNativeValue; nLongValue = nNativeValue; } break;
- case TypeClass_BOOLEAN : { sal_Bool nNativeValue = false; aValue >>= nNativeValue; nLongValue = nNativeValue; } break;
- case TypeClass_SHORT : { sal_Int16 nNativeValue; aValue >>= nNativeValue; nLongValue = nNativeValue; } break;
- case TypeClass_UNSIGNED_SHORT : { sal_uInt16 nNativeValue; aValue >>= nNativeValue; nLongValue = nNativeValue; } break;
- case TypeClass_LONG : { sal_Int32 nNativeValue; aValue >>= nNativeValue; nLongValue = nNativeValue; } break;
+ case com::sun::star::uno::TypeClass_BYTE : { sal_Int8 nNativeValue = 0; aValue >>= nNativeValue; nLongValue = nNativeValue; } break;
+ case com::sun::star::uno::TypeClass_BOOLEAN : { sal_Bool nNativeValue = false; aValue >>= nNativeValue; nLongValue = nNativeValue; } break;
+ case com::sun::star::uno::TypeClass_SHORT : { sal_Int16 nNativeValue; aValue >>= nNativeValue; nLongValue = nNativeValue; } break;
+ case com::sun::star::uno::TypeClass_UNSIGNED_SHORT : { sal_uInt16 nNativeValue; aValue >>= nNativeValue; nLongValue = nNativeValue; } break;
+ case com::sun::star::uno::TypeClass_LONG : { sal_Int32 nNativeValue; aValue >>= nNativeValue; nLongValue = nNativeValue; } break;
// this is lossless, but not value-preserving - use cast to avoid warnings
- case TypeClass_UNSIGNED_LONG:
+ case com::sun::star::uno::TypeClass_UNSIGNED_LONG:
{
sal_uInt32 nNativeValue;
aValue >>= nNativeValue;
@@ -842,7 +827,7 @@ sal_Int32 SAL_CALL OConfigurationRegistryKey::getLongValue() throw(InvalidRegist
break;
// the following are larger than Long - check for loss and throw if applicable
- case TypeClass_HYPER:
+ case com::sun::star::uno::TypeClass_HYPER:
{
sal_Int64 nNativeValue;
aValue >>= nNativeValue;
@@ -850,11 +835,11 @@ sal_Int32 SAL_CALL OConfigurationRegistryKey::getLongValue() throw(InvalidRegist
// check for data loss
if (sal_Int64(nLongValue) != nNativeValue)
- throw InvalidValueException(UNISTRING("Unsigned Hyper value too large for long; Value cannot be retrieved using registry."), THISREF());
+ throw com::sun::star::registry::InvalidValueException(UNISTRING("Unsigned Hyper value too large for long; Value cannot be retrieved using registry."), THISREF());
}
break;
- case TypeClass_UNSIGNED_HYPER:
+ case com::sun::star::uno::TypeClass_UNSIGNED_HYPER:
{
sal_uInt64 nNativeValue;
aValue >>= nNativeValue;
@@ -862,12 +847,12 @@ sal_Int32 SAL_CALL OConfigurationRegistryKey::getLongValue() throw(InvalidRegist
// check for data loss
if (sal_uInt64(sal_uInt32(nLongValue)) != nNativeValue)
- throw InvalidValueException(UNISTRING("Unsigned Hyper value too large for long; Value cannot be retrieved using registry."), THISREF());
+ throw com::sun::star::registry::InvalidValueException(UNISTRING("Unsigned Hyper value too large for long; Value cannot be retrieved using registry."), THISREF());
}
break;
// for floating point types we need a limit for loss checking
- case TypeClass_FLOAT:
+ case com::sun::star::uno::TypeClass_FLOAT:
OSL_ENSURE(false, "Unexpected type FLOAT in configuration node");
{
// treat as double
@@ -877,7 +862,7 @@ sal_Int32 SAL_CALL OConfigurationRegistryKey::getLongValue() throw(InvalidRegist
}
// fall thru
- case TypeClass_DOUBLE:
+ case com::sun::star::uno::TypeClass_DOUBLE:
{
double fNativeValue = 0;
aValue >>= fNativeValue;
@@ -916,35 +901,35 @@ sal_Int32 SAL_CALL OConfigurationRegistryKey::getLongValue() throw(InvalidRegist
if (bRecheck)
{
if (diff > fEps || diff < -fEps)
- throw InvalidValueException(UNISTRING("Double value cannot fit in Long; Value cannot be retrieved using registry."), THISREF());
+ throw com::sun::star::registry::InvalidValueException(UNISTRING("Double value cannot fit in Long; Value cannot be retrieved using registry."), THISREF());
}
}
break;
- case TypeClass_VOID:
+ case com::sun::star::uno::TypeClass_VOID:
// allow NULL values, if we maybe advertise this node as long
- if (this->getValueType() == RegistryValueType_LONG)
+ if (this->getValueType() == com::sun::star::registry::RegistryValueType_LONG)
break;
// else FALL THRU to exception
default:
- throw InvalidValueException(UNISTRING("This node does not contain a long (or a compatible) value."), THISREF());
+ throw com::sun::star::registry::InvalidValueException(UNISTRING("This node does not contain a long (or a compatible) value."), THISREF());
}
return nLongValue;
}
//--------------------------------------------------------------------------
-void SAL_CALL OConfigurationRegistryKey::setLongValue( sal_Int32 _nValue ) throw(InvalidRegistryException, RuntimeException)
+void SAL_CALL OConfigurationRegistryKey::setLongValue( sal_Int32 _nValue ) throw(com::sun::star::registry::InvalidRegistryException, com::sun::star::uno::RuntimeException)
{
- implSetValue(makeAny(_nValue));
+ implSetValue(com::sun::star::uno::makeAny(_nValue));
}
//--------------------------------------------------------------------------
-Sequence< sal_Int32 > SAL_CALL OConfigurationRegistryKey::getLongListValue() throw(InvalidRegistryException, InvalidValueException, RuntimeException)
+com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL OConfigurationRegistryKey::getLongListValue() throw(com::sun::star::registry::InvalidRegistryException, com::sun::star::registry::InvalidValueException, com::sun::star::uno::RuntimeException)
{
- Any aValue = implGetValue();
+ com::sun::star::uno::Any aValue = implGetValue();
- Sequence< sal_Int32 > aReturn;
+ com::sun::star::uno::Sequence< sal_Int32 > aReturn;
if (!aValue.hasValue())
checkNullable();// let NULL values pass
@@ -952,31 +937,31 @@ Sequence< sal_Int32 > SAL_CALL OConfigurationRegistryKey::getLongListValue() thr
{
// TODO : maybe it's a sequence of sal_Int8 or anything like that which we're able to convert ....
- throw InvalidValueException(UNISTRING("This configuration node does not contain a list of longs !"), THISREF());
+ throw com::sun::star::registry::InvalidValueException(UNISTRING("This configuration node does not contain a list of longs !"), THISREF());
}
return aReturn;
}
//--------------------------------------------------------------------------
-void SAL_CALL OConfigurationRegistryKey::setLongListValue( const Sequence< sal_Int32 >& _seqValue ) throw(InvalidRegistryException, RuntimeException)
+void SAL_CALL OConfigurationRegistryKey::setLongListValue( const com::sun::star::uno::Sequence< sal_Int32 >& _seqValue ) throw(com::sun::star::registry::InvalidRegistryException, com::sun::star::uno::RuntimeException)
{
- implSetValue(makeAny(_seqValue));
+ implSetValue(com::sun::star::uno::makeAny(_seqValue));
}
//--------------------------------------------------------------------------
-OUString SAL_CALL OConfigurationRegistryKey::getAsciiValue() throw(InvalidRegistryException, InvalidValueException, RuntimeException)
+rtl::OUString SAL_CALL OConfigurationRegistryKey::getAsciiValue() throw(com::sun::star::registry::InvalidRegistryException, com::sun::star::registry::InvalidValueException, com::sun::star::uno::RuntimeException)
{
- OUString sReturn = getStringValue();
+ rtl::OUString sReturn = getStringValue();
if (!isAscii(sReturn))
- throw InvalidValueException(UNISTRING("This configuration node value (a string) is not pure ASCII !"), THISREF());
+ throw com::sun::star::registry::InvalidValueException(UNISTRING("This configuration node value (a string) is not pure ASCII !"), THISREF());
return sReturn;
}
//--------------------------------------------------------------------------
-void SAL_CALL OConfigurationRegistryKey::setAsciiValue( const ::rtl::OUString& _rValue ) throw(InvalidRegistryException, RuntimeException)
+void SAL_CALL OConfigurationRegistryKey::setAsciiValue( const ::rtl::OUString& _rValue ) throw(com::sun::star::registry::InvalidRegistryException, com::sun::star::uno::RuntimeException)
{
OSL_ENSURE( isAscii(_rValue), "The string passesd to OConfigurationRegistryKey::setAsciiValue is not pure ASCII");
@@ -984,18 +969,18 @@ void SAL_CALL OConfigurationRegistryKey::setAsciiValue( const ::rtl::OUString& _
}
//--------------------------------------------------------------------------
-Sequence< OUString > SAL_CALL OConfigurationRegistryKey::getAsciiListValue() throw(InvalidRegistryException, InvalidValueException, RuntimeException)
+com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL OConfigurationRegistryKey::getAsciiListValue() throw(com::sun::star::registry::InvalidRegistryException, com::sun::star::registry::InvalidValueException, com::sun::star::uno::RuntimeException)
{
- Sequence<OUString> aReturn = getStringListValue();
+ com::sun::star::uno::Sequence<rtl::OUString> aReturn = getStringListValue();
if (!isAscii(aReturn))
- throw InvalidValueException(UNISTRING("This configuration node value (a string list) is not pure ASCII !"), THISREF());
+ throw com::sun::star::registry::InvalidValueException(UNISTRING("This configuration node value (a string list) is not pure ASCII !"), THISREF());
return aReturn;
}
//--------------------------------------------------------------------------
-void SAL_CALL OConfigurationRegistryKey::setAsciiListValue( const Sequence< ::rtl::OUString >& _seqValue ) throw(InvalidRegistryException, RuntimeException)
+void SAL_CALL OConfigurationRegistryKey::setAsciiListValue( const com::sun::star::uno::Sequence< ::rtl::OUString >& _seqValue ) throw(com::sun::star::registry::InvalidRegistryException, com::sun::star::uno::RuntimeException)
{
OSL_ENSURE( isAscii(_seqValue), "The string passesd to OConfigurationRegistryKey::setAsciiValue is not pure ASCII");
@@ -1003,79 +988,79 @@ void SAL_CALL OConfigurationRegistryKey::setAsciiListValue( const Sequence< ::rt
}
//--------------------------------------------------------------------------
-::rtl::OUString SAL_CALL OConfigurationRegistryKey::getStringValue() throw(InvalidRegistryException, InvalidValueException, RuntimeException)
+::rtl::OUString SAL_CALL OConfigurationRegistryKey::getStringValue() throw(com::sun::star::registry::InvalidRegistryException, com::sun::star::registry::InvalidValueException, com::sun::star::uno::RuntimeException)
{
- Any aValue = implGetValue();
+ com::sun::star::uno::Any aValue = implGetValue();
- OUString sReturn;
+ rtl::OUString sReturn;
if (!aValue.hasValue())
checkNullable();// let NULL values pass
else if (!(aValue >>= sReturn))
- throw InvalidValueException(UNISTRING("This node does not contain a string value."), THISREF());
+ throw com::sun::star::registry::InvalidValueException(UNISTRING("This node does not contain a string value."), THISREF());
return sReturn;
}
//--------------------------------------------------------------------------
-void SAL_CALL OConfigurationRegistryKey::setStringValue( const ::rtl::OUString& _rValue ) throw(InvalidRegistryException, RuntimeException)
+void SAL_CALL OConfigurationRegistryKey::setStringValue( const ::rtl::OUString& _rValue ) throw(com::sun::star::registry::InvalidRegistryException, com::sun::star::uno::RuntimeException)
{
- implSetValue(makeAny(_rValue));
+ implSetValue(com::sun::star::uno::makeAny(_rValue));
}
//--------------------------------------------------------------------------
-Sequence< ::rtl::OUString > SAL_CALL OConfigurationRegistryKey::getStringListValue() throw(InvalidRegistryException, InvalidValueException, RuntimeException)
+com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL OConfigurationRegistryKey::getStringListValue() throw(com::sun::star::registry::InvalidRegistryException, com::sun::star::registry::InvalidValueException, com::sun::star::uno::RuntimeException)
{
- Any aValue = implGetValue();
+ com::sun::star::uno::Any aValue = implGetValue();
- Sequence< OUString > aReturn;
+ com::sun::star::uno::Sequence< rtl::OUString > aReturn;
if (!aValue.hasValue())
checkNullable();// let NULL values pass
else if (!(aValue >>= aReturn))
- throw InvalidValueException(UNISTRING("This configuration node does not contain a list of strings !"), THISREF());
+ throw com::sun::star::registry::InvalidValueException(UNISTRING("This configuration node does not contain a list of strings !"), THISREF());
return aReturn;
}
//--------------------------------------------------------------------------
-void SAL_CALL OConfigurationRegistryKey::setStringListValue( const Sequence< ::rtl::OUString >& _seqValue ) throw(InvalidRegistryException, RuntimeException)
+void SAL_CALL OConfigurationRegistryKey::setStringListValue( const com::sun::star::uno::Sequence< ::rtl::OUString >& _seqValue ) throw(com::sun::star::registry::InvalidRegistryException, com::sun::star::uno::RuntimeException)
{
- implSetValue(makeAny(_seqValue));
+ implSetValue(com::sun::star::uno::makeAny(_seqValue));
}
//--------------------------------------------------------------------------
-Sequence< sal_Int8 > SAL_CALL OConfigurationRegistryKey::getBinaryValue() throw(InvalidRegistryException, InvalidValueException, RuntimeException)
+com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL OConfigurationRegistryKey::getBinaryValue() throw(com::sun::star::registry::InvalidRegistryException, com::sun::star::registry::InvalidValueException, com::sun::star::uno::RuntimeException)
{
- Any aValue = implGetValue();
+ com::sun::star::uno::Any aValue = implGetValue();
- Sequence< sal_Int8 > aReturn;
+ com::sun::star::uno::Sequence< sal_Int8 > aReturn;
if (!aValue.hasValue())
checkNullable();// let NULL values pass
else if (!(aValue >>= aReturn))
return aReturn;
- throw InvalidValueException(UNISTRING("This configuration node does not contain a list of strings !"), THISREF());
+ throw com::sun::star::registry::InvalidValueException(UNISTRING("This configuration node does not contain a list of strings !"), THISREF());
}
//--------------------------------------------------------------------------
-void SAL_CALL OConfigurationRegistryKey::setBinaryValue( const Sequence< sal_Int8 >& _rValue ) throw(InvalidRegistryException, RuntimeException)
+void SAL_CALL OConfigurationRegistryKey::setBinaryValue( const com::sun::star::uno::Sequence< sal_Int8 >& _rValue ) throw(com::sun::star::registry::InvalidRegistryException, com::sun::star::uno::RuntimeException)
{
- implSetValue(makeAny(_rValue));
+ implSetValue(com::sun::star::uno::makeAny(_rValue));
}
//--------------------------------------------------------------------------
-Reference< XRegistryKey > OConfigurationRegistryKey::implGetKey( const ::rtl::OUString& _rKeyName )
- throw(InvalidRegistryException, RuntimeException)
+com::sun::star::uno::Reference< com::sun::star::registry::XRegistryKey > OConfigurationRegistryKey::implGetKey( const ::rtl::OUString& _rKeyName )
+ throw(com::sun::star::registry::InvalidRegistryException, com::sun::star::uno::RuntimeException)
{
- Any aDescendant = implGetDescendant(_rKeyName);
- if (aDescendant.getValueType().getTypeClass() == TypeClass_INTERFACE)
+ com::sun::star::uno::Any aDescendant = implGetDescendant(_rKeyName);
+ if (aDescendant.getValueType().getTypeClass() == com::sun::star::uno::TypeClass_INTERFACE)
{
- Reference< XNameAccess > xNode;
+ com::sun::star::uno::Reference< com::sun::star::container::XNameAccess > xNode;
::cppu::extractInterface(xNode, aDescendant);
if (!xNode.is())
- throw InvalidRegistryException(UNISTRING("invalid descendant node. No XNameAccess found."), THISREF());
+ throw com::sun::star::registry::InvalidRegistryException(UNISTRING("invalid descendant node. No XNameAccess found."), THISREF());
return new OConfigurationRegistryKey(xNode, !m_bReadOnly);
}
else
@@ -1083,16 +1068,16 @@ Reference< XRegistryKey > OConfigurationRegistryKey::implGetKey( const ::rtl::OU
#if OSL_DEBUG_LEVEL > 1
switch (aDescendant.getValueType().getTypeClass())
{
- case TypeClass_STRING:
- case TypeClass_SHORT:
- case TypeClass_UNSIGNED_SHORT:
- case TypeClass_BYTE:
- case TypeClass_LONG:
- case TypeClass_UNSIGNED_LONG:
- case TypeClass_BOOLEAN:
- case TypeClass_SEQUENCE:
+ case com::sun::star::uno::TypeClass_STRING:
+ case com::sun::star::uno::TypeClass_SHORT:
+ case com::sun::star::uno::TypeClass_UNSIGNED_SHORT:
+ case com::sun::star::uno::TypeClass_BYTE:
+ case com::sun::star::uno::TypeClass_LONG:
+ case com::sun::star::uno::TypeClass_UNSIGNED_LONG:
+ case com::sun::star::uno::TypeClass_BOOLEAN:
+ case com::sun::star::uno::TypeClass_SEQUENCE:
break;
- case TypeClass_VOID: // NULL value found
+ case com::sun::star::uno::TypeClass_VOID: // NULL value found
break;
default:
OSL_ENSURE(sal_False, "OConfigurationRegistryKey::openKey : unknown, invalid or unhandled descendant value type !");
@@ -1101,24 +1086,24 @@ Reference< XRegistryKey > OConfigurationRegistryKey::implGetKey( const ::rtl::OU
OSL_ASSERT(m_xNode.is());
- Reference< XNameAccess > xDescParent(m_xNode); // the parent config node of the descandent
- OUString sDescRelativeName( _rKeyName ); // local name of the descendant within xDescParent
+ com::sun::star::uno::Reference< com::sun::star::container::XNameAccess > xDescParent(m_xNode); // the parent config node of the descandent
+ rtl::OUString sDescRelativeName( _rKeyName ); // local name of the descendant within xDescParent
if (!m_xNode->hasByName(_rKeyName)) // it is a hierarchical Path -> more work
{
- OUString sParentLocation;
+ rtl::OUString sParentLocation;
if ( !splitPath(_rKeyName, sParentLocation, sDescRelativeName) )
{
- throw InvalidRegistryException(UNISTRING("Cannot split path for value. The internal registry structure seems to be corrupt."), THISREF());
+ throw com::sun::star::registry::InvalidRegistryException(UNISTRING("Cannot split path for value. The internal registry structure seems to be corrupt."), THISREF());
}
if (sParentLocation.getLength())
{
- Any aDescParent = implGetDescendant(sParentLocation);
+ com::sun::star::uno::Any aDescParent = implGetDescendant(sParentLocation);
::cppu::extractInterface(xDescParent, aDescParent);
if (!xDescParent.is())
- throw InvalidRegistryException(UNISTRING("The internal registry structure seems to be corrupt."), THISREF());
+ throw com::sun::star::registry::InvalidRegistryException(UNISTRING("The internal registry structure seems to be corrupt."), THISREF());
}
}
@@ -1130,18 +1115,18 @@ Reference< XRegistryKey > OConfigurationRegistryKey::implGetKey( const ::rtl::OU
}
//--------------------------------------------------------------------------
-Reference< XRegistryKey > SAL_CALL OConfigurationRegistryKey::openKey( const ::rtl::OUString& _rKeyName ) throw(InvalidRegistryException, RuntimeException)
+com::sun::star::uno::Reference< com::sun::star::registry::XRegistryKey > SAL_CALL OConfigurationRegistryKey::openKey( const ::rtl::OUString& _rKeyName ) throw(com::sun::star::registry::InvalidRegistryException, com::sun::star::uno::RuntimeException)
{
checkValid(KAT_CHILD);
return implGetKey(_rKeyName);
}
//--------------------------------------------------------------------------
-bool OConfigurationRegistryKey::checkRelativeKeyName(OUString& _rKeyName) throw(InvalidRegistryException, RuntimeException)
+bool OConfigurationRegistryKey::checkRelativeKeyName(rtl::OUString& _rKeyName) throw(com::sun::star::registry::InvalidRegistryException, com::sun::star::uno::RuntimeException)
{
// no empty names allowed
if (!_rKeyName.getLength())
- throw InvalidRegistryException(UNISTRING("The key name is invalid."), THISREF());
+ throw com::sun::star::registry::InvalidRegistryException(UNISTRING("The key name is invalid."), THISREF());
bool bCleanPath = true;
@@ -1159,21 +1144,21 @@ bool OConfigurationRegistryKey::checkRelativeKeyName(OUString& _rKeyName) throw(
else
{
- Reference< XStringEscape > xSE(m_xNode, UNO_QUERY);
+ com::sun::star::uno::Reference< com::sun::star::util::XStringEscape > xSE(m_xNode, com::sun::star::uno::UNO_QUERY);
sal_Bool bPreferLocal = xSE.is();
if (!bPreferLocal)
{
- Reference< XServiceInfo > xSI(m_xNode, UNO_QUERY);
- if (xSI.is() && xSI->supportsService(OUString::createFromAscii("com.sun.star.configuration.SetAccess")))
+ com::sun::star::uno::Reference< com::sun::star::lang::XServiceInfo > xSI(m_xNode, com::sun::star::uno::UNO_QUERY);
+ if (xSI.is() && xSI->supportsService(rtl::OUString::createFromAscii("com.sun.star.configuration.SetAccess")))
bPreferLocal = true;
}
if (bPreferLocal)
{
- Reference< XHierarchicalNameAccess > xHA(m_xNode, UNO_QUERY);
- OUString sCleanName = _rKeyName.copy(0, nCleanEnd);
+ com::sun::star::uno::Reference< com::sun::star::container::XHierarchicalNameAccess > xHA(m_xNode, com::sun::star::uno::UNO_QUERY);
+ rtl::OUString sCleanName = _rKeyName.copy(0, nCleanEnd);
if (xHA.is() && xHA->hasByHierarchicalName(sCleanName))
bPreferLocal = false;
@@ -1191,11 +1176,11 @@ bool OConfigurationRegistryKey::checkRelativeKeyName(OUString& _rKeyName) throw(
{
// no absolute names ("/...") allowed
if (_rKeyName.getStr()[0] == '/')
- throw InvalidRegistryException(UNISTRING("The key name is invalid. It must be a relative, not an absolute name."), THISREF());
+ throw com::sun::star::registry::InvalidRegistryException(UNISTRING("The key name is invalid. It must be a relative, not an absolute name."), THISREF());
if (nCleanEnd <= 0)
// the original name consists of slashes only
- throw InvalidRegistryException(UNISTRING("The key name is invalid."), THISREF());
+ throw com::sun::star::registry::InvalidRegistryException(UNISTRING("The key name is invalid."), THISREF());
_rKeyName = _rKeyName.copy(0, nCleanEnd);
@@ -1204,27 +1189,27 @@ bool OConfigurationRegistryKey::checkRelativeKeyName(OUString& _rKeyName) throw(
}
//--------------------------------------------------------------------------
-Reference< XRegistryKey > SAL_CALL OConfigurationRegistryKey::createKey( const ::rtl::OUString& _rKeyName ) throw(InvalidRegistryException, RuntimeException)
+com::sun::star::uno::Reference< com::sun::star::registry::XRegistryKey > SAL_CALL OConfigurationRegistryKey::createKey( const ::rtl::OUString& _rKeyName ) throw(com::sun::star::registry::InvalidRegistryException, com::sun::star::uno::RuntimeException)
{
checkValid(KAT_CHILD);
if (m_bReadOnly)
- throw InvalidRegistryException(UNISTRING("The key is read only."), THISREF());
+ throw com::sun::star::registry::InvalidRegistryException(UNISTRING("The key is read only."), THISREF());
OSL_ENSURE(m_xNode.is(), "OConfigurationRegistryKey::createKey : somebody changed the checkValid(KAT_CHILD) behaviour !");
- OUString sKeyName(_rKeyName);
+ rtl::OUString sKeyName(_rKeyName);
if (checkRelativeKeyName(sKeyName))
{
- OUString sParentName, sLocalName;
+ rtl::OUString sParentName, sLocalName;
if (!splitPath(sKeyName,sParentName, sLocalName))
- throw InvalidRegistryException(UNISTRING("The key name is invalid."), THISREF());
+ throw com::sun::star::registry::InvalidRegistryException(UNISTRING("The key name is invalid."), THISREF());
if (sParentName.getLength()) // it's a nested key name
{
// check if we have the key already
- Reference< XHierarchicalNameAccess > xDeepAccess(m_xNode, UNO_QUERY);
+ com::sun::star::uno::Reference< com::sun::star::container::XHierarchicalNameAccess > xDeepAccess(m_xNode, com::sun::star::uno::UNO_QUERY);
if (xDeepAccess.is() && xDeepAccess->hasByHierarchicalName(sKeyName))
{
// already there - just open it
@@ -1232,11 +1217,11 @@ Reference< XRegistryKey > SAL_CALL OConfigurationRegistryKey::createKey( const :
}
// deep access, but not found. delegate it to a registry key which is one level above the to-be-created one
- Reference< XRegistryKey > xSetNode = implGetKey(sParentName);
+ com::sun::star::uno::Reference< com::sun::star::registry::XRegistryKey > xSetNode = implGetKey(sParentName);
if (!xSetNode.is())
{
OSL_ENSURE(sal_False, "OConfigurationRegistryKey::createKey : somebody changed the implGetKey behaviour !");
- throw InvalidRegistryException(UNISTRING("An internal error occured."), THISREF());
+ throw com::sun::star::registry::InvalidRegistryException(UNISTRING("An internal error occured."), THISREF());
}
return xSetNode->createKey(sLocalName); // problem: request for a/['b/c'] might find a/b/c
}
@@ -1251,13 +1236,13 @@ Reference< XRegistryKey > SAL_CALL OConfigurationRegistryKey::createKey( const :
return implGetKey(sKeyName);
}
- Reference< XNameContainer > xContainer(m_xNode, UNO_QUERY);
+ com::sun::star::uno::Reference< com::sun::star::container::XNameContainer > xContainer(m_xNode, com::sun::star::uno::UNO_QUERY);
if (!xContainer.is())
- throw InvalidRegistryException(UNISTRING("The configuration node represented by this key is not a set node, you can't insert keys."), THISREF());
+ throw com::sun::star::registry::InvalidRegistryException(UNISTRING("The configuration node represented by this key is not a set node, you can't insert keys."), THISREF());
- Any aValueToInsert;
+ com::sun::star::uno::Any aValueToInsert;
- Reference< XSingleServiceFactory > xChildFactory(xContainer, UNO_QUERY);
+ com::sun::star::uno::Reference< com::sun::star::lang::XSingleServiceFactory > xChildFactory(xContainer, com::sun::star::uno::UNO_QUERY);
if (xChildFactory.is())
{
// In the configuration API, the creation of a new child is two-stage process : first you create a child which
@@ -1268,24 +1253,24 @@ Reference< XRegistryKey > SAL_CALL OConfigurationRegistryKey::createKey( const :
// create a new floating child for the container node
try
{
- Reference< XInterface > xFloatingChild = xChildFactory->createInstance();
+ com::sun::star::uno::Reference< com::sun::star::uno::XInterface > xFloatingChild = xChildFactory->createInstance();
OSL_ENSURE( xFloatingChild.is(), "The newly created element is NULL !");
- Reference< XNameAccess > xInsertedChild(xFloatingChild, UNO_QUERY);
+ com::sun::star::uno::Reference< com::sun::star::container::XNameAccess > xInsertedChild(xFloatingChild, com::sun::star::uno::UNO_QUERY);
OSL_ENSURE( xInsertedChild.is(), "The newly created element does not provide the required interface");
if (!xInsertedChild.is())
- throw InvalidRegistryException(UNISTRING("An internal error occured. The objects provided by the configuration API are invalid."), THISREF());
+ throw com::sun::star::registry::InvalidRegistryException(UNISTRING("An internal error occured. The objects provided by the configuration API are invalid."), THISREF());
aValueToInsert <<= xInsertedChild; // xFloatingChild;
}
- catch (RuntimeException&)
+ catch (com::sun::star::uno::RuntimeException&)
{ // allowed to leave this method
throw;
}
- catch (Exception& e)
+ catch (com::sun::star::uno::Exception& e)
{ // not allowed to leave this method
- throw InvalidRegistryException(UNISTRING("Unable to create a new child for the configuration node. Original error message as provided by the configuration API : ") += e.Message,
+ throw com::sun::star::registry::InvalidRegistryException(UNISTRING("Unable to create a new child for the configuration node. Original error message as provided by the configuration API : ") += e.Message,
THISREF());
}
OSL_ENSURE(aValueToInsert.hasValue(), "New Child node did not get into the Any ?");
@@ -1293,10 +1278,10 @@ Reference< XRegistryKey > SAL_CALL OConfigurationRegistryKey::createKey( const :
else
{
// If the elements of the set are simple values, we need to create a matching value
- Type aElementType = xContainer->getElementType();
+ com::sun::star::uno::Type aElementType = xContainer->getElementType();
aValueToInsert = implCreateDefaultElement(aElementType);
- OSL_ENSURE(aValueToInsert.hasValue() || aElementType.getTypeClass() == TypeClass_ANY, "Internal error: NULL value created for new value element ?");
+ OSL_ENSURE(aValueToInsert.hasValue() || aElementType.getTypeClass() == com::sun::star::uno::TypeClass_ANY, "Internal error: NULL value created for new value element ?");
}
// and immediately insert it into the container
@@ -1304,31 +1289,31 @@ Reference< XRegistryKey > SAL_CALL OConfigurationRegistryKey::createKey( const :
{
xContainer->insertByName(sKeyName, aValueToInsert);
}
- catch (IllegalArgumentException& e)
+ catch (com::sun::star::lang::IllegalArgumentException& e)
{
- throw InvalidRegistryException(UNISTRING("illegal argument to InsertByName: ") += e.Message, THISREF());
+ throw com::sun::star::registry::InvalidRegistryException(UNISTRING("illegal argument to InsertByName: ") += e.Message, THISREF());
}
- catch (ElementExistException& e)
+ catch (com::sun::star::container::ElementExistException& e)
{
OSL_ENSURE(false, "There was an element of the same name inserted just now");
// try to return that one
try { return implGetKey(sKeyName); }
- catch (Exception&) { OSL_ENSURE(false, "But the other element cannot be retrieved"); }
+ catch (com::sun::star::uno::Exception&) { OSL_ENSURE(false, "But the other element cannot be retrieved"); }
- throw InvalidRegistryException(UNISTRING("Inserting raised a NoSuchElementException for an unavailable element ! Original error message : ") += e.Message, THISREF());
+ throw com::sun::star::registry::InvalidRegistryException(UNISTRING("Inserting raised a NoSuchElementException for an unavailable element ! Original error message : ") += e.Message, THISREF());
}
- catch (WrappedTargetException& e)
+ catch (com::sun::star::lang::WrappedTargetException& e)
{
- throw InvalidRegistryException(UNISTRING("Inserting raised a WrappedTargetException. Original error message : ") += e.Message, THISREF());
+ throw com::sun::star::registry::InvalidRegistryException(UNISTRING("Inserting raised a WrappedTargetException. Original error message : ") += e.Message, THISREF());
}
return new OConfigurationRegistryKey(aValueToInsert, m_xNode, sKeyName, !m_bReadOnly);
}
//--------------------------------------------------------------------------
-void SAL_CALL OConfigurationRegistryKey::closeKey() throw(InvalidRegistryException, RuntimeException)
+void SAL_CALL OConfigurationRegistryKey::closeKey() throw(com::sun::star::registry::InvalidRegistryException, com::sun::star::uno::RuntimeException)
{
OSL_ASSERT(UnoApiLock::isHeld());
checkValid(KAT_META);
@@ -1339,32 +1324,32 @@ void SAL_CALL OConfigurationRegistryKey::closeKey() throw(InvalidRegistryExcepti
{
m_xNode.clear();
m_xParentNode.clear();
-// m_sLocalName = OUString(); - local name is const ...
+// m_sLocalName = rtl::OUString(); - local name is const ...
}
}
//--------------------------------------------------------------------------
-void SAL_CALL OConfigurationRegistryKey::deleteKey( const OUString& _rKeyName ) throw(InvalidRegistryException, RuntimeException)
+void SAL_CALL OConfigurationRegistryKey::deleteKey( const rtl::OUString& _rKeyName ) throw(com::sun::star::registry::InvalidRegistryException, com::sun::star::uno::RuntimeException)
{
checkValid(KAT_CHILD);
if (m_bReadOnly)
- throw InvalidRegistryException(UNISTRING("The key is read only."), THISREF());
+ throw com::sun::star::registry::InvalidRegistryException(UNISTRING("The key is read only."), THISREF());
- OUString sKeyName(_rKeyName);
+ rtl::OUString sKeyName(_rKeyName);
if (checkRelativeKeyName(sKeyName))
{
- OUString sParentName, sLocalName;
+ rtl::OUString sParentName, sLocalName;
if (!splitPath(sKeyName,sParentName, sLocalName))
- throw InvalidRegistryException(UNISTRING("The key name is invalid."), THISREF());
+ throw com::sun::star::registry::InvalidRegistryException(UNISTRING("The key name is invalid."), THISREF());
if (sParentName.getLength()) // it's a nested key name
{
- Reference< XRegistryKey > xSetNode = implGetKey(sParentName);
+ com::sun::star::uno::Reference< com::sun::star::registry::XRegistryKey > xSetNode = implGetKey(sParentName);
if (!xSetNode.is())
{
OSL_ENSURE(sal_False, "OConfigurationRegistryKey::createKey : somebody changed the implGetKey behaviour !");
- throw InvalidRegistryException(UNISTRING("An internal error occured."), THISREF());
+ throw com::sun::star::registry::InvalidRegistryException(UNISTRING("An internal error occured."), THISREF());
}
xSetNode->deleteKey(sLocalName);
return;
@@ -1374,38 +1359,38 @@ void SAL_CALL OConfigurationRegistryKey::deleteKey( const OUString& _rKeyName )
}
// The requested new key is one level below ourself. Can't delegate the creation.
- Reference< XNameContainer > xContainer(m_xNode, UNO_QUERY);
+ com::sun::star::uno::Reference< com::sun::star::container::XNameContainer > xContainer(m_xNode, com::sun::star::uno::UNO_QUERY);
if (!xContainer.is())
- throw InvalidRegistryException(UNISTRING("The configuration node represented by this key is not a set node, you can't remove keys."), THISREF());
+ throw com::sun::star::registry::InvalidRegistryException(UNISTRING("The configuration node represented by this key is not a set node, you can't remove keys."), THISREF());
// and immediately remove it from the container
try
{
xContainer->removeByName(sKeyName);
}
- catch (NoSuchElementException& e)
+ catch (com::sun::star::container::NoSuchElementException& e)
{
if (e.Message.getLength())
- throw InvalidRegistryException(e.Message, THISREF());
+ throw com::sun::star::registry::InvalidRegistryException(e.Message, THISREF());
else
- throw InvalidRegistryException((UNISTRING("There is no element named ") += sKeyName) += UNISTRING(" to remove."), THISREF());
+ throw com::sun::star::registry::InvalidRegistryException((UNISTRING("There is no element named ") += sKeyName) += UNISTRING(" to remove."), THISREF());
}
- catch (WrappedTargetException& e)
+ catch (com::sun::star::lang::WrappedTargetException& e)
{
- throw InvalidRegistryException(UNISTRING("Removing a node caused a WrappedTargetException. Original error message : ") += e.Message, THISREF());
+ throw com::sun::star::registry::InvalidRegistryException(UNISTRING("Removing a node caused a WrappedTargetException. Original error message : ") += e.Message, THISREF());
}
}
//--------------------------------------------------------------------------
-Sequence< Reference< XRegistryKey > > SAL_CALL OConfigurationRegistryKey::openKeys() throw(InvalidRegistryException, RuntimeException)
+com::sun::star::uno::Sequence< com::sun::star::uno::Reference< com::sun::star::registry::XRegistryKey > > SAL_CALL OConfigurationRegistryKey::openKeys() throw(com::sun::star::registry::InvalidRegistryException, com::sun::star::uno::RuntimeException)
{
checkValid(KAT_CHILD);
- Sequence< ::rtl::OUString > aNames(m_xNode->getElementNames());
+ com::sun::star::uno::Sequence< ::rtl::OUString > aNames(m_xNode->getElementNames());
sal_Int32 const nCount = aNames.getLength();
- Sequence< Reference< XRegistryKey > > aReturn(nCount);
+ com::sun::star::uno::Sequence< com::sun::star::uno::Reference< com::sun::star::registry::XRegistryKey > > aReturn(nCount);
for (sal_Int32 i=0; i<nCount; ++i)
aReturn[i] = implGetKey(aNames[i]);
@@ -1414,34 +1399,34 @@ Sequence< Reference< XRegistryKey > > SAL_CALL OConfigurationRegistryKey::openKe
}
//--------------------------------------------------------------------------
-Sequence< ::rtl::OUString > SAL_CALL OConfigurationRegistryKey::getKeyNames() throw(InvalidRegistryException, RuntimeException)
+com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL OConfigurationRegistryKey::getKeyNames() throw(com::sun::star::registry::InvalidRegistryException, com::sun::star::uno::RuntimeException)
{
checkValid(KAT_CHILD);
return m_xNode->getElementNames();
}
//--------------------------------------------------------------------------
-sal_Bool SAL_CALL OConfigurationRegistryKey::createLink( const ::rtl::OUString& /*aLinkName*/, const ::rtl::OUString& /*aLinkTarget*/ ) throw(InvalidRegistryException, RuntimeException)
+sal_Bool SAL_CALL OConfigurationRegistryKey::createLink( const ::rtl::OUString& /*aLinkName*/, const ::rtl::OUString& /*aLinkTarget*/ ) throw(com::sun::star::registry::InvalidRegistryException, com::sun::star::uno::RuntimeException)
{
- throw InvalidRegistryException(UNISTRING("This registry, which is base on a configuration tree, does not support links."), THISREF());
+ throw com::sun::star::registry::InvalidRegistryException(UNISTRING("This registry, which is base on a configuration tree, does not support links."), THISREF());
}
//--------------------------------------------------------------------------
-void SAL_CALL OConfigurationRegistryKey::deleteLink( const ::rtl::OUString& /*rLinkName*/ ) throw(InvalidRegistryException, RuntimeException)
+void SAL_CALL OConfigurationRegistryKey::deleteLink( const ::rtl::OUString& /*rLinkName*/ ) throw(com::sun::star::registry::InvalidRegistryException, com::sun::star::uno::RuntimeException)
{
- throw InvalidRegistryException(UNISTRING("This registry, which is base on a configuration tree, does not support links."), THISREF());
+ throw com::sun::star::registry::InvalidRegistryException(UNISTRING("This registry, which is base on a configuration tree, does not support links."), THISREF());
}
//--------------------------------------------------------------------------
-::rtl::OUString SAL_CALL OConfigurationRegistryKey::getLinkTarget( const ::rtl::OUString& /*rLinkName*/ ) throw(InvalidRegistryException, RuntimeException)
+::rtl::OUString SAL_CALL OConfigurationRegistryKey::getLinkTarget( const ::rtl::OUString& /*rLinkName*/ ) throw(com::sun::star::registry::InvalidRegistryException, com::sun::star::uno::RuntimeException)
{
- throw InvalidRegistryException(UNISTRING("This registry, which is base on a configuration tree, does not support links."), THISREF());
+ throw com::sun::star::registry::InvalidRegistryException(UNISTRING("This registry, which is base on a configuration tree, does not support links."), THISREF());
}
//--------------------------------------------------------------------------
-::rtl::OUString SAL_CALL OConfigurationRegistryKey::getResolvedName( const ::rtl::OUString& /*aKeyName*/ ) throw(InvalidRegistryException, RuntimeException)
+::rtl::OUString SAL_CALL OConfigurationRegistryKey::getResolvedName( const ::rtl::OUString& /*aKeyName*/ ) throw(com::sun::star::registry::InvalidRegistryException, com::sun::star::uno::RuntimeException)
{
- throw InvalidRegistryException(UNISTRING("This registry, which is base on a configuration tree, does not support links."), THISREF());
+ throw com::sun::star::registry::InvalidRegistryException(UNISTRING("This registry, which is base on a configuration tree, does not support links."), THISREF());
}
//--------------------------------------------------------------------------
//..........................................................................
@@ -1451,39 +1436,37 @@ void SAL_CALL OConfigurationRegistryKey::deleteLink( const ::rtl::OUString& /*rL
#include "configpath.hxx"
#include "configexcept.hxx"
-bool configmgr::splitPath(const OUString& _sPath, OUString& _rsParentPath, OUString& _rsLocalName)
+bool configmgr::splitPath(const rtl::OUString& _sPath, rtl::OUString& _rsParentPath, rtl::OUString& _rsLocalName)
{
- using namespace ::configmgr::configuration;
-
bool bResult = false;
try
{
- bool bAbsolute = Path::isAbsolutePath(_sPath);
- Path::Rep aPath ;
+ bool bAbsolute = configmgr::configuration::Path::isAbsolutePath(_sPath);
+ configmgr::configuration::Path::Rep aPath ;
if (bAbsolute)
{
- AbsolutePath parsedPath = AbsolutePath::parse(_sPath) ;
+ configmgr::configuration::AbsolutePath parsedPath = configmgr::configuration::AbsolutePath::parse(_sPath) ;
aPath = parsedPath.rep() ;
}
else
{
- RelativePath parsedPath = RelativePath::parse(_sPath) ;
+ configmgr::configuration::RelativePath parsedPath = configmgr::configuration::RelativePath::parse(_sPath) ;
aPath = parsedPath.rep() ;
}
- //Path::Rep aPath = bAbsolute ? AbsolutePath::parse(_sPath).rep() : RelativePath::parse(_sPath).rep();
+ //configmgr::configuration::Path::Rep aPath = bAbsolute ? configmgr::configuration::AbsolutePath::parse(_sPath).rep() : configmgr::configuration::RelativePath::parse(_sPath).rep();
OSL_ENSURE(!aPath.isEmpty(), "Trying to split an empty or root path");
- Path::Iterator aFirst = aPath.begin(), aLast = aPath.end();
+ std::vector<configuration::Path::Component>::const_reverse_iterator aFirst = aPath.begin(), aLast = aPath.end();
if (aFirst != aLast)
{
--aLast;
- _rsLocalName = aLast->getName().toString();
- _rsParentPath = Path::Rep(aFirst,aLast).toString(bAbsolute);
+ _rsLocalName = aLast->getName();
+ _rsParentPath = configmgr::configuration::Path::Rep(aFirst,aLast).toString(bAbsolute);
bResult = true;
}
diff --git a/configmgr/source/registry/cfgregistrykey.hxx b/configmgr/source/registry/cfgregistrykey.hxx
index 19e1b70626..52c7d0a4be 100644
--- a/configmgr/source/registry/cfgregistrykey.hxx
+++ b/configmgr/source/registry/cfgregistrykey.hxx
@@ -45,13 +45,10 @@ namespace configmgr
//==========================================================================
//= OConfigurationRegistryKey
//==========================================================================
-typedef ::cppu::WeakImplHelper1 < ::com::sun::star::registry::XRegistryKey
- > OConfigurationRegistryKey_Base;
-
/** wraps the registry-like access to a single node of a configuration sub tree
*/
class OConfigurationRegistryKey
- :public OConfigurationRegistryKey_Base
+ :public cppu::WeakImplHelper1< com::sun::star::registry::XRegistryKey >
{
sal_Bool m_bReadOnly; /// is the key readonly ?
diff --git a/configmgr/source/registry/configregistry.cxx b/configmgr/source/registry/configregistry.cxx
index 7dbb3f7dc2..636d1fd9db 100644
--- a/configmgr/source/registry/configregistry.cxx
+++ b/configmgr/source/registry/configregistry.cxx
@@ -34,9 +34,8 @@
#include "configregistry.hxx"
#include "cfgregistrykey.hxx"
-#ifndef CONFIGMGR_API_FACTORY_HXX_
#include "confapifactory.hxx"
-#endif
+#include "datalock.hxx"
#include "utility.hxx"
#include <comphelper/sequence.hxx>
#include <cppuhelper/typeprovider.hxx>
@@ -56,15 +55,6 @@ namespace configmgr
{
//..........................................................................
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::lang;
-using namespace ::com::sun::star::util;
-using namespace ::com::sun::star::registry;
-using namespace ::com::sun::star::container;
-using namespace ::osl;
-using namespace ::cppu;
-using ::rtl::OUString;
-
namespace beans = ::com::sun::star::beans;
//==========================================================================
@@ -72,25 +62,25 @@ namespace beans = ::com::sun::star::beans;
//==========================================================================
inline
static
- OUString makeUniString(char const* c)
+ rtl::OUString makeUniString(char const* c)
{
- return OUString::createFromAscii(c);
+ return rtl::OUString::createFromAscii(c);
}
// #99130# Don't export SimpleRegistry service
- static const AsciiServiceName aExportedConfigRegistryServices[] =
+ static sal_Char const * const aExportedConfigRegistryServices[] =
{
"com.sun.star.configuration.ConfigurationRegistry",
NULL
};
- static const AsciiServiceName aAdditionalConfigRegistryServices[] =
+ static sal_Char const * const aAdditionalConfigRegistryServices[] =
{
"com.sun.star.registry.SimpleRegistry",
NULL
};
- const AsciiServiceName aConfigRegistryImplementationName = "com.sun.star.comp.configuration.OConfigurationRegistry";
+ sal_Char const * const aConfigRegistryImplementationName = "com.sun.star.comp.configuration.OConfigurationRegistry";
const ServiceImplementationInfo OConfigurationRegistry::s_aServiceInfo =
{
@@ -99,10 +89,10 @@ namespace beans = ::com::sun::star::beans;
aAdditionalConfigRegistryServices
};
- Reference< XInterface > SAL_CALL instantiateConfigRegistry(CreationContext const& xContext )
+ com::sun::star::uno::Reference< com::sun::star::uno::XInterface > SAL_CALL instantiateConfigRegistry(uno::Reference< uno::XComponentContext > const& xContext )
{
OSL_ASSERT( xContext.is() );
- Reference< XMultiServiceFactory > xServiceManager( xContext->getServiceManager(), UNO_QUERY );
+ com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > xServiceManager( xContext->getServiceManager(), com::sun::star::uno::UNO_QUERY );
::cppu::OWeakObject * pNewInstance = new OConfigurationRegistry(xServiceManager);
return pNewInstance;
}
@@ -113,7 +103,7 @@ namespace beans = ::com::sun::star::beans;
}
//--------------------------------------------------------------------------
-OConfigurationRegistry::OConfigurationRegistry(const Reference< XMultiServiceFactory >& _rORB) throw(Exception, RuntimeException)
+OConfigurationRegistry::OConfigurationRegistry(const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& _rORB) throw(com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException)
:ServiceComponentImpl(&s_aServiceInfo)
,m_xORB(_rORB)
{
@@ -130,32 +120,32 @@ OConfigurationRegistry::OConfigurationRegistry(const Reference< XMultiServiceFac
if (!m_xConfigurationProvider.is())
{
// it's heavily needed ...
- throw ServiceNotRegisteredException(UNISTRING("Failed to instantiate the mandatory service com.sun.star.configuration.ConfigurationProvider."),
+ throw com::sun::star::lang::ServiceNotRegisteredException(UNISTRING("Failed to instantiate the mandatory service com.sun.star.configuration.ConfigurationProvider."),
THISREF());
}
}
//--------------------------------------------------------------------------
-Any SAL_CALL OConfigurationRegistry::queryInterface( const Type& _rType ) throw(RuntimeException)
+com::sun::star::uno::Any SAL_CALL OConfigurationRegistry::queryInterface( const com::sun::star::uno::Type& _rType ) throw(com::sun::star::uno::RuntimeException)
{
- Any aReturn = ServiceComponentImpl::queryInterface(_rType);
+ com::sun::star::uno::Any aReturn = ServiceComponentImpl::queryInterface(_rType);
if (!aReturn.hasValue())
- aReturn = OConfigurationRegistry_Base::queryInterface(_rType);
+ aReturn = cppu::ImplHelper2< com::sun::star::registry::XSimpleRegistry, com::sun::star::util::XFlushable >::queryInterface(_rType);
return aReturn;
}
//--------------------------------------------------------------------------
-Sequence< Type > SAL_CALL OConfigurationRegistry::getTypes( ) throw(RuntimeException)
+com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL OConfigurationRegistry::getTypes( ) throw(com::sun::star::uno::RuntimeException)
{
return ::comphelper::concatSequences(
ServiceComponentImpl::getTypes(),
- OConfigurationRegistry_Base::getTypes());
+ cppu::ImplHelper2< com::sun::star::registry::XSimpleRegistry, com::sun::star::util::XFlushable >::getTypes());
}
//--------------------------------------------------------------------------
-Sequence< sal_Int8 > SAL_CALL OConfigurationRegistry::getImplementationId( ) throw(RuntimeException)
+com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL OConfigurationRegistry::getImplementationId( ) throw(com::sun::star::uno::RuntimeException)
{
- static OImplementationId aId;
+ static cppu::OImplementationId aId;
return aId.getImplementationId();
}
@@ -167,7 +157,7 @@ Sequence< sal_Int8 > SAL_CALL OConfigurationRegistry::getImplementationId( ) th
}
//--------------------------------------------------------------------------
-::rtl::OUString SAL_CALL OConfigurationRegistry::getURL() throw(RuntimeException)
+::rtl::OUString SAL_CALL OConfigurationRegistry::getURL() throw(com::sun::star::uno::RuntimeException)
{
UnoApiLock aLock;
return m_sLocation;
@@ -176,14 +166,14 @@ Sequence< sal_Int8 > SAL_CALL OConfigurationRegistry::getImplementationId( ) th
//--------------------------------------------------------------------------
// Not guarded !
-void OConfigurationRegistry::implCheckOpen() throw(InvalidRegistryException, RuntimeException)
+void OConfigurationRegistry::implCheckOpen() throw(com::sun::star::registry::InvalidRegistryException, com::sun::star::uno::RuntimeException)
{
if (!implIsOpen())
- throw InvalidRegistryException(UNISTRING("The registry is not bound to a configuration node."), THISREF());
+ throw com::sun::star::registry::InvalidRegistryException(UNISTRING("The registry is not bound to a configuration node."), THISREF());
}
//--------------------------------------------------------------------------
-void SAL_CALL OConfigurationRegistry::open( const ::rtl::OUString& _rURL, sal_Bool _bReadOnly, sal_Bool /*_bCreate*/ ) throw(InvalidRegistryException, RuntimeException)
+void SAL_CALL OConfigurationRegistry::open( const ::rtl::OUString& _rURL, sal_Bool _bReadOnly, sal_Bool /*_bCreate*/ ) throw(com::sun::star::registry::InvalidRegistryException, com::sun::star::uno::RuntimeException)
{
UnoApiLock aLock;
@@ -193,9 +183,9 @@ void SAL_CALL OConfigurationRegistry::open( const ::rtl::OUString& _rURL, sal_Bo
::rtl::OUString sNodePath = getNodePathFromURL(_rURL);
if (!m_xConfigurationProvider.is())
- throw DisposedException(UNISTRING("invalid object. configuration provider is already disposed."), THISREF());
+ throw com::sun::star::lang::DisposedException(UNISTRING("invalid object. configuration provider is already disposed."), THISREF());
- Reference< XInterface > xNodeAccess;
+ com::sun::star::uno::Reference< com::sun::star::uno::XInterface > xNodeAccess;
try
{
char const * const sAccessType = _bReadOnly ?
@@ -207,9 +197,8 @@ void SAL_CALL OConfigurationRegistry::open( const ::rtl::OUString& _rURL, sal_Bo
aArgValue.Handle = -1;
// currently theres is one parameter: the node path
- Sequence< Any > aArguments(1);
+ com::sun::star::uno::Sequence< com::sun::star::uno::Any > aArguments(1);
- // Argumenbt: NodePath
aArgValue.Name = UNISTRING("nodepath");
aArgValue.Value <<= sNodePath;
@@ -218,51 +207,51 @@ void SAL_CALL OConfigurationRegistry::open( const ::rtl::OUString& _rURL, sal_Bo
xNodeAccess = m_xConfigurationProvider->createInstanceWithArguments(UNISTRING(sAccessType), aArguments);
}
- catch (RuntimeException&)
+ catch (com::sun::star::uno::RuntimeException&)
{ // allowed to leave this method
throw;
}
- catch (Exception& e)
+ catch (com::sun::star::uno::Exception& e)
{ // not allowed to leave this method
::rtl::OUString sMessage = UNISTRING("The configuration provider does not supply a registry access for the requested Node.");
sMessage += UNISTRING(" original error message of the provider : ");
sMessage += e.Message;
- throw InvalidRegistryException(sMessage, THISREF());
+ throw com::sun::star::registry::InvalidRegistryException(sMessage, THISREF());
}
- Reference< XNameAccess > xReadRoot(xNodeAccess, UNO_QUERY);
+ com::sun::star::uno::Reference< com::sun::star::container::XNameAccess > xReadRoot(xNodeAccess, com::sun::star::uno::UNO_QUERY);
if (!_bReadOnly)
m_xUpdateRoot = m_xUpdateRoot.query(xReadRoot);
if (!xReadRoot.is() || (!_bReadOnly && !m_xUpdateRoot.is()))
- throw InvalidRegistryException(UNISTRING("The object supplied the by configuration provider is invalid."), THISREF());
+ throw com::sun::star::registry::InvalidRegistryException(UNISTRING("The object supplied the by configuration provider is invalid."), THISREF());
m_xRootKey = new OConfigurationRegistryKey(xReadRoot, !_bReadOnly, OConfigurationRegistryKey::SubtreeRoot());
m_xSubtreeRoot = xNodeAccess;
}
//--------------------------------------------------------------------------
-sal_Bool SAL_CALL OConfigurationRegistry::isValid( ) throw(RuntimeException)
+sal_Bool SAL_CALL OConfigurationRegistry::isValid( ) throw(com::sun::star::uno::RuntimeException)
{
UnoApiLock aLock;
return implIsOpen();
}
//--------------------------------------------------------------------------
-sal_Bool OConfigurationRegistry::implIsOpen( ) throw(RuntimeException)
+sal_Bool OConfigurationRegistry::implIsOpen( ) throw(com::sun::star::uno::RuntimeException)
{
return m_xRootKey.is();
}
//--------------------------------------------------------------------------
-void SAL_CALL OConfigurationRegistry::close( ) throw(InvalidRegistryException, RuntimeException)
+void SAL_CALL OConfigurationRegistry::close( ) throw(com::sun::star::registry::InvalidRegistryException, com::sun::star::uno::RuntimeException)
{
UnoApiLock aLock;
- Reference< XRegistryKey > xRootKey(m_xRootKey);
+ com::sun::star::uno::Reference< com::sun::star::registry::XRegistryKey > xRootKey(m_xRootKey);
m_xRootKey = NULL;
- Reference< XComponent > xRootComponent(m_xSubtreeRoot, UNO_QUERY);
+ com::sun::star::uno::Reference< XComponent > xRootComponent(m_xSubtreeRoot, com::sun::star::uno::UNO_QUERY);
m_xSubtreeRoot = NULL;
m_xUpdateRoot = NULL;
@@ -291,16 +280,16 @@ void SAL_CALL OConfigurationRegistry::disposing()
}
//--------------------------------------------------------------------------
-void SAL_CALL OConfigurationRegistry::destroy( ) throw(InvalidRegistryException, RuntimeException)
+void SAL_CALL OConfigurationRegistry::destroy( ) throw(com::sun::star::registry::InvalidRegistryException, com::sun::star::uno::RuntimeException)
{
UnoApiLock aLock;
implCheckOpen();
- throw InvalidRegistryException(UNISTRING("This registry is a wrapper for a configuration access. It can not be destroyed."), THISREF());
+ throw com::sun::star::registry::InvalidRegistryException(UNISTRING("This registry is a wrapper for a configuration access. It can not be destroyed."), THISREF());
}
//--------------------------------------------------------------------------
-Reference< XRegistryKey > SAL_CALL OConfigurationRegistry::getRootKey( ) throw(InvalidRegistryException, RuntimeException)
+com::sun::star::uno::Reference< com::sun::star::registry::XRegistryKey > SAL_CALL OConfigurationRegistry::getRootKey( ) throw(com::sun::star::registry::InvalidRegistryException, com::sun::star::uno::RuntimeException)
{
UnoApiLock aLock;
implCheckOpen();
@@ -309,7 +298,7 @@ Reference< XRegistryKey > SAL_CALL OConfigurationRegistry::getRootKey( ) throw(
}
//--------------------------------------------------------------------------
-sal_Bool SAL_CALL OConfigurationRegistry::isReadOnly( ) throw(InvalidRegistryException, RuntimeException)
+sal_Bool SAL_CALL OConfigurationRegistry::isReadOnly( ) throw(com::sun::star::registry::InvalidRegistryException, com::sun::star::uno::RuntimeException)
{
UnoApiLock aLock;
implCheckOpen();
@@ -319,17 +308,17 @@ sal_Bool SAL_CALL OConfigurationRegistry::isReadOnly( ) throw(InvalidRegistryEx
}
//--------------------------------------------------------------------------
-void SAL_CALL OConfigurationRegistry::mergeKey( const ::rtl::OUString& /*aKeyName*/, const ::rtl::OUString& /*aUrl*/ ) throw(InvalidRegistryException, MergeConflictException, RuntimeException)
+void SAL_CALL OConfigurationRegistry::mergeKey( const ::rtl::OUString& /*aKeyName*/, const ::rtl::OUString& /*aUrl*/ ) throw(com::sun::star::registry::InvalidRegistryException, com::sun::star::registry::MergeConflictException, com::sun::star::uno::RuntimeException)
{
UnoApiLock aLock;
implCheckOpen();
// not supported. but we can't throw an NoSupportException here ...
- throw InvalidRegistryException(UNISTRING("You can't merge into this registry. It's just a wrapper for a configuration node, which has a fixed structure which can not be modified"), THISREF());
+ throw com::sun::star::registry::InvalidRegistryException(UNISTRING("You can't merge into this registry. It's just a wrapper for a configuration node, which has a fixed structure which can not be modified"), THISREF());
}
//--------------------------------------------------------------------------
-void SAL_CALL OConfigurationRegistry::flush( ) throw(RuntimeException)
+void SAL_CALL OConfigurationRegistry::flush( ) throw(com::sun::star::uno::RuntimeException)
{
{
UnoApiLock aLock;
@@ -339,7 +328,7 @@ void SAL_CALL OConfigurationRegistry::flush( ) throw(RuntimeException)
{
m_xUpdateRoot->commitChanges();
}
- catch (WrappedTargetException& e)
+ catch (com::sun::star::lang::WrappedTargetException& e)
{ // not allowed to leave this method
::rtl::OUString sMessage;
@@ -350,21 +339,21 @@ void SAL_CALL OConfigurationRegistry::flush( ) throw(RuntimeException)
OSL_ENSURE(sal_False, "OConfigurationRegistry::flush : caught an exception, could not flush the data !");
// return;
- throw WrappedTargetRuntimeException(sMessage, THISREF(), e.TargetException);
+ throw com::sun::star::lang::WrappedTargetRuntimeException(sMessage, THISREF(), e.TargetException);
}
}
}
- Reference< XFlushListener > const * const pSelector = 0;
- if (OInterfaceContainerHelper* pContainer = this->rBHelper.getContainer(::getCppuType(pSelector)) )
+ com::sun::star::uno::Reference< com::sun::star::util::XFlushListener > const * const pSelector = 0;
+ if (cppu::OInterfaceContainerHelper* pContainer = this->rBHelper.getContainer(::getCppuType(pSelector)) )
{
::cppu::OInterfaceIteratorHelper aIter( *pContainer );
- EventObject aFlushed(THISREF());
+ com::sun::star::lang::EventObject aFlushed(THISREF());
while (aIter.hasMoreElements())
try
{
- static_cast< XFlushListener* >(aIter.next())->flushed(aFlushed);
+ static_cast< com::sun::star::util::XFlushListener* >(aIter.next())->flushed(aFlushed);
}
catch (uno::Exception & )
{}
@@ -372,13 +361,13 @@ void SAL_CALL OConfigurationRegistry::flush( ) throw(RuntimeException)
}
//--------------------------------------------------------------------------
-void SAL_CALL OConfigurationRegistry::addFlushListener( const Reference< XFlushListener >& _rxListener ) throw(RuntimeException)
+void SAL_CALL OConfigurationRegistry::addFlushListener( const com::sun::star::uno::Reference< com::sun::star::util::XFlushListener >& _rxListener ) throw(com::sun::star::uno::RuntimeException)
{
this->rBHelper.addListener(::getCppuType(&_rxListener),_rxListener);
}
//--------------------------------------------------------------------------
-void SAL_CALL OConfigurationRegistry::removeFlushListener( const Reference< XFlushListener >& _rxListener ) throw(RuntimeException)
+void SAL_CALL OConfigurationRegistry::removeFlushListener( const com::sun::star::uno::Reference< com::sun::star::util::XFlushListener >& _rxListener ) throw(com::sun::star::uno::RuntimeException)
{
this->rBHelper.removeListener(::getCppuType(&_rxListener),_rxListener);
}
diff --git a/configmgr/source/registry/configregistry.hxx b/configmgr/source/registry/configregistry.hxx
index a02e04f4b2..a682c30787 100644
--- a/configmgr/source/registry/configregistry.hxx
+++ b/configmgr/source/registry/configregistry.hxx
@@ -46,16 +46,12 @@ namespace configmgr
//==========================================================================
//= OConfigurationRegistry
//==========================================================================
-typedef ::cppu::ImplHelper2 < ::com::sun::star::registry::XSimpleRegistry
- , ::com::sun::star::util::XFlushable
- > OConfigurationRegistry_Base;
-
/** an object implmenting the <service scope="com.sun.star.configuration">ConfigurationRegistry</service>
service.
*/
class OConfigurationRegistry
:public ServiceComponentImpl
- ,public OConfigurationRegistry_Base
+ ,public cppu::ImplHelper2< com::sun::star::registry::XSimpleRegistry, com::sun::star::util::XFlushable >
{
public:
static const ServiceImplementationInfo s_aServiceInfo;
diff --git a/configmgr/source/tree/builddata.cxx b/configmgr/source/tree/builddata.cxx
index 637095fc76..46c8ac3883 100644
--- a/configmgr/source/tree/builddata.cxx
+++ b/configmgr/source/tree/builddata.cxx
@@ -31,17 +31,15 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_configmgr.hxx"
+#include "sal/types.h"
+
#include "builddata.hxx"
-#include "treeaccessor.hxx"
-#include "nodeaccess.hxx"
-#include "setnodeaccess.hxx"
-#include "valuenodeaccess.hxx"
-#include "groupnodeaccess.hxx"
#include "nodevisitor.hxx"
#include "node.hxx"
#include "treefragment.hxx"
#include "valuenode.hxx"
#include "treenodefactory.hxx"
+#include "utility.hxx"
#ifndef INCLUDED_CSTDDEF
#include <cstddef>
@@ -51,30 +49,27 @@
#include <algorithm>
#define INCLUDED_ALGORITHM
#endif
+#include <vector>
namespace configmgr
{
//-----------------------------------------------------------------------------
- typedef ValueNode OValueNode; // to avoid ambiguity with sharable::ValueNode
-//-----------------------------------------------------------------------------
namespace data
{
- //-------------------------------------------------------------------------
- using namespace sharable;
//-----------------------------------------------------------------------------
static
inline
- NodeAddress offsetNodeBy(NodeAddress _aNode, Offset _nOffset)
+ sharable::Node * offsetNodeBy(sharable::Node * _aNode, sal_uInt16 _nOffset)
{
sharable::Node *pNode = _aNode;
pNode += _nOffset;
- return NodeAddress(pNode);
+ return (sharable::Node *)(pNode);
}
static
inline
- NodeAddress addressOfNodeAt(TreeAddress _aTree, Offset _nOffset)
+ sharable::Node * addressOfNodeAt(sharable::TreeFragment * _aTree, sal_uInt16 _nOffset)
{
sharable::TreeFragment *pRaw = _aTree;
return &pRaw->nodes[_nOffset];
@@ -84,75 +79,72 @@ namespace configmgr
class TreeNodeBuilder
{
- TreeFragmentHeader m_header;
- std::vector< Node > m_nodes;
- Offset m_parent;
+ sharable::TreeFragmentHeader m_header;
+ std::vector< sharable::Node > m_nodes;
+ sal_uInt16 m_parent;
public:
TreeNodeBuilder() : m_header(), m_nodes(), m_parent() {}
- TreeFragmentHeader & header() { return m_header; }
+ sharable::TreeFragmentHeader & header() { return m_header; }
- Node & nodeAt(Offset _pos) { checkOffset(_pos); return m_nodes[_pos]; }
- NodeInfo & nodeInfoAt(Offset _pos) { checkOffset(_pos); return m_nodes[_pos].node.info; }
+ sharable::Node & nodeAt(sal_uInt16 _pos) { checkOffset(_pos); return m_nodes[_pos]; }
+ sharable::NodeInfo & nodeInfoAt(sal_uInt16 _pos) { checkOffset(_pos); return m_nodes[_pos].info; }
- Node & lastNode() { checkOffset(0); return m_nodes.back(); }
- NodeInfo & lastNodeInfo() { checkOffset(0); return m_nodes.back().node.info; }
+ sharable::Node & lastNode() { checkOffset(0); return m_nodes.back(); }
+ sharable::NodeInfo & lastNodeInfo() { checkOffset(0); return m_nodes.back().info; }
- void resetTreeFragment(sharable::String _treeName, State::Field _state);
+ void resetTreeFragment(rtl_uString * _treeName, sal_uInt8 _state);
- TreeAddress createTreeFragment();
+ sharable::TreeFragment * createTreeFragment();
- Offset startGroup( Name _aName, Flags::Field _aFlags );
- void endGroup( Offset _nPos );
+ sal_uInt16 startGroup( rtl_uString * _aName, sal_uInt8 _aFlags );
+ void endGroup( sal_uInt16 _nPos );
- void addSet( Name _aName, Flags::Field _aFlags, SetElementAddress _aElementType );
+ void addSet( rtl_uString * _aName, sal_uInt8 _aFlags, sal_uInt8 * _aElementType );
- void addValue( Name _aName, Flags::Field _aFlags,
- AnyData::TypeCode _aValueType,
- AnyData _aUserValue,
- AnyData _aDefaultName );
+ void addValue( rtl_uString * _aName, sal_uInt8 _aFlags,
+ sal_uInt8 _aValueType,
+ sharable::AnyData _aUserValue,
+ sharable::AnyData _aDefaultName );
public:
class CollectSetElements;
class LinkSetNodes;
private:
- TreeAddress allocTreeFragment();
- void linkTreeFragment(TreeAddress _aTreeAddr);
+ sharable::TreeFragment * allocTreeFragment();
+ void linkTreeFragment(sharable::TreeFragment * _aTreeAddr);
- Offset addNode(Name _aName, Flags::Field _aFlags, Type::Field _aType);
- void checkOffset(Offset _pos);
+ sal_uInt16 addNode(rtl_uString * _aName, sal_uInt8 _aFlags, sal_uInt8 _aType);
+ void checkOffset(sal_uInt16 _pos);
};
//-----------------------------------------------------------------------------
class TreeNodeBuilder::CollectSetElements
{
- TreeAddress m_head;
+ sharable::TreeFragment * m_head;
public:
explicit
CollectSetElements() : m_head(NULL) {}
void resetElementList();
- void addElement(TreeAddress _aNewElement);
- List getElementListAndClear();
+ void addElement(sharable::TreeFragment * _aNewElement);
+ sharable::TreeFragment * getElementListAndClear();
};
//-----------------------------------------------------------------------------
- class TreeNodeBuilder::LinkSetNodes : private SetVisitor
- {
- NodeAddress m_aParentAddr;
+ class TreeNodeBuilder::LinkSetNodes: private SetVisitor {
+ sharable::Node * m_parent;
public:
- explicit
- LinkSetNodes() : m_aParentAddr(NULL) {}
-
- Result linkTree(TreeAddress const & _aFragment);
- Result linkSet(SetNodeAccess const & _aSet);
+ LinkSetNodes(): m_parent(0) {}
- protected:
- using NodeVisitor::handle;
+ void linkTree(sharable::TreeFragment * tree);
private:
- Result handle(TreeAccessor const & _aElement);
- Result handle(SetNodeAccess const & _aSet);
+ using SetVisitor::handle;
+
+ virtual bool handle(sharable::SetNode * node);
+
+ virtual bool handle(sharable::TreeFragment * tree);
};
//-----------------------------------------------------------------------------
@@ -162,7 +154,7 @@ namespace configmgr
explicit
BasicDataTreeBuilder() {}
- TreeAddress createTree() { return m_builder.createTreeFragment(); }
+ sharable::TreeFragment * createTree() { return m_builder.createTreeFragment(); }
protected:
TreeNodeBuilder& builder() { return m_builder; }
@@ -179,19 +171,19 @@ namespace configmgr
explicit
ConvertingDataTreeBuilder() : BasicDataTreeBuilder() {}
- TreeAddress buildTree(OUString const & _aTreeName, INode const& _aNode, bool _bWithDefault);
- TreeAddress buildElement(INode const& _aNode, OUString const & _aTypeName, bool _bWithDefault);
+ sharable::TreeFragment * buildTree(rtl::OUString const & _aTreeName, INode const& _aNode, bool _bWithDefault);
+ sharable::TreeFragment * buildElement(INode const& _aNode, rtl::OUString const & _aTypeName, bool _bWithDefault);
private:
class ElementListBuilder;
virtual void handle(ISubtree const & _aNode);
- virtual void handle(OValueNode const & _aNode);
+ virtual void handle(ValueNode const & _aNode);
- SetElementAddress makeTemplateData(rtl::OUString const & _aTemplateName, rtl::OUString const & _aTemplateModule);
+ sal_uInt8 * makeTemplateData(rtl::OUString const & _aTemplateName, rtl::OUString const & _aTemplateModule);
- Name allocName(INode const & _aNode);
- State::Field makeState(node::Attributes const & _aAttributes);
- Flags::Field makeFlags(node::Attributes const & _aAttributes);
+ rtl_uString * allocName(INode const & _aNode);
+ sal_uInt8 makeState(node::Attributes const & _aAttributes);
+ sal_uInt8 makeFlags(node::Attributes const & _aAttributes);
};
//-----------------------------------------------------------------------------
@@ -209,11 +201,11 @@ namespace configmgr
, m_bWithDefaults()
{}
- TreeFragment *buildElementList(ISubtree const & _aSet, bool _bWithDefaults);
+ sharable::TreeFragment *buildElementList(ISubtree const & _aSet, bool _bWithDefaults);
private:
void handleNode(INode const & _aSourceNode);
- void handle(OValueNode const & _aSourceNode);
+ void handle(ValueNode const & _aSourceNode);
void handle(ISubtree const & _aSourceNode);
};
//-----------------------------------------------------------------------------
@@ -224,19 +216,17 @@ namespace configmgr
explicit
CopyingDataTreeBuilder() : BasicDataTreeBuilder() {}
- TreeAddress buildTree(TreeAccessor const & _aSourceTree);
-
- protected:
- using NodeVisitor::handle;
+ sharable::TreeFragment * buildTree(sharable::TreeFragment * sourceTree);
private:
class ElementListBuilder;
- Result handle(ValueNodeAccess const & _aNode);
- Result handle(GroupNodeAccess const & _aNode);
- Result handle(SetNodeAccess const & _aNode);
+ using NodeVisitor::handle;
+ virtual bool handle(sharable::ValueNode * node);
+ virtual bool handle(sharable::GroupNode * node);
+ virtual bool handle(sharable::SetNode * node);
- SetElementAddress makeTemplateData(SetElementAddress _aSourceTemplate);
+ sal_uInt8 * makeTemplateData(sal_uInt8 * _aSourceTemplate);
};
//-----------------------------------------------------------------------------
@@ -247,12 +237,11 @@ namespace configmgr
explicit
ElementListBuilder() : m_aCollector() {}
- List buildElementList(SetNodeAccess const & _aSet);
- protected:
- using NodeVisitor::handle;
+ sharable::TreeFragment * buildElementList(sharable::SetNode * set);
private:
- Result handle(TreeAccessor const & _aSourceTree);
+ using SetVisitor::handle;
+ virtual bool handle(sharable::TreeFragment * tree);
};
//-----------------------------------------------------------------------------
@@ -268,27 +257,26 @@ namespace configmgr
{
}
- std::auto_ptr<INode> buildNode(TreeAccessor const& _aTree, bool _bUseTreeName);
- std::auto_ptr<INode> buildNode(NodeAccess const& _aTree);
+ std::auto_ptr<INode> buildNode(sharable::TreeFragment * tree, bool _bUseTreeName);
+ std::auto_ptr<INode> buildNode(sharable::Node * tree);
- std::auto_ptr<ISubtree> buildNodeTree(GroupNodeAccess const& _aGroupNode) const;
- std::auto_ptr<ISubtree> buildNodeTree(SetNodeAccess const& _aSetNode) const;
- std::auto_ptr<OValueNode> buildNodeTree(ValueNodeAccess const& _aValueNode) const
- { return this->convertNode(_aValueNode); }
+ std::auto_ptr<ISubtree> buildNodeTree(sharable::GroupNode * groupNode) const;
+ std::auto_ptr<ISubtree> buildNodeTree(sharable::SetNode * setNode) const;
+ std::auto_ptr<ValueNode> buildNodeTree(sharable::ValueNode * valueNode) const
+ { return convertNode(valueNode); }
- static node::Attributes convertAttributes(NodeAccess const& _aNode)
- { return _aNode->getAttributes(); }
- protected:
- using NodeVisitor::handle;
+ static node::Attributes convertAttributes(sharable::Node * node)
+ { return node->getAttributes(); }
private:
- std::auto_ptr<ISubtree> convertNode(GroupNodeAccess const& _aGroupNode) const;
- std::auto_ptr<ISubtree> convertNode(SetNodeAccess const& _aSetNode) const;
- std::auto_ptr<OValueNode> convertNode(ValueNodeAccess const& _aValueNode) const;
+ std::auto_ptr<ISubtree> convertNode(sharable::GroupNode * groupNode) const;
+ std::auto_ptr<ISubtree> convertNode(sharable::SetNode * setNode) const;
+ std::auto_ptr<ValueNode> convertNode(sharable::ValueNode * valueNode) const;
- Result handle(ValueNodeAccess const & _aNode);
- Result handle(GroupNodeAccess const & _aNode);
- Result handle(SetNodeAccess const & _aNode);
+ using NodeVisitor::handle;
+ virtual bool handle(sharable::ValueNode * node);
+ virtual bool handle(sharable::GroupNode * node);
+ virtual bool handle(sharable::SetNode * node);
};
//-----------------------------------------------------------------------------
@@ -303,14 +291,13 @@ namespace configmgr
{
}
- void addElements(SetNodeAccess const & _aSet) { this->visitElements(_aSet); }
- void addChildren(GroupNodeAccess const & _aGroup) { this->visitChildren(_aGroup); }
- protected:
- using NodeVisitor::handle;
+ void addElements(sharable::SetNode * set) { visitElements(set); }
+ void addChildren(sharable::GroupNode * group) { visitChildren(group); }
private:
- Result handle(TreeAccessor const & _aElement);
- Result handle(NodeAccess const & _aMember);
+ using SetVisitor::handle;
+ virtual bool handle(sharable::Node * node);
+ virtual bool handle(sharable::TreeFragment * tree);
};
//-----------------------------------------------------------------------------
@@ -320,9 +307,9 @@ namespace configmgr
explicit
DataTreeDefaultMerger() {}
- void mergeDefaults(TreeAddress _aBaseAddress, INode const& _aDefaultNode);
+ void mergeDefaults(sharable::TreeFragment * _aBaseAddress, INode const& _aDefaultNode);
private:
- void handle(OValueNode const & _aNode);
+ void handle(ValueNode const & _aNode);
void handle(ISubtree const & _aNode);
};
@@ -334,12 +321,12 @@ namespace configmgr
explicit
DataTreeCleanup() {}
- TreeAddress destroyTree(TreeAddress _aBaseAddress);
+ sharable::TreeFragment * destroyTree(sharable::TreeFragment * _aBaseAddress);
private:
- void destroyNode(NodeAddress _aNodeAddress);
+ void destroyNode(sharable::Node * _aNodeAddress);
- void destroyData(TreeFragmentHeader * _pHeader);
- void destroyData(NodeInfo * _pNodeInfo);
+ void destroyData(sharable::TreeFragmentHeader * _pHeader);
+ void destroyData(sharable::NodeInfo * _pNodeInfo);
void destroyData(sharable::GroupNode * _pNode);
void destroyData(sharable::ValueNode * _pNode);
@@ -349,37 +336,33 @@ namespace configmgr
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
-TreeAddress buildTree(TreeAccessor const& _aTree)
+sharable::TreeFragment * buildTree(sharable::TreeFragment * tree)
{
- CopyingDataTreeBuilder aBuilder;
-
- TreeAddress aResult = aBuilder.buildTree(_aTree);
-
- return aResult;
+ return CopyingDataTreeBuilder().buildTree(tree);
}
//-----------------------------------------------------------------------------
-TreeAddress buildTree(rtl::OUString const & _aTreeName, INode const& _aNode, bool _bWithDefaults)
+sharable::TreeFragment * buildTree(rtl::OUString const & _aTreeName, INode const& _aNode, bool _bWithDefaults)
{
ConvertingDataTreeBuilder aBuilder;
- TreeAddress aResult = aBuilder.buildTree(_aTreeName, _aNode,_bWithDefaults);
+ sharable::TreeFragment * aResult = aBuilder.buildTree(_aTreeName, _aNode,_bWithDefaults);
return aResult;
}
//-----------------------------------------------------------------------------
-TreeAddress buildElementTree(INode const& _aNode, rtl::OUString const & _aTypeName, bool _bWithDefaults)
+sharable::TreeFragment * buildElementTree(INode const& _aNode, rtl::OUString const & _aTypeName, bool _bWithDefaults)
{
ConvertingDataTreeBuilder aBuilder;
- TreeAddress aResult = aBuilder.buildElement(_aNode, _aTypeName, _bWithDefaults);
+ sharable::TreeFragment * aResult = aBuilder.buildElement(_aNode, _aTypeName, _bWithDefaults);
return aResult;
}
//-----------------------------------------------------------------------------
-void mergeDefaults(TreeAddress _aBaseAddress, INode const& _aDefaultNode)
+void mergeDefaults(sharable::TreeFragment * _aBaseAddress, INode const& _aDefaultNode)
{
DataTreeDefaultMerger aMergeHelper;
@@ -387,7 +370,7 @@ void mergeDefaults(TreeAddress _aBaseAddress, INode const& _aDefaultNode)
}
//-----------------------------------------------------------------------------
-void destroyTree(TreeAddress _aBaseAddress)
+void destroyTree(sharable::TreeFragment * _aBaseAddress)
{
DataTreeCleanup aCleaner;
@@ -395,11 +378,11 @@ void destroyTree(TreeAddress _aBaseAddress)
}
//-----------------------------------------------------------------------------
-std::auto_ptr<INode> convertTree(TreeAccessor const & _aTree, bool _bUseTreeName)
+std::auto_ptr<INode> convertTree(sharable::TreeFragment * tree, bool _bUseTreeName)
{
ConvertingNodeBuilder aBuilder( configmgr::getDefaultTreeNodeFactory() );
- return aBuilder.buildNode(_aTree,_bUseTreeName);
+ return aBuilder.buildNode(tree, _bUseTreeName);
}
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
@@ -412,17 +395,17 @@ void TreeNodeBuilder::CollectSetElements::resetElementList()
//-----------------------------------------------------------------------------
inline
-List TreeNodeBuilder::CollectSetElements::getElementListAndClear()
+sharable::TreeFragment * TreeNodeBuilder::CollectSetElements::getElementListAndClear()
{
- List aResult = m_head;
+ sharable::TreeFragment * aResult = m_head;
m_head = NULL;
return aResult;
}
//-----------------------------------------------------------------------------
-void TreeNodeBuilder::CollectSetElements::addElement(TreeAddress _aNewElement)
+void TreeNodeBuilder::CollectSetElements::addElement(sharable::TreeFragment * _aNewElement)
{
- if (TreeFragment * pNewFragment = _aNewElement)
+ if (sharable::TreeFragment * pNewFragment = _aNewElement)
{
pNewFragment->header.parent = 0; // data not available here
pNewFragment->header.next = m_head;
@@ -435,85 +418,57 @@ void TreeNodeBuilder::CollectSetElements::addElement(TreeAddress _aNewElement)
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
-NodeVisitor::Result TreeNodeBuilder::LinkSetNodes::linkTree(TreeAddress const & _aTree)
-{
- TreeAccessor aTreeAccess(_aTree);
-
- TreeFragment const & rTreeData = *aTreeAccess;
-
- NodeAddress aOldParent = m_aParentAddr;
- m_aParentAddr = NULL;
-
- Result eResult = CONTINUE;
-
- Offset nCount = rTreeData.header.count;
- for(Offset i=0; i < nCount; ++i)
- {
- NodeAccess aNode(&rTreeData.nodes[i]);
- eResult =this->visitNode( aNode );
-
- if (eResult == DONE) break;
+void TreeNodeBuilder::LinkSetNodes::linkTree(sharable::TreeFragment * tree) {
+ sharable::Node * old = m_parent;
+ m_parent = 0;
+ sal_uInt16 n = tree->header.count;
+ for (sal_uInt16 i = 0; i < n; ++i) {
+ if (visitNode(tree->nodes + i)) {
+ break;
+ }
}
-
- m_aParentAddr = aOldParent;
-
- return eResult;
+ m_parent = old;
}
-//-----------------------------------------------------------------------------
-NodeVisitor::Result TreeNodeBuilder::LinkSetNodes::linkSet(SetNodeAccess const & _aSet)
+bool TreeNodeBuilder::LinkSetNodes::handle(sharable::SetNode * node)
{
- OSL_ENSURE(m_aParentAddr == NULL,"Linking set data already in progress");
- m_aParentAddr = _aSet;
-
- Result aResult = this->visitElements(_aSet);
-
- m_aParentAddr = NULL;
-
- return aResult;
-}
-//-----------------------------------------------------------------------------
-
-NodeVisitor::Result TreeNodeBuilder::LinkSetNodes::handle(TreeAccessor const & _aSourceTree)
-{
- OSL_ENSURE(m_aParentAddr != NULL,"Cannot link set element without parent address");
-
- _aSourceTree->header.parent = m_aParentAddr;
-
- return CONTINUE;
+ OSL_ASSERT(m_parent == 0);
+ m_parent = sharable::node(node);
+ bool done = visitElements(node);
+ m_parent = 0;
+ return done;
}
-//-----------------------------------------------------------------------------
-NodeVisitor::Result TreeNodeBuilder::LinkSetNodes::handle(SetNodeAccess const & _aNode)
+bool TreeNodeBuilder::LinkSetNodes::handle(sharable::TreeFragment * tree)
{
- return this->linkSet(_aNode);
+ OSL_ASSERT(m_parent != 0);
+ tree->header.parent = m_parent;
+ return false;
}
-//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
-//-----------------------------------------------------------------------------
-inline void TreeNodeBuilder::checkOffset(Offset _pos)
+inline void TreeNodeBuilder::checkOffset(sal_uInt16 _pos)
{
{ (void)_pos; }
OSL_ENSURE(_pos < m_nodes.size(), "TreeNodeBuilder: Node access past end.");
}
//-----------------------------------------------------------------------------
-Offset TreeNodeBuilder::addNode(Name _aName, Flags::Field _aFlags, Type::Field _aType)
+sal_uInt16 TreeNodeBuilder::addNode(rtl_uString * _aName, sal_uInt8 _aFlags, sal_uInt8 _aType)
{
OSL_PRECOND(_aName, "TreeNodeBuilder: Unexpected NULL name");
// TODO: consistencý checks for flags
OSL_ENSURE(m_nodes.size() == m_header.count, "TreeNodeBuilder: node count mismatch");
- Offset nNewOffset = m_header.count++;
+ sal_uInt16 nNewOffset = m_header.count++;
- m_nodes.push_back( Node() );
+ m_nodes.push_back( sharable::Node() );
OSL_ASSERT( &lastNode() == &nodeAt(nNewOffset) );
- NodeInfo & rInfo = lastNode().node.info;
+ sharable::NodeInfo & rInfo = lastNode().info;
rInfo.name = _aName;
rInfo.flags = _aFlags;
@@ -528,7 +483,7 @@ Offset TreeNodeBuilder::addNode(Name _aName, Flags::Field _aFlags, Type::Field _
}
//-----------------------------------------------------------------------------
-void TreeNodeBuilder::resetTreeFragment(sharable::String _name, State::Field _state)
+void TreeNodeBuilder::resetTreeFragment(rtl_uString * _name, sal_uInt8 _state)
{
m_header.next = 0;
m_header.name = _name;
@@ -543,27 +498,27 @@ void TreeNodeBuilder::resetTreeFragment(sharable::String _name, State::Field _st
}
//-----------------------------------------------------------------------------
-TreeAddress TreeNodeBuilder::allocTreeFragment()
+sharable::TreeFragment * TreeNodeBuilder::allocTreeFragment()
{
OSL_ENSURE(m_nodes.size() == m_header.count, "TreeNodeBuilder: node count mismatch");
- TreeFragment *pFragment = TreeFragment::allocate(m_header.count);
+ sharable::TreeFragment *pFragment = sharable::TreeFragment::allocate(m_header.count);
pFragment->header = m_header;
std::copy(m_nodes.begin(),m_nodes.end(),pFragment->nodes);
- return TreeAddress( pFragment );
+ return (sharable::TreeFragment *)( pFragment );
}
//-----------------------------------------------------------------------------
-void TreeNodeBuilder::linkTreeFragment(TreeAddress _aTreeFragment)
+void TreeNodeBuilder::linkTreeFragment(sharable::TreeFragment * _aTreeFragment)
{
LinkSetNodes().linkTree(_aTreeFragment);
}
//-----------------------------------------------------------------------------
-TreeAddress TreeNodeBuilder::createTreeFragment()
+sharable::TreeFragment * TreeNodeBuilder::createTreeFragment()
{
- TreeAddress aResult = allocTreeFragment();
+ sharable::TreeFragment * aResult = allocTreeFragment();
if (aResult != NULL)
{
@@ -575,9 +530,9 @@ TreeAddress TreeNodeBuilder::createTreeFragment()
}
//-----------------------------------------------------------------------------
-Offset TreeNodeBuilder::startGroup( Name _aName, Flags::Field _aFlags )
+sal_uInt16 TreeNodeBuilder::startGroup( rtl_uString * _aName, sal_uInt8 _aFlags )
{
- Offset nNewIndex = addNode(_aName,_aFlags,Type::nodetype_group);
+ sal_uInt16 nNewIndex = addNode(_aName,_aFlags,Type::nodetype_group);
lastNode().group.numDescendants = 0;
@@ -587,7 +542,7 @@ Offset TreeNodeBuilder::startGroup( Name _aName, Flags::Field _aFlags )
}
//-----------------------------------------------------------------------------
-void TreeNodeBuilder::endGroup( Offset _nPos )
+void TreeNodeBuilder::endGroup( sal_uInt16 _nPos )
{
// while (_nPos < m_parent) endGroup(m_parent);
OSL_PRECOND(_nPos == m_parent, "TreeNodeBuilder: Group being closed is not the current parent");
@@ -596,14 +551,14 @@ void TreeNodeBuilder::endGroup( Offset _nPos )
OSL_ENSURE(m_nodes.size() == m_header.count, "TreeNodeBuilder: node count mismatch");
- GroupNode & rGroup = nodeAt(_nPos).group;
+ sharable::GroupNode & rGroup = nodeAt(_nPos).group;
- rGroup.numDescendants = Offset( m_nodes.size() - static_cast< ::std::size_t >(_nPos) - 1 );
+ rGroup.numDescendants = sal_uInt16( m_nodes.size() - static_cast< ::std::size_t >(_nPos) - 1 );
m_parent = m_parent - rGroup.info.parent;
}
//-----------------------------------------------------------------------------
-void TreeNodeBuilder::addSet( Name _aName, Flags::Field _aFlags, SetElementAddress _aElementType )
+void TreeNodeBuilder::addSet( rtl_uString * _aName, sal_uInt8 _aFlags, sal_uInt8 * _aElementType )
{
addNode(_aName,_aFlags,Type::nodetype_set);
@@ -613,14 +568,14 @@ void TreeNodeBuilder::addSet( Name _aName, Flags::Field _aFlags, SetElementAddre
//-----------------------------------------------------------------------------
-void TreeNodeBuilder::addValue( Name _aName, Flags::Field _aFlags,
- AnyData::TypeCode _aValueType,
- AnyData _aUserValue,
- AnyData _aDefaultValue )
+void TreeNodeBuilder::addValue( rtl_uString * _aName, sal_uInt8 _aFlags,
+ sal_uInt8 _aValueType,
+ sharable::AnyData _aUserValue,
+ sharable::AnyData _aDefaultValue )
{
OSL_PRECOND(_aValueType == (_aValueType & Type::mask_valuetype), "TreeNodeBuilder: invalid value type");
- addNode(_aName,_aFlags,AnyData::TypeCode(Type::nodetype_value | _aValueType));
+ addNode(_aName,_aFlags,sal_uInt8(Type::nodetype_value | _aValueType));
lastNode().value.value = _aUserValue;
lastNode().value.defaultValue = _aDefaultValue;
@@ -631,112 +586,103 @@ void TreeNodeBuilder::addValue( Name _aName, Flags::Field _aFlags,
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
-TreeAddress CopyingDataTreeBuilder::buildTree(TreeAccessor const & _aSourceTree)
+sharable::TreeFragment * CopyingDataTreeBuilder::buildTree(sharable::TreeFragment * sourceTree)
{
- OSL_ENSURE(_aSourceTree != NULL, "Trying to build a tree from NULL data");
- if (_aSourceTree == NULL) return NULL;
-
- TreeFragment const & aSrc = *_aSourceTree;
+ OSL_ENSURE(sourceTree != 0, "Trying to build a tree from NULL data");
- sharable::String aTreeName = allocString( aSrc.getName());
- this->builder().resetTreeFragment(aTreeName, aSrc.header.state);
+ rtl_uString * aTreeName = acquireString( sourceTree->getName());
+ this->builder().resetTreeFragment(aTreeName, sourceTree->header.state);
- this->visitNode(_aSourceTree.getRootNode());
+ this->visitNode(sourceTree->getRootNode());
return this->createTree();
}
//-----------------------------------------------------------------------------
-NodeVisitor::Result CopyingDataTreeBuilder::handle(ValueNodeAccess const & _aNode)
+bool CopyingDataTreeBuilder::handle(sharable::ValueNode * node)
{
- sharable::ValueNode const & aSrc = _aNode.data();
+ rtl_uString * aNodeName = acquireString( node->info.getName());
+ sal_uInt8 aFlags = node->info.flags;
- sharable::Name aNodeName = allocName( aSrc.info.getName());
- Flags::Field aFlags = aSrc.info.flags;
+ sal_uInt8 aType = sal_uInt8( node->info.type & Type::mask_valuetype );
- AnyData::TypeCode aType = AnyData::TypeCode( aSrc.info.type & Type::mask_valuetype );
-
- AnyData aNewValue, aNewDefault;
+ sharable::AnyData aNewValue, aNewDefault;
if (aFlags & Flags::valueAvailable)
- aNewValue = allocData(aType, aSrc.getUserValue());
+ aNewValue = sharable::allocData(aType, node->getUserValue());
else
aNewValue.data = 0;
if (aFlags & Flags::defaultAvailable)
- aNewDefault = allocData(aType, aSrc.getDefaultValue());
+ aNewDefault = sharable::allocData(aType, node->getDefaultValue());
else
aNewDefault.data = 0;
this->builder().addValue(aNodeName,aFlags,aType,aNewValue,aNewDefault);
- return CONTINUE;
+ return false;
}
//-----------------------------------------------------------------------------
-NodeVisitor::Result CopyingDataTreeBuilder::handle(GroupNodeAccess const & _aNode)
+bool CopyingDataTreeBuilder::handle(sharable::GroupNode * node)
{
- sharable::GroupNode const & aSrc = _aNode.data();
-
- sharable::Name aNodeName = allocName( aSrc.info.getName());
- Flags::Field aFlags = aSrc.info.flags;
+ rtl_uString * aNodeName = acquireString( node->info.getName());
+ sal_uInt8 aFlags = node->info.flags;
- Offset nGroupOffset = this->builder().startGroup(aNodeName,aFlags);
- this->visitChildren(_aNode);
+ sal_uInt16 nGroupOffset = this->builder().startGroup(aNodeName,aFlags);
+ this->visitChildren(node);
this->builder().endGroup(nGroupOffset);
- return CONTINUE;
+ return false;
}
//-----------------------------------------------------------------------------
-NodeVisitor::Result CopyingDataTreeBuilder::handle(SetNodeAccess const & _aNode)
+bool CopyingDataTreeBuilder::handle(sharable::SetNode * node)
{
- sharable::SetNode const & aSrc = _aNode.data();
-
- sharable::Name aNodeName = allocName( aSrc.info.getName());
- Flags::Field aFlags = aSrc.info.flags;
- SetElementAddress aTemplate = this->makeTemplateData(aSrc.elementType);
+ rtl_uString * aNodeName = acquireString( node->info.getName());
+ sal_uInt8 aFlags = node->info.flags;
+ sal_uInt8 * aTemplate = this->makeTemplateData(node->elementType);
this->builder().addSet(aNodeName,aFlags,aTemplate);
OSL_ASSERT( this->builder().lastNode().isSet() );
- SetNode& _aNewSet = this->builder().lastNode().set;
+ sharable::SetNode& _aNewSet = this->builder().lastNode().set;
- _aNewSet.elements = ElementListBuilder().buildElementList(_aNode);
+ _aNewSet.elements = ElementListBuilder().buildElementList(node);
- return CONTINUE;
+ return false;
}
//-----------------------------------------------------------------------------
-SetElementAddress CopyingDataTreeBuilder::makeTemplateData(SetElementAddress _aSourceTemplate)
+sal_uInt8 * CopyingDataTreeBuilder::makeTemplateData(sal_uInt8 * _aSourceTemplate)
{
- return SetNode::copyTemplateData(_aSourceTemplate);
+ return sharable::SetNode::copyTemplateData(_aSourceTemplate);
}
//-----------------------------------------------------------------------------
-List CopyingDataTreeBuilder::ElementListBuilder::buildElementList(SetNodeAccess const & _aSet)
+sharable::TreeFragment * CopyingDataTreeBuilder::ElementListBuilder::buildElementList(sharable::SetNode * set)
{
- OSL_PRECOND(_aSet.isValid(), "Node must not be NULL");
+ OSL_ASSERT(set != 0);
m_aCollector.resetElementList();
- this->visitElements(_aSet);
+ this->visitElements(set);
return m_aCollector.getElementListAndClear();
}
//-----------------------------------------------------------------------------
-NodeVisitor::Result CopyingDataTreeBuilder::ElementListBuilder::handle(TreeAccessor const & _aSourceTree)
+bool CopyingDataTreeBuilder::ElementListBuilder::handle(sharable::TreeFragment * tree)
{
- TreeAddress aNewElement = CopyingDataTreeBuilder().buildTree(_aSourceTree);
+ sharable::TreeFragment * aNewElement = CopyingDataTreeBuilder().buildTree(tree);
m_aCollector.addElement(aNewElement);
- return CONTINUE;
+ return false;
}
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
-Name ConvertingDataTreeBuilder::allocName(INode const & _aNode)
+rtl_uString * ConvertingDataTreeBuilder::allocName(INode const & _aNode)
{
rtl::OUString sNextName = _aNode.getName();
@@ -746,16 +692,16 @@ Name ConvertingDataTreeBuilder::allocName(INode const & _aNode)
m_sRootName = rtl::OUString();
}
- return sharable::allocName( sNextName);
+ return acquireString( sNextName);
}
//-----------------------------------------------------------------------------
-TreeAddress ConvertingDataTreeBuilder::buildElement(INode const& _aNode, OUString const & _aTypeName, bool _bWithDefaults)
+sharable::TreeFragment * ConvertingDataTreeBuilder::buildElement(INode const& _aNode, rtl::OUString const & _aTypeName, bool _bWithDefaults)
{
m_sRootName = _aTypeName;
m_bWithDefaults = _bWithDefaults;
- sharable::String aTreeName = allocString( _aNode.getName());
+ rtl_uString * aTreeName = acquireString( _aNode.getName());
this->builder().resetTreeFragment(aTreeName, makeState(_aNode.getAttributes()));
@@ -765,12 +711,12 @@ TreeAddress ConvertingDataTreeBuilder::buildElement(INode const& _aNode, OUStrin
}
//-----------------------------------------------------------------------------
-TreeAddress ConvertingDataTreeBuilder::buildTree(OUString const & _aTreeName, INode const& _aNode, bool _bWithDefaults)
+sharable::TreeFragment * ConvertingDataTreeBuilder::buildTree(rtl::OUString const & _aTreeName, INode const& _aNode, bool _bWithDefaults)
{
- m_sRootName = OUString();
+ m_sRootName = rtl::OUString();
m_bWithDefaults = _bWithDefaults;
- sharable::String aTreeName = allocString( _aTreeName );
+ rtl_uString * aTreeName = acquireString( _aTreeName );
this->builder().resetTreeFragment(aTreeName, makeState(_aNode.getAttributes()));
@@ -782,39 +728,39 @@ TreeAddress ConvertingDataTreeBuilder::buildTree(OUString const & _aTreeName, IN
void ConvertingDataTreeBuilder::handle(ISubtree const & _aNode)
{
- sharable::Name aNodeName = allocName( _aNode );
- Flags::Field aFlags = makeFlags(_aNode.getAttributes());
+ rtl_uString * aNodeName = allocName( _aNode );
+ sal_uInt8 aFlags = makeFlags(_aNode.getAttributes());
if (_aNode.isSetNode())
{
- SetElementAddress aTemplate = this->makeTemplateData(_aNode.getElementTemplateName(),
+ sal_uInt8 * aTemplate = this->makeTemplateData(_aNode.getElementTemplateName(),
_aNode.getElementTemplateModule());
this->builder().addSet(aNodeName,aFlags,aTemplate);
OSL_ASSERT( this->builder().lastNode().isSet() );
- SetNode& _aNewSet = this->builder().lastNode().set;
+ sharable::SetNode& _aNewSet = this->builder().lastNode().set;
_aNewSet.elements = ElementListBuilder().buildElementList(_aNode, m_bWithDefaults);
}
else
{
- Offset nGroupOffset = this->builder().startGroup(aNodeName,aFlags);
+ sal_uInt16 nGroupOffset = this->builder().startGroup(aNodeName,aFlags);
this->applyToChildren(_aNode);
this->builder().endGroup(nGroupOffset);
}
}
//-----------------------------------------------------------------------------
-void ConvertingDataTreeBuilder::handle(OValueNode const & _aNode)
+void ConvertingDataTreeBuilder::handle(ValueNode const & _aNode)
{
- sharable::Name aNodeName = allocName( _aNode );
- Flags::Field aFlags = makeFlags(_aNode.getAttributes());
+ rtl_uString * aNodeName = allocName( _aNode );
+ sal_uInt8 aFlags = makeFlags(_aNode.getAttributes());
- AnyData::TypeCode aType = getTypeCode(_aNode.getValueType());
+ sal_uInt8 aType = sharable::getTypeCode(_aNode.getValueType());
- AnyData aNewValue; aNewValue.data = 0;
- AnyData aNewDefault; aNewDefault.data = 0;
+ sharable::AnyData aNewValue; aNewValue.data = 0;
+ sharable::AnyData aNewDefault; aNewDefault.data = 0;
OSL_ASSERT( !(aFlags & (Flags::valueAvailable | Flags::defaultAvailable)) );
@@ -823,7 +769,7 @@ void ConvertingDataTreeBuilder::handle(OValueNode const & _aNode)
uno::Any aValue = _aNode.getValue();
if (aValue.hasValue())
{
- aNewValue = allocData(aType, aValue);
+ aNewValue = sharable::allocData(aType, aValue);
aFlags |= Flags::valueAvailable;
}
}
@@ -833,7 +779,7 @@ void ConvertingDataTreeBuilder::handle(OValueNode const & _aNode)
uno::Any aDefault = _aNode.getDefault();
if (aDefault.hasValue())
{
- aNewDefault = allocData(aType, aDefault);
+ aNewDefault = sharable::allocData(aType, aDefault);
aFlags |= Flags::defaultAvailable;
}
}
@@ -842,9 +788,9 @@ void ConvertingDataTreeBuilder::handle(OValueNode const & _aNode)
}
//-----------------------------------------------------------------------------
-State::Field ConvertingDataTreeBuilder::makeState(node::Attributes const & _aAttributes)
+sal_uInt8 ConvertingDataTreeBuilder::makeState(node::Attributes const & _aAttributes)
{
- State::Field state;
+ sal_uInt8 state;
switch (_aAttributes.state())
{
@@ -872,9 +818,9 @@ State::Field ConvertingDataTreeBuilder::makeState(node::Attributes const & _aAtt
}
//-----------------------------------------------------------------------------
-Flags::Field ConvertingDataTreeBuilder::makeFlags(node::Attributes const & _aAttributes)
+sal_uInt8 ConvertingDataTreeBuilder::makeFlags(node::Attributes const & _aAttributes)
{
- Flags::Field flags = 0;
+ sal_uInt8 flags = 0;
if ( _aAttributes.isReadonly())
flags |= Flags::readonly;
@@ -898,13 +844,13 @@ Flags::Field ConvertingDataTreeBuilder::makeFlags(node::Attributes const & _aAtt
}
//-----------------------------------------------------------------------------
-SetElementAddress ConvertingDataTreeBuilder::makeTemplateData(rtl::OUString const & _aTemplateName, rtl::OUString const & _aTemplateModule)
+sal_uInt8 * ConvertingDataTreeBuilder::makeTemplateData(rtl::OUString const & _aTemplateName, rtl::OUString const & _aTemplateModule)
{
- return SetNode::allocTemplateData(_aTemplateName, _aTemplateModule );
+ return sharable::SetNode::allocTemplateData(_aTemplateName, _aTemplateModule );
}
//-----------------------------------------------------------------------------
-List ConvertingDataTreeBuilder::ElementListBuilder::buildElementList(ISubtree const & _aSet, bool _bWithDefaults)
+sharable::TreeFragment * ConvertingDataTreeBuilder::ElementListBuilder::buildElementList(ISubtree const & _aSet, bool _bWithDefaults)
{
OSL_PRECOND(_aSet.isSetNode(), "Node must be a set");
@@ -921,14 +867,14 @@ List ConvertingDataTreeBuilder::ElementListBuilder::buildElementList(ISubtree co
void ConvertingDataTreeBuilder::ElementListBuilder::handleNode(INode const & _aSourceNode)
{
- TreeAddress aNewElement = ConvertingDataTreeBuilder()
+ sharable::TreeFragment * aNewElement = ConvertingDataTreeBuilder()
.buildElement(_aSourceNode,m_sTypeName,m_bWithDefaults);
m_aCollector.addElement(aNewElement);
}
//-----------------------------------------------------------------------------
-void ConvertingDataTreeBuilder::ElementListBuilder::handle(OValueNode const & _aSourceNode)
+void ConvertingDataTreeBuilder::ElementListBuilder::handle(ValueNode const & _aSourceNode)
{
handleNode(_aSourceNode);
}
@@ -941,13 +887,13 @@ void ConvertingDataTreeBuilder::ElementListBuilder::handle(ISubtree const & _aS
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
-std::auto_ptr<INode> ConvertingNodeBuilder::buildNode(TreeAccessor const & _aSourceTree, bool _bUseTreeName)
+std::auto_ptr<INode> ConvertingNodeBuilder::buildNode(sharable::TreeFragment * sourceTree, bool _bUseTreeName)
{
- std::auto_ptr<INode> pResult = this->buildNode(_aSourceTree.getRootNode());
+ std::auto_ptr<INode> pResult = this->buildNode(sourceTree == 0 ? 0 : sourceTree->getRootNode());
if (pResult.get() != NULL)
{
// use the element name !
- if (_bUseTreeName) pResult->setName( _aSourceTree.getName().toString() );
+ if (_bUseTreeName) pResult->setName( sourceTree->getName() );
// do something about attributes here ?
}
@@ -955,118 +901,118 @@ std::auto_ptr<INode> ConvertingNodeBuilder::buildNode(TreeAccessor const & _aSou
}
//-----------------------------------------------------------------------------
-std::auto_ptr<INode> ConvertingNodeBuilder::buildNode(NodeAccess const & _aSourceNode)
+std::auto_ptr<INode> ConvertingNodeBuilder::buildNode(sharable::Node * sourceNode)
{
OSL_ENSURE( !m_pNode.get(), "Old node tree will be dropped");
- this->visitNode(_aSourceNode);
+ visitNode(sourceNode);
return m_pNode;
}
//-----------------------------------------------------------------------------
-std::auto_ptr<ISubtree> ConvertingNodeBuilder::buildNodeTree(GroupNodeAccess const& _aGroupNode) const
+std::auto_ptr<ISubtree> ConvertingNodeBuilder::buildNodeTree(sharable::GroupNode * groupNode) const
{
- std::auto_ptr<ISubtree> pResult = convertNode(_aGroupNode);
+ std::auto_ptr<ISubtree> pResult = convertNode(groupNode);
if (pResult.get() != NULL)
{
ConvertingSubnodeBuilder aCollector(m_rNodeFactory, *pResult);
- aCollector.addChildren(_aGroupNode);
+ aCollector.addChildren(groupNode);
}
return pResult;
}
//-----------------------------------------------------------------------------
-std::auto_ptr<ISubtree> ConvertingNodeBuilder::buildNodeTree(SetNodeAccess const& _aSetNode) const
+std::auto_ptr<ISubtree> ConvertingNodeBuilder::buildNodeTree(sharable::SetNode * setNode) const
{
- std::auto_ptr<ISubtree> pResult = convertNode(_aSetNode);
+ std::auto_ptr<ISubtree> pResult = convertNode(setNode);
if (pResult.get() != NULL)
{
ConvertingSubnodeBuilder aCollector(m_rNodeFactory, *pResult);
- aCollector.addElements(_aSetNode);
+ aCollector.addElements(setNode);
}
return pResult;
}
//-----------------------------------------------------------------------------
-std::auto_ptr<ISubtree> ConvertingNodeBuilder::convertNode(GroupNodeAccess const& _aGroupNode) const
+std::auto_ptr<ISubtree> ConvertingNodeBuilder::convertNode(sharable::GroupNode * groupNode) const
{
- return m_rNodeFactory.createGroupNode( _aGroupNode.getName().toString(),
- convertAttributes(_aGroupNode));
+ return m_rNodeFactory.createGroupNode( groupNode->info.getName(),
+ convertAttributes(sharable::node(groupNode)));
}
//-----------------------------------------------------------------------------
-std::auto_ptr<ISubtree> ConvertingNodeBuilder::convertNode(SetNodeAccess const& _aSetNode) const
+std::auto_ptr<ISubtree> ConvertingNodeBuilder::convertNode(sharable::SetNode * setNode) const
{
- return m_rNodeFactory.createSetNode(_aSetNode.getName().toString(),
- _aSetNode.getElementTemplateName().toString(),
- _aSetNode.getElementTemplateModule().toString(),
- convertAttributes(_aSetNode));
+ return m_rNodeFactory.createSetNode(setNode->info.getName(),
+ setNode->getElementTemplateName(),
+ setNode->getElementTemplateModule(),
+ convertAttributes(sharable::node(setNode)));
}
//-----------------------------------------------------------------------------
-std::auto_ptr<OValueNode> ConvertingNodeBuilder::convertNode(ValueNodeAccess const& _aValueNode) const
+std::auto_ptr<ValueNode> ConvertingNodeBuilder::convertNode(sharable::ValueNode * valueNode) const
{
- uno::Any aUserValue = _aValueNode.getUserValue();
- uno::Any aDefValue = _aValueNode.getDefaultValue();
+ uno::Any aUserValue = valueNode->getUserValue();
+ uno::Any aDefValue = valueNode->getDefaultValue();
if (aUserValue.hasValue() || aDefValue.hasValue())
{
- return m_rNodeFactory.createValueNode(_aValueNode.getName().toString(),
- aUserValue, aDefValue,
- convertAttributes(_aValueNode));
+ return m_rNodeFactory.createValueNode(valueNode->info.getName(),
+ aUserValue, aDefValue,
+ convertAttributes(sharable::node(valueNode)));
}
else
{
- return m_rNodeFactory.createNullValueNode(_aValueNode.getName().toString(),
- _aValueNode.getValueType(),
- convertAttributes(_aValueNode));
+ return m_rNodeFactory.createNullValueNode(valueNode->info.getName(),
+ valueNode->getValueType(),
+ convertAttributes(sharable::node(valueNode)));
}
}
//-----------------------------------------------------------------------------
-NodeVisitor::Result ConvertingNodeBuilder::handle(ValueNodeAccess const & _aNode)
+bool ConvertingNodeBuilder::handle(sharable::ValueNode * node)
{
- m_pNode = base_ptr(buildNodeTree(_aNode));
- return DONE;
+ m_pNode = base_ptr(buildNodeTree(node));
+ return true;
}
//-----------------------------------------------------------------------------
-NodeVisitor::Result ConvertingNodeBuilder::handle(GroupNodeAccess const & _aNode)
+bool ConvertingNodeBuilder::handle(sharable::GroupNode * node)
{
- m_pNode = base_ptr(buildNodeTree(_aNode));
- return DONE;
+ m_pNode = base_ptr(buildNodeTree(node));
+ return true;
}
//-----------------------------------------------------------------------------
-NodeVisitor::Result ConvertingNodeBuilder::handle(SetNodeAccess const & _aNode)
+bool ConvertingNodeBuilder::handle(sharable::SetNode * node)
{
- m_pNode = base_ptr(buildNodeTree(_aNode));
- return DONE;
+ m_pNode = base_ptr(buildNodeTree(node));
+ return true;
}
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
-NodeVisitor::Result ConvertingSubnodeBuilder::handle(TreeAccessor const & _aElement)
+bool ConvertingSubnodeBuilder::handle(sharable::TreeFragment * tree)
{
OSL_ASSERT(m_rParentNode.isSetNode());
- m_rParentNode.addChild( m_aSubnodeBuilder.buildNode(_aElement,true) );
- return CONTINUE;
+ m_rParentNode.addChild(m_aSubnodeBuilder.buildNode(tree, true));
+ return false;
}
//-----------------------------------------------------------------------------
-NodeVisitor::Result ConvertingSubnodeBuilder::handle(NodeAccess const & _aMember)
+bool ConvertingSubnodeBuilder::handle(sharable::Node * node)
{
OSL_ASSERT(!m_rParentNode.isSetNode());
- m_rParentNode.addChild( m_aSubnodeBuilder.buildNode(_aMember) );
- return CONTINUE;
+ m_rParentNode.addChild(m_aSubnodeBuilder.buildNode(node));
+ return false;
}
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
-void DataTreeDefaultMerger::mergeDefaults(TreeAddress /*_aBaseAddress*/, INode const& /*_aDefaultNode*/)
+void DataTreeDefaultMerger::mergeDefaults(sharable::TreeFragment * /*_aBaseAddress*/, INode const& /*_aDefaultNode*/)
{
}
//-----------------------------------------------------------------------------
@@ -1076,38 +1022,38 @@ void DataTreeDefaultMerger::handle(ISubtree const & /*_aNode*/)
}
//-----------------------------------------------------------------------------
-void DataTreeDefaultMerger::handle(OValueNode const & /*_aNode*/)
+void DataTreeDefaultMerger::handle(ValueNode const & /*_aNode*/)
{
}
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
-TreeAddress DataTreeCleanup::destroyTree(TreeAddress _aBaseAddress)
+sharable::TreeFragment * DataTreeCleanup::destroyTree(sharable::TreeFragment * _aBaseAddress)
{
- TreeFragment *pData = _aBaseAddress;
+ sharable::TreeFragment *pData = _aBaseAddress;
- TreeFragment *pNext = pData->header.next;
+ sharable::TreeFragment *pNext = pData->header.next;
- Offset const nCount = pData->header.count;
+ sal_uInt16 const nCount = pData->header.count;
destroyData( & pData->header );
- for (Offset i = 0; i< nCount; ++i)
+ for (sal_uInt16 i = 0; i< nCount; ++i)
{
destroyNode( addressOfNodeAt(_aBaseAddress,i) );
}
- TreeFragment::free_shallow( pData );
+ sharable::TreeFragment::free_shallow( pData );
- return TreeAddress( pNext );
+ return (sharable::TreeFragment *)( pNext );
}
//-----------------------------------------------------------------------------
-void DataTreeCleanup::destroyNode(NodeAddress _aNodeAddress)
+void DataTreeCleanup::destroyNode(sharable::Node * _aNodeAddress)
{
- Node * pNode = _aNodeAddress;
+ sharable::Node * pNode = _aNodeAddress;
- Type::Field aTypeTag = pNode->node.info.type;
+ sal_uInt8 aTypeTag = pNode->info.type;
switch ( aTypeTag & Type::mask_nodetype )
{
case Type::nodetype_group:
@@ -1126,36 +1072,36 @@ void DataTreeCleanup::destroyNode(NodeAddress _aNodeAddress)
}
//-----------------------------------------------------------------------------
-void DataTreeCleanup::destroyData(TreeFragmentHeader * _pHeader)
+void DataTreeCleanup::destroyData(sharable::TreeFragmentHeader * _pHeader)
{
// 'component' is owned elsewhere -> leave alone
- sharable::String aName = _pHeader->name;
+ rtl_uString * aName = _pHeader->name;
- freeString( aName );
+ rtl_uString_release( aName );
}
//-----------------------------------------------------------------------------
-void DataTreeCleanup::destroyData(NodeInfo * _pNodeInfo)
+void DataTreeCleanup::destroyData(sharable::NodeInfo * _pNodeInfo)
{
- Name aName = _pNodeInfo->name;
+ rtl_uString * aName = _pNodeInfo->name;
- if (aName) freeName( aName );
+ if (aName) rtl_uString_release( aName );
}
//-----------------------------------------------------------------------------
void DataTreeCleanup::destroyData(sharable::SetNode * _pNode)
{
- TreeAddress aElement( _pNode->elements );
+ sharable::TreeFragment * aElement( _pNode->elements );
- SetElementAddress aTemplate = _pNode->elementType;;
+ sal_uInt8 * aTemplate = _pNode->elementType;;
destroyData(&_pNode->info);
while (aElement != NULL)
aElement = destroyTree(aElement);
- SetNode::releaseTemplateData( aTemplate );
+ sharable::SetNode::releaseTemplateData( aTemplate );
}
//-----------------------------------------------------------------------------
@@ -1168,8 +1114,8 @@ void DataTreeCleanup::destroyData(sharable::GroupNode * _pNode)
void DataTreeCleanup::destroyData(sharable::ValueNode * _pNode)
{
- AnyData::TypeCode aValueType = AnyData::TypeCode( _pNode->info.type & Type::mask_valuetype );
- Flags::Field aFlags = _pNode->info.flags;
+ sal_uInt8 aValueType = sal_uInt8( _pNode->info.type & Type::mask_valuetype );
+ sal_uInt8 aFlags = _pNode->info.flags;
destroyData(&_pNode->info);
diff --git a/configmgr/source/tree/changes.cxx b/configmgr/source/tree/changes.cxx
index 980438e63e..862809ad97 100644
--- a/configmgr/source/tree/changes.cxx
+++ b/configmgr/source/tree/changes.cxx
@@ -67,7 +67,7 @@ static inline bool isDefaultMode(ValueChange::Mode _eMode)
static inline bool isLayerChangeMode(ValueChange::Mode _eMode)
{ return (_eMode == ValueChange::setToDefault) || (_eMode == ValueChange::wasDefault); }
// -----------------------------------------------------------------------------
-ValueChange::ValueChange(OUString const& _rName,
+ValueChange::ValueChange(rtl::OUString const& _rName,
const node::Attributes& _rAttributes,
Mode _eMode,
uno::Any const & aNewValue, uno::Any const & aOldValue)
@@ -110,7 +110,6 @@ namespace tree_changes_internal {
aActual = aTarget;
}
}
-using namespace tree_changes_internal;
// -------------------------------------------------------------------------
void ValueChange::applyChangeNoRecover(ValueNode& aValue) const
@@ -140,9 +139,7 @@ void ValueChange::applyChangeNoRecover(ValueNode& aValue) const
//==========================================================================
//= AddNode
//==========================================================================
-using data::TreeSegment;
-//------------------------------------------0--------------------------------
-AddNode::AddNode(TreeSegment const & _aAddedTree, OUString const& _rName, bool _bToDefault)
+AddNode::AddNode(rtl::Reference< data::TreeSegment > const & _aAddedTree, rtl::OUString const& _rName, bool _bToDefault)
:Change(_rName,_bToDefault)
,m_aOwnNewNode(_aAddedTree)
,m_aOwnOldNode()
@@ -159,8 +156,8 @@ AddNode::~AddNode()
// -----------------------------------------------------------------------------
AddNode::AddNode(const AddNode& _aObj)
: Change(_aObj)
-, m_aOwnNewNode(_aObj.m_aOwnNewNode.cloneSegment())
-, m_aOwnOldNode(_aObj.m_aOwnOldNode.cloneSegment())
+, m_aOwnNewNode(data::TreeSegment::create(_aObj.m_aOwnNewNode))
+, m_aOwnOldNode(data::TreeSegment::create(_aObj.m_aOwnOldNode))
, m_aInsertedTree(_aObj.m_aInsertedTree)
, m_bReplacing(_aObj.m_bReplacing)
{
@@ -173,7 +170,7 @@ std::auto_ptr<Change> AddNode::clone() const
}
//--------------------------------------------------------------------------
-void AddNode::setInsertedAddress(data::TreeAddress const & _aInsertedTree)
+void AddNode::setInsertedAddress(sharable::TreeFragment * const & _aInsertedTree)
{
OSL_ENSURE( m_aInsertedTree == NULL, "AddNode already was applied - inserted a second time ?");
m_aInsertedTree = _aInsertedTree;
@@ -193,7 +190,7 @@ void AddNode::expectReplacedNode(INode const* pOldNode)
#endif
//--------------------------------------------------------------------------
-void AddNode::takeReplacedTree(TreeSegment const & _aReplacedTree)
+void AddNode::takeReplacedTree(rtl::Reference< data::TreeSegment > const & _aReplacedTree)
{
m_aOwnOldNode = _aReplacedTree;
@@ -204,7 +201,7 @@ void AddNode::takeReplacedTree(TreeSegment const & _aReplacedTree)
//==========================================================================
//= RemoveNode
//==========================================================================
-RemoveNode::RemoveNode(OUString const& _rName, bool _bToDefault)
+RemoveNode::RemoveNode(rtl::OUString const& _rName, bool _bToDefault)
:Change(_rName,_bToDefault)
,m_aOwnOldNode()
{
@@ -217,7 +214,7 @@ RemoveNode::~RemoveNode()
// -----------------------------------------------------------------------------
RemoveNode::RemoveNode(const RemoveNode& _aObj)
: Change(_aObj)
-, m_aOwnOldNode(_aObj.m_aOwnOldNode.cloneSegment())
+, m_aOwnOldNode(data::TreeSegment::create(_aObj.m_aOwnOldNode))
{
}
@@ -240,7 +237,7 @@ void RemoveNode::expectRemovedNode(INode const* pOldNode)
#endif
//--------------------------------------------------------------------------
-void RemoveNode::takeRemovedTree(data::TreeSegment const & _aRemovedTree)
+void RemoveNode::takeRemovedTree(rtl::Reference< data::TreeSegment > const & _aRemovedTree)
{
m_aOwnOldNode = _aRemovedTree;
}
diff --git a/configmgr/source/tree/cmtree.cxx b/configmgr/source/tree/cmtree.cxx
index cc68ae6c9e..e03dd684e2 100644
--- a/configmgr/source/tree/cmtree.cxx
+++ b/configmgr/source/tree/cmtree.cxx
@@ -36,7 +36,6 @@
#include "subtree.hxx"
#include "change.hxx"
#include "treechangelist.hxx"
-#include "treeprovider.hxx"
//#include "treeactions.hxx"
#include <rtl/string.hxx>
@@ -61,10 +60,6 @@
#endif
#include <algorithm>
-using namespace std;
-using namespace rtl;
-using namespace com::sun::star::uno;
-
namespace configmgr
{
@@ -92,12 +87,12 @@ namespace configmgr
}
};
- ChildList::iterator ChildListSet::find(INode *pNode) const
+ std::vector< INode* >::iterator ChildListSet::find(INode *pNode) const
{
- ChildList &rList = const_cast<ChildList &>(m_aChildList);
- std::pair<ChildList::iterator, ChildList::iterator> aRange;
+ std::vector< INode* > &rList = const_cast<std::vector< INode* > &>(m_aChildList);
+ std::pair<std::vector< INode* >::iterator, std::vector< INode* >::iterator> aRange;
ltNode aCompare;
- aRange = equal_range(rList.begin(), rList.end(), pNode, aCompare);
+ aRange = std::equal_range(rList.begin(), rList.end(), pNode, aCompare);
if (aRange.second - aRange.first == 0)
return rList.end();
else
@@ -105,7 +100,7 @@ namespace configmgr
}
// Keep the list sorted ...
- std::pair<ChildList::iterator, bool> ChildListSet::insert(INode *pNode)
+ std::pair<std::vector< INode* >::iterator, bool> ChildListSet::insert(INode *pNode)
{
// Inserted records are (mostly) already in order
if (m_aChildList.size() > 0)
@@ -114,25 +109,25 @@ namespace configmgr
m_aChildList.back()->getName());
if (nCmp == 0)
{
- return std::pair<ChildList::iterator, bool>(m_aChildList.end(), false);
+ return std::pair<std::vector< INode* >::iterator, bool>(m_aChildList.end(), false);
}
else if (nCmp < 0)
{
- ChildList::iterator aIns;
+ std::vector< INode* >::iterator aIns;
ltNode aCompare;
- aIns = lower_bound(m_aChildList.begin(), m_aChildList.end(), pNode, aCompare);
+ aIns = std::lower_bound(m_aChildList.begin(), m_aChildList.end(), pNode, aCompare);
if (aIns != m_aChildList.end() && pNode->getName().compareTo((*aIns)->getName()) == 0)
- return std::pair<ChildList::iterator, bool>(m_aChildList.end(), false);
- return std::pair<ChildList::iterator, bool>(m_aChildList.insert(aIns, pNode), true);
+ return std::pair<std::vector< INode* >::iterator, bool>(m_aChildList.end(), false);
+ return std::pair<std::vector< INode* >::iterator, bool>(m_aChildList.insert(aIns, pNode), true);
}
}
// simple append - the common case.
- return std::pair<ChildList::iterator, bool>(m_aChildList.insert(m_aChildList.end(), pNode), true);
+ return std::pair<std::vector< INode* >::iterator, bool>(m_aChildList.insert(m_aChildList.end(), pNode), true);
}
INode *ChildListSet::erase(INode *pNode)
{
- ChildList::iterator aIter = find(pNode);
+ std::vector< INode* >::iterator aIter = find(pNode);
if (aIter != m_aChildList.end())
{
@@ -146,7 +141,7 @@ namespace configmgr
// ---------------------------- Node implementation ----------------------------
- INode::INode(OUString const& aName, node::Attributes _aAttr)
+ INode::INode(rtl::OUString const& aName, node::Attributes _aAttr)
:m_aName(aName)
,m_aAttributes(_aAttr){}
// CopyCTor will be create automatically
@@ -190,7 +185,7 @@ namespace configmgr
}
// ------------------------- SearchNode implementation -------------------------
- SearchNode::SearchNode(OUString const& aName)
+ SearchNode::SearchNode(rtl::OUString const& aName)
:INode(aName, node::Attributes()){}
std::auto_ptr<INode> SearchNode::clone() const {return std::auto_ptr<INode>(new SearchNode(*this));}
@@ -205,8 +200,7 @@ namespace configmgr
struct OPropagateLevels : public NodeModification
{
public:
- typedef sal_Int16 Level;
- OPropagateLevels(Level _nParentLevel, Level _nParentDefaultLevel)
+ OPropagateLevels(sal_Int16 _nParentLevel, sal_Int16 _nParentDefaultLevel)
: m_nLevel ( childLevel(_nParentLevel) )
, m_nDefaultLevel ( childLevel(_nParentDefaultLevel) )
{
@@ -217,14 +211,14 @@ namespace configmgr
_rSubtree.setLevels(m_nLevel, m_nDefaultLevel);
}
- static Level childLevel(Level _nLevel)
+ static sal_Int16 childLevel(sal_Int16 _nLevel)
{
OSL_ASSERT(0 > treeop::ALL_LEVELS);
return (_nLevel > 0) ? _nLevel-1 : _nLevel;
}
protected:
- Level m_nLevel;
- Level m_nDefaultLevel;
+ sal_Int16 m_nLevel;
+ sal_Int16 m_nDefaultLevel;
};
@@ -268,25 +262,25 @@ namespace configmgr
return std::auto_ptr<INode>(new Subtree(*this, treeop::DeepChildCopy()));
}
- INode* Subtree::doGetChild(OUString const& aName) const
+ INode* Subtree::doGetChild(rtl::OUString const& aName) const
{
SearchNode searchObj(aName);
- ChildList::iterator aIter = m_aChildren.find(&searchObj);
+ std::vector< INode* >::iterator aIter = m_aChildren.find(&searchObj);
return aIter != m_aChildren.end() ? *aIter : NULL;
}
INode* Subtree::addChild(std::auto_ptr<INode> aNode) // takes ownership
{
- OUString aName = aNode->getName();
- std::pair<ChildList::iterator, bool> aInserted =
+ rtl::OUString aName = aNode->getName();
+ std::pair<std::vector< INode* >::iterator, bool> aInserted =
m_aChildren.insert(aNode.get());
if (aInserted.second)
aNode.release();
return *aInserted.first;
}
- ::std::auto_ptr<INode> Subtree::removeChild(OUString const& aName)
+ ::std::auto_ptr<INode> Subtree::removeChild(rtl::OUString const& aName)
{
SearchNode searchObj(aName);
return ::std::auto_ptr<INode>(m_aChildren.erase(&searchObj));
@@ -295,7 +289,7 @@ namespace configmgr
void Subtree::forEachChild(NodeAction& anAction) const
{
- for(ChildList::const_iterator it = m_aChildren.begin();
+ for(std::vector< INode* >::const_iterator it = m_aChildren.begin();
it != m_aChildren.end();
++it)
(**it).dispatch(anAction);
@@ -303,7 +297,7 @@ namespace configmgr
void Subtree::forEachChild(NodeModification& anAction)
{
- ChildList::iterator it = m_aChildren.begin();
+ std::vector< INode* >::iterator it = m_aChildren.begin();
while( it != m_aChildren.end() )
{
// modification-safe iteration
@@ -328,14 +322,14 @@ namespace configmgr
return true;
}
- bool ValueNode::setValue(Any const& _aValue)
+ bool ValueNode::setValue(com::sun::star::uno::Any const& _aValue)
{
sal_Bool bRet = m_aValuePair.setFirst(_aValue);
if (bRet) this->markAsDefault(false);
return !! bRet;
}
- bool ValueNode::changeDefault(Any const& _aValue)
+ bool ValueNode::changeDefault(com::sun::star::uno::Any const& _aValue)
{
return !! m_aValuePair.setSecond(_aValue);
}
diff --git a/configmgr/source/tree/cmtreemodel.cxx b/configmgr/source/tree/cmtreemodel.cxx
index e03ef22f8b..c9b9116936 100644
--- a/configmgr/source/tree/cmtreemodel.cxx
+++ b/configmgr/source/tree/cmtreemodel.cxx
@@ -111,7 +111,7 @@ SubtreeChange::~SubtreeChange()
}
// -----------------------------------------------------------------------------
-SubtreeChange::SubtreeChange(const SubtreeChange& _aObj, DeepChildCopy)
+SubtreeChange::SubtreeChange(const SubtreeChange& _aObj, treeop::DeepChildCopy)
:Change(_aObj),
m_sTemplateName(_aObj.m_sTemplateName),
m_sTemplateModule(_aObj.m_sTemplateModule),
@@ -130,12 +130,12 @@ SubtreeChange::SubtreeChange(const SubtreeChange& _aObj, DeepChildCopy)
// -----------------------------------------------------------------------------
std::auto_ptr<Change> SubtreeChange::clone() const
{
- return std::auto_ptr<Change>(new SubtreeChange(*this, DeepChildCopy()));
+ return std::auto_ptr<Change>(new SubtreeChange(*this, treeop::DeepChildCopy()));
}
//--------------------------------------------------------------------------
void SubtreeChange::addChange(std::auto_ptr<Change> aChange)
{
- OUString aNodeName(aChange->getNodeName());
+ rtl::OUString aNodeName(aChange->getNodeName());
m_aChanges.find(aNodeName);
OSL_ENSURE(m_aChanges.end() == m_aChanges.find(aNodeName),
"SubtreeChange::addChange : overwriting an existent change !");
@@ -144,7 +144,7 @@ void SubtreeChange::addChange(std::auto_ptr<Change> aChange)
}
//--------------------------------------------------------------------------
-::std::auto_ptr<Change> SubtreeChange::removeChange(OUString const& _rName)
+::std::auto_ptr<Change> SubtreeChange::removeChange(rtl::OUString const& _rName)
{
Children::iterator aIter = m_aChanges.find(_rName);
@@ -158,13 +158,13 @@ void SubtreeChange::addChange(std::auto_ptr<Change> aChange)
}
//--------------------------------------------------------------------------
-Change* SubtreeChange::getChange(OUString const& _rName)
+Change* SubtreeChange::getChange(rtl::OUString const& _rName)
{
return doGetChild(_rName);
}
//--------------------------------------------------------------------------
-Change const* SubtreeChange::getChange(OUString const& _rName) const
+Change const* SubtreeChange::getChange(rtl::OUString const& _rName) const
{
return doGetChild(_rName);
}
@@ -202,17 +202,17 @@ void SubtreeChange::forEachChange(ChangeTreeModification& _anAction)
}
//--------------------------------------------------------------------------
-Change* SubtreeChange::doGetChild(OUString const& _rName) const
+Change* SubtreeChange::doGetChild(rtl::OUString const& _rName) const
{
Children::const_iterator aIter = m_aChanges.find(_rName);
return (aIter != m_aChanges.end()) ? aIter->second : NULL;
}
//--------------------------------------------------------------------------
-uno::Sequence< OUString > SubtreeChange::elementNames() const
+uno::Sequence< rtl::OUString > SubtreeChange::elementNames() const
{
- uno::Sequence< OUString > aReturn(size());
- OUString* pReturn = aReturn.getArray();
+ uno::Sequence< rtl::OUString > aReturn(size());
+ rtl::OUString* pReturn = aReturn.getArray();
for ( Children::const_iterator aCollector = m_aChanges.begin();
aCollector != m_aChanges.end();
@@ -314,21 +314,19 @@ bool operator==(SubtreeChange::ChildIterator const& lhs, SubtreeChange::ChildIte
//==========================================================================
//--------------------------------------------------------------------------
SubtreeChangeReferrer::SubtreeChangeReferrer(const SubtreeChange& _rSource)
- :SubtreeChange(_rSource, SubtreeChange::NoChildCopy())
+ :SubtreeChange(_rSource, treeop::NoChildCopy())
{
ChildIterator aSourceChildren = _rSource.begin();
while (aSourceChildren != _rSource.end())
{
const Change* pChange = &*aSourceChildren;
OSL_ENSURE(pChange, "SubtreeChangeReferrer::SubtreeChangeReferrer : invalid change !");
- if ( pChange->isA(ValueChange::getStaticType())
- || pChange->isA(RemoveNode::getStaticType())
- || pChange->isA(AddNode::getStaticType())
- )
+ if (dynamic_cast< ValueChange const * >(pChange) != 0 ||
+ dynamic_cast< RemoveNode const * >(pChange) != 0 ||
+ dynamic_cast< AddNode const * >(pChange) != 0)
SubtreeChange::addChange(::std::auto_ptr<Change>(const_cast<Change*>(pChange)));
- else if ( pChange->isA(SubtreeChange::getStaticType())
- || pChange->isA(SubtreeChangeReferrer::getStaticType())
- )
+ else if (dynamic_cast< SubtreeChange const * >(pChange) != 0 ||
+ dynamic_cast< SubtreeChangeReferrer const * >(pChange) != 0)
{
SubtreeChange::addChange(::std::auto_ptr<Change>(new SubtreeChangeReferrer(*static_cast<const SubtreeChange*>(pChange))));
}
@@ -350,17 +348,15 @@ SubtreeChangeReferrer::~SubtreeChangeReferrer()
const Change* pChange = aChildren->second;
Children::iterator aCurrent = aChildren++;
- if ( pChange->isA(ValueChange::getStaticType())
- || pChange->isA(RemoveNode::getStaticType())
- || pChange->isA(AddNode::getStaticType())
- )
+ if (dynamic_cast< ValueChange const * >(pChange) != 0 ||
+ dynamic_cast< RemoveNode const * >(pChange) != 0 ||
+ dynamic_cast< AddNode const * >(pChange) != 0)
{
// we just hold references to the non-SubtreeChange-objects, so don't delete them
m_aChanges.erase(aCurrent);
}
- else if ( pChange->isA(SubtreeChange::getStaticType())
- || pChange->isA(SubtreeChangeReferrer::getStaticType())
- )
+ else if (dynamic_cast< SubtreeChange const * >(pChange) != 0 ||
+ dynamic_cast< SubtreeChangeReferrer const * >(pChange) != 0)
{
// nothing to do
}
diff --git a/configmgr/source/tree/localizedtreeactions.cxx b/configmgr/source/tree/localizedtreeactions.cxx
index bb7111aacb..331cd5d15c 100644
--- a/configmgr/source/tree/localizedtreeactions.cxx
+++ b/configmgr/source/tree/localizedtreeactions.cxx
@@ -36,7 +36,6 @@
#include "localizedtreeactions.hxx"
#include "treeactions.hxx"
#include "builddata.hxx"
-#include "treeaccessor.hxx"
#include "subtree.hxx"
#include "matchlocale.hxx"
#include "typeconverter.hxx"
@@ -54,7 +53,6 @@ namespace configmgr
//--------------------------------------------------------------------------
namespace
{
- using localehelper::FindBestLocale;
//--------------------------------------------------------------------------
//==========================================================================
//= OCloneForLocale
@@ -67,7 +65,7 @@ namespace
rtl::OUString m_sTargetLocale;
std::auto_ptr<INode> m_pClone;
public:
- OCloneForLocale(OUString const& aLocale) : m_sTargetLocale(aLocale) {}
+ OCloneForLocale(rtl::OUString const& aLocale) : m_sTargetLocale(aLocale) {}
std::auto_ptr<INode> getResult() { return m_pClone; }
private:
@@ -78,9 +76,9 @@ namespace
struct OCloneChildrenForLocale : NodeAction
{
ISubtree& m_rParent;
- FindBestLocale& m_rLocaleMatcher;
+ localehelper::FindBestLocale& m_rLocaleMatcher;
public:
- OCloneChildrenForLocale(ISubtree& _rParent, FindBestLocale& _rLocaleMatcher)
+ OCloneChildrenForLocale(ISubtree& _rParent, localehelper::FindBestLocale& _rLocaleMatcher)
: m_rParent(_rParent)
, m_rLocaleMatcher(_rLocaleMatcher)
{}
@@ -93,9 +91,9 @@ namespace
struct OSelectForLocale : NodeAction
{
ValueNode const* m_pFound;
- FindBestLocale& m_rLocaleMatcher;
+ localehelper::FindBestLocale& m_rLocaleMatcher;
public:
- OSelectForLocale(FindBestLocale& _rLocaleMatcher)
+ OSelectForLocale(localehelper::FindBestLocale& _rLocaleMatcher)
: m_pFound(NULL)
, m_rLocaleMatcher(_rLocaleMatcher)
{}
@@ -137,7 +135,7 @@ namespace
//--------------------------------------------------------------------------
//--------------------------------------------------------------------------
- std::auto_ptr< INode > implReduceLocalizedSet(ISubtree const& _aSubtree, FindBestLocale& _rLocaleMatcher)
+ std::auto_ptr< INode > implReduceLocalizedSet(ISubtree const& _aSubtree, localehelper::FindBestLocale& _rLocaleMatcher)
{
// -- find the best-match locale -----------------------------
_rLocaleMatcher.reset();
@@ -188,7 +186,7 @@ namespace
return pResult;
}
//--------------------------------------------------------------------------
- std::auto_ptr< INode > implCloneForLocale(ISubtree const& _aSubtree, FindBestLocale& _rLocaleMatcher)
+ std::auto_ptr< INode > implCloneForLocale(ISubtree const& _aSubtree, localehelper::FindBestLocale& _rLocaleMatcher)
{
std::auto_ptr< INode > pClone;
@@ -199,7 +197,7 @@ namespace
else
{
// ISubtree should get a clone(NoChildCopy) member ...
- std::auto_ptr< Subtree > pCloneTree( new Subtree(_aSubtree, Subtree::NoChildCopy()) );
+ std::auto_ptr< Subtree > pCloneTree( new Subtree(_aSubtree, treeop::NoChildCopy()) );
OCloneChildrenForLocale aSubCloner(*pCloneTree,_rLocaleMatcher);
@@ -245,7 +243,7 @@ namespace
//--------------------------------------------------------------------------
void OCloneForLocale::handle(ISubtree const& _aSubtree)
{
- FindBestLocale aLocaleMatcher( localehelper::makeLocale(m_sTargetLocale) );
+ localehelper::FindBestLocale aLocaleMatcher( localehelper::makeLocale(m_sTargetLocale) );
m_pClone = implCloneForLocale(_aSubtree,aLocaleMatcher);
}
@@ -258,13 +256,11 @@ namespace
// Helper function to invoke the previous ones properly
// convert to the given locale format, assuming the original representation was expanded
-static std::auto_ptr<INode> impl_cloneExpandedForLocale(INode const* _pNode, OUString const& _sLocale)
+static std::auto_ptr<INode> impl_cloneExpandedForLocale(INode const* _pNode, rtl::OUString const& _sLocale)
{
- using namespace localehelper;
-
OSL_ASSERT(_pNode != NULL);
- if ( designatesAllLocales(makeLocale(_sLocale)) ) // from expanded to expanded
+ if ( localehelper::designatesAllLocales(localehelper::makeLocale(_sLocale)) ) // from expanded to expanded
{
return _pNode->clone();
}
@@ -279,57 +275,38 @@ static std::auto_ptr<INode> impl_cloneExpandedForLocale(INode const* _pNode, OUS
//--------------------------------------------------------------------------
// convert to the given locale format, assuming the original representation was expanded
-static data::TreeSegment old_cloneExpandedForLocale(OUString const& _sName, INode const* _pNode, OUString const& _sLocale)
+static rtl::Reference< data::TreeSegment > old_cloneExpandedForLocale(rtl::OUString const& _sName, INode const* _pNode, rtl::OUString const& _sLocale)
{
- using data::TreeSegment;
-
if (_pNode == NULL)
- return TreeSegment();
+ return rtl::Reference< data::TreeSegment >();
std::auto_ptr<INode> aResult;
- if ( !_pNode->ISA( ISubtree ) ) // simple value - nothing to reduce
+ if (dynamic_cast< ISubtree const * >(_pNode) == 0) // simple value - nothing to reduce
aResult = _pNode->clone();
else
aResult = impl_cloneExpandedForLocale(_pNode,_sLocale);
- return TreeSegment::createNew(_sName,aResult);
+ return data::TreeSegment::create(_sName,aResult);
}
//--------------------------------------------------------------------------
// -----------------------------------------------------------------------------
//--------------------------------------------------------------------------
-data::TreeSegment cloneExpandedForLocale(data::TreeAccessor const & _aTree, OUString const& _sLocale)
-{
- std::auto_ptr<INode> aOldTree = data::convertTree(_aTree,true);
-
- return old_cloneExpandedForLocale(_aTree.getName().toString(), aOldTree.get(),_sLocale);
-}
-// -----------------------------------------------------------------------------
-//--------------------------------------------------------------------------
-/*
-// convert to the given locale format, assuming the original representation was expanded
-data::TreeSegment cloneExpandedForLocale(ISubtree const* _pNode, OUString const& _sLocale)
+rtl::Reference< data::TreeSegment > cloneExpandedForLocale(sharable::TreeFragment * tree, rtl::OUString const& _sLocale)
{
- using data::TreeSegment;
-
- if (_pNode == NULL)
- return TreeSegment();
+ std::auto_ptr<INode> aOldTree = data::convertTree(tree, true);
- else
- return TreeSegment::createNew(impl_cloneExpandedForLocale(_pNode,_sLocale));
+ return old_cloneExpandedForLocale(tree->getName(), aOldTree.get(), _sLocale);
}
//--------------------------------------------------------------------------
-*/
// convert to the given locale format, assuming the original representation was expanded
-std::auto_ptr<INode> reduceExpandedForLocale(std::auto_ptr<ISubtree> _pNode, OUString const& _sLocale)
+std::auto_ptr<INode> reduceExpandedForLocale(std::auto_ptr<ISubtree> _pNode, rtl::OUString const& _sLocale)
{
- using namespace localehelper;
-
std::auto_ptr<INode> aResult;
if ( _pNode.get() == NULL || // nothing to reduce
- designatesAllLocales(makeLocale(_sLocale)) ) // from expanded to expanded
+ localehelper::designatesAllLocales(localehelper::makeLocale(_sLocale)) ) // from expanded to expanded
{
aResult.reset( _pNode.release() );
}
@@ -351,9 +328,9 @@ namespace
class ExpandTreeForLocale : NodeModification
{
ISubtree & m_rParent;
- OUString const & m_aSourceLocale;
+ rtl::OUString const & m_aSourceLocale;
- ExpandTreeForLocale(ISubtree & _rParent,OUString const & _aSourceLocale)
+ ExpandTreeForLocale(ISubtree & _rParent,rtl::OUString const & _aSourceLocale)
: m_rParent(_rParent)
, m_aSourceLocale(_aSourceLocale)
{}
@@ -363,22 +340,22 @@ namespace
void substitute(std::auto_ptr<INode> _aExpanded);
public:
- static void expand(ISubtree& _rTree, OUString const & _aSourceLocale)
+ static void expand(ISubtree& _rTree, rtl::OUString const & _aSourceLocale)
{
ExpandTreeForLocale(_rTree,_aSourceLocale).applyToChildren(_rTree);
}
// returns NULL, if not a localized value
- static std::auto_ptr<ISubtree> expanded(ValueNode const& _aNode, OUString const & _aSourceLocale);
+ static std::auto_ptr<ISubtree> expanded(ValueNode const& _aNode, rtl::OUString const & _aSourceLocale);
};
//--------------------------------------------------------------------------
class ExpandChangesForLocale : ChangeTreeModification
{
SubtreeChange & m_rParent;
- OUString const & m_aSourceLocale;
+ rtl::OUString const & m_aSourceLocale;
- ExpandChangesForLocale(SubtreeChange & _rParent,OUString const & _aSourceLocale)
+ ExpandChangesForLocale(SubtreeChange & _rParent,rtl::OUString const & _aSourceLocale)
: m_rParent(_rParent)
, m_aSourceLocale(_aSourceLocale)
{}
@@ -391,13 +368,13 @@ namespace
void substitute(std::auto_ptr<Change> _aExpanded);
public:
- static void expand(SubtreeChange& _rTree, OUString const & _aSourceLocale)
+ static void expand(SubtreeChange& _rTree, rtl::OUString const & _aSourceLocale)
{
ExpandChangesForLocale(_rTree,_aSourceLocale).applyToChildren(_rTree);
}
// returns NULL, if not a localized value
- static std::auto_ptr<SubtreeChange> expanded(ValueChange const& _aNode, OUString const & _aSourceLocale);
+ static std::auto_ptr<SubtreeChange> expanded(ValueChange const& _aNode, rtl::OUString const & _aSourceLocale);
};
//--------------------------------------------------------------------------
inline
@@ -424,7 +401,7 @@ void ExpandTreeForLocale::handle(ValueNode& _rNode)
//--------------------------------------------------------------------------
-std::auto_ptr<ISubtree> ExpandTreeForLocale::expanded(ValueNode const& _aNode, OUString const & _aSourceLocale)
+std::auto_ptr<ISubtree> ExpandTreeForLocale::expanded(ValueNode const& _aNode, rtl::OUString const & _aSourceLocale)
{
if (!_aNode.isLocalized()) return std::auto_ptr<ISubtree>();
@@ -479,7 +456,8 @@ void ExpandChangesForLocale::handle(ValueChange& _rNode)
//--------------------------------------------------------------------------
void ExpandChangesForLocale::handle(AddNode& _rNode)
{
- std::auto_ptr<INode> pAdded = _rNode.getNewTree().cloneData(false);
+ rtl::Reference< data::TreeSegment > seg(_rNode.getNewTree());
+ std::auto_ptr<INode> pAdded(data::convertTree(seg.is() ? seg->fragment : 0, false));
if (pAdded.get() != NULL)
{
std::auto_ptr<INode> pExpanded;
@@ -498,7 +476,7 @@ void ExpandChangesForLocale::handle(AddNode& _rNode)
if (pExpanded.get())
{
- data::TreeSegment aExpanded = data::TreeSegment::createNew( _rNode.getNodeName(),pExpanded);
+ rtl::Reference< data::TreeSegment > aExpanded = data::TreeSegment::create( _rNode.getNodeName(),pExpanded);
std::auto_ptr<AddNode> aExpandedAdd( new AddNode( aExpanded, _rNode.getNodeName(), _rNode.isToDefault() ) );
if (_rNode.isReplacing()) aExpandedAdd->setReplacing();
@@ -517,7 +495,7 @@ void ExpandChangesForLocale::handle(RemoveNode& )
}
//--------------------------------------------------------------------------
-std::auto_ptr<SubtreeChange> ExpandChangesForLocale::expanded(ValueChange const& _aNode, OUString const & _aSourceLocale)
+std::auto_ptr<SubtreeChange> ExpandChangesForLocale::expanded(ValueChange const& _aNode, rtl::OUString const & _aSourceLocale)
{
std::auto_ptr<SubtreeChange> aRet;
if (_aNode.isLocalizedValue())
@@ -532,13 +510,13 @@ std::auto_ptr<SubtreeChange> ExpandChangesForLocale::expanded(ValueChange const&
aValueAttributes.setState( node::isReplaced );
- OUString const sTemplateName = toTemplateName(_aNode.getValueType());
+ rtl::OUString const sTemplateName = toTemplateName(_aNode.getValueType());
std::auto_ptr<ValueNode> aValue = _aNode.getNewValue().hasValue()
? rNodeFactory.createValueNode(sTemplateName,_aNode.getNewValue(),aValueAttributes)
: rNodeFactory.createNullValueNode(sTemplateName,_aNode.getValueType(),aValueAttributes);
- data::TreeSegment aValueSegment = data::TreeSegment::createNew(_aSourceLocale, base_ptr(aValue));
+ rtl::Reference< data::TreeSegment > aValueSegment = data::TreeSegment::create(_aSourceLocale, base_ptr(aValue));
std::auto_ptr<AddNode> aAddValue = rFactory.createAddNodeChange(aValueSegment,_aSourceLocale,_aNode.isToDefault());
aAddValue->setReplacing();
diff --git a/configmgr/source/tree/makefile.mk b/configmgr/source/tree/makefile.mk
index fc6b8bbcf8..019b3cc17f 100644
--- a/configmgr/source/tree/makefile.mk
+++ b/configmgr/source/tree/makefile.mk
@@ -52,8 +52,6 @@ SLOFILES=\
$(SLO)$/treefragment.obj \
$(SLO)$/treesegment.obj \
$(SLO)$/nodevisitor.obj \
- $(SLO)$/nodeaccess.obj \
- $(SLO)$/valuenodeaccess.obj \
$(SLO)$/changes.obj \
$(SLO)$/treenodefactory.obj \
$(SLO)$/treechangefactory.obj \
diff --git a/configmgr/source/tree/mergehelper.cxx b/configmgr/source/tree/mergehelper.cxx
index 8916577ae6..d137032a43 100644
--- a/configmgr/source/tree/mergehelper.cxx
+++ b/configmgr/source/tree/mergehelper.cxx
@@ -33,8 +33,9 @@
#include <stdio.h>
+#include "builddata.hxx"
#include "nodeconverter.hxx"
-#include "treeprovider.hxx"
+#include "treefragment.hxx"
#include "treenodefactory.hxx"
#include "treechangefactory.hxx"
#include "configpath.hxx"
@@ -89,7 +90,7 @@ private:
bool impl_cleanup(SubtreeChange& _aUpdateTree);
void add(std::auto_ptr<Change> _pChange);
- void addReplacedNode(data::TreeSegment const & _aReplacedTree);
+ void addReplacedNode(rtl::Reference< data::TreeSegment > const & _aReplacedTree);
void addReplacedNode(std::auto_ptr<INode> _aReplacedNode);
};
@@ -172,7 +173,7 @@ inline void OCleanupLayerAction::add(std::auto_ptr<Change> _aChange)
//--------------------------------------------------------------------------
void OCleanupLayerAction::handle(ValueChange& _rChange)
{
- OUString const sNodeName = _rChange.getNodeName();
+ rtl::OUString const sNodeName = _rChange.getNodeName();
OSL_ENSURE(!_rChange.isToDefault(),"Found change to default in layer being merged");
@@ -211,7 +212,7 @@ void OCleanupLayerAction::handle(ValueChange& _rChange)
//--------------------------------------------------------------------------
void OCleanupLayerAction::handle(SubtreeChange& _rChange)
{
- OUString const sNodeName = _rChange.getNodeName();
+ rtl::OUString const sNodeName = _rChange.getNodeName();
OSL_ENSURE(!_rChange.isToDefault(),"Found change to default in layer being merged");
@@ -232,7 +233,7 @@ void OCleanupLayerAction::handle(SubtreeChange& _rChange)
if (pTargetTree)
{
// generate a new change
- std::auto_ptr<SubtreeChange> pResult( new SubtreeChange(_rChange, SubtreeChange::NoChildCopy()) );
+ std::auto_ptr<SubtreeChange> pResult( new SubtreeChange(_rChange, treeop::NoChildCopy()) );
// recurse
if ( adjust(*pResult,_rChange,*pTargetTree,m_aNodeConverter.nodeFactory()) )
@@ -258,7 +259,7 @@ void OCleanupLayerAction::handle(SubtreeChange& _rChange)
//--------------------------------------------------------------------------
void OCleanupLayerAction::handle(RemoveNode& _rChange)
{
- OUString const sNodeName = _rChange.getNodeName();
+ rtl::OUString const sNodeName = _rChange.getNodeName();
OSL_ENSURE(!_rChange.isToDefault(),"Found change to default in layer being merged");
@@ -296,19 +297,19 @@ void OCleanupLayerAction::addReplacedNode(std::auto_ptr<INode> _aReplacedNode)
OSL_ASSERT(_aReplacedNode.get());
- OUString sTypeName = m_rTargetTree.getElementTemplateName();
+ rtl::OUString sTypeName = m_rTargetTree.getElementTemplateName();
- this->addReplacedNode( data::TreeSegment::createNew(_aReplacedNode,sTypeName) );
+ this->addReplacedNode( data::TreeSegment::create(_aReplacedNode,sTypeName) );
}
//--------------------------------------------------------------------------
-void OCleanupLayerAction::addReplacedNode(data::TreeSegment const & _aReplacedTree)
+void OCleanupLayerAction::addReplacedNode(rtl::Reference< data::TreeSegment > const & _aReplacedTree)
{
OSL_ENSURE(m_rTargetTree.isSetNode(),"Found replaced node for non-set-element in layer being merged");
OSL_ASSERT(_aReplacedTree.is());
- OUString sNodeName = _aReplacedTree.getName().toString();
+ rtl::OUString sNodeName = _aReplacedTree->fragment->getName();
// add the tree to the change list
std::auto_ptr<AddNode> pResult( new AddNode(_aReplacedTree,sNodeName, false) );
@@ -349,7 +350,7 @@ void MergeLayerToTree::handle(ValueChange& _rChange)
{
OSL_ENSURE(!_rChange.isToDefault(),"Layer merge: Found change to default - cleanup broken");
- OUString const sNodeName = _rChange.getNodeName();
+ rtl::OUString const sNodeName = _rChange.getNodeName();
INode * const pTargetNode = m_rTree.getChild(sNodeName);
@@ -372,7 +373,7 @@ void MergeLayerToTree::handle(ValueChange& _rChange)
void MergeLayerToTree::handle(AddNode& _rChange)
{
- OUString const sNodeName = _rChange.getNodeName();
+ rtl::OUString const sNodeName = _rChange.getNodeName();
node::State eNodeState = node::isAdded;
@@ -384,12 +385,12 @@ void MergeLayerToTree::handle(AddNode& _rChange)
OSL_ENSURE( !m_rTree.getChild(sNodeName),"Layer merge: Found conflicting data on insert - cleanup broken");
- data::TreeSegment aAddedTree = _rChange.getNewTree();
+ rtl::Reference< data::TreeSegment > aAddedTree = _rChange.getNewTree();
- OSL_ENSURE( aAddedTree.is(),"Layer merge: Found empty data on insert - cleanup broken");
+ OSL_ENSURE(aAddedTree.is(), "Layer merge: Found empty data on insert - cleanup broken");
// clean up the attributes of the added node
- data::TreeSegment::RawTreeData aAddedData = aAddedTree.cloneData(true);
+ std::auto_ptr<INode> aAddedData(data::convertTree(aAddedTree->fragment, true));
AttributeSetter(eNodeState,false).applyToNode(*aAddedData);
@@ -399,7 +400,7 @@ void MergeLayerToTree::handle(AddNode& _rChange)
void MergeLayerToTree::handle(RemoveNode& _rChange)
{
- OUString const sNodeName = _rChange.getNodeName();
+ rtl::OUString const sNodeName = _rChange.getNodeName();
// should have such a node when removing
OSL_VERIFY( m_rTree.removeChild(sNodeName).get() );
@@ -411,7 +412,7 @@ void MergeLayerToTree::handle(SubtreeChange& _rChange)
{
OSL_ENSURE(!_rChange.isToDefault(),"Layer merge: Found change to default - cleanup broken");
- OUString const sNodeName = _rChange.getNodeName();
+ rtl::OUString const sNodeName = _rChange.getNodeName();
INode * const pTargetNode = m_rTree.getChild(sNodeName);
diff --git a/configmgr/source/tree/node.cxx b/configmgr/source/tree/node.cxx
index c292cec937..3ba3a0b9a6 100644
--- a/configmgr/source/tree/node.cxx
+++ b/configmgr/source/tree/node.cxx
@@ -31,11 +31,11 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_configmgr.hxx"
-#include "types.hxx"
#include "node.hxx"
#include "anydata.hxx"
#include "treefragment.hxx"
#include "attributes.hxx"
+#include "utility.hxx"
#include <rtl/ustring.hxx>
#include <com/sun/star/uno/Any.hxx>
@@ -51,14 +51,9 @@ namespace configmgr
{
//-----------------------------------------------------------------------------
-// Name name;
- // Offset parent; // always counts backwards
- // Flags::Field flags;
- // Type ::Field type; // contains discriminator for union
-
rtl::OUString NodeInfo::getName() const
{
- return readName(this->name);
+ return rtl::OUString(this->name);
}
//-----------------------------------------------------------------------------
@@ -66,15 +61,15 @@ configmgr::node::Attributes NodeInfo::getNodeInfoAttributes() const
{
configmgr::node::Attributes aResult;
- bool help = !!(flags & Flags::readonly);
- aResult.setAccess( help,!!(flags & Flags::finalized) );
-// aResult.setAccess( !!(flags & Flags::readonly),!!(flags & Flags::finalized) );
+ bool help = !!(flags & data::Flags::readonly);
+ aResult.setAccess( help,!!(flags & data::Flags::finalized) );
+// aResult.setAccess( !!(flags & data::Flags::readonly),!!(flags & data::Flags::finalized) );
- aResult.setNullable(!!(flags & Flags::nullable));
- aResult.setLocalized(!!(flags & Flags::localized));
+ aResult.setNullable(!!(flags & data::Flags::nullable));
+ aResult.setLocalized(!!(flags & data::Flags::localized));
- configmgr::node::State state = (flags & Flags::defaulted) ? configmgr::node::isDefault :
- (flags & Flags::defaultable) ? configmgr::node::isMerged :
+ configmgr::node::State state = (flags & data::Flags::defaulted) ? configmgr::node::isDefault :
+ (flags & data::Flags::defaultable) ? configmgr::node::isMerged :
configmgr::node::isReplaced;
aResult.setState(state);
@@ -84,13 +79,13 @@ configmgr::node::Attributes NodeInfo::getNodeInfoAttributes() const
bool NodeInfo::isDefault() const
{
- return !!(this->flags & Flags::defaulted);
+ return !!(this->flags & data::Flags::defaulted);
}
//-----------------------------------------------------------------------------
bool NodeInfo::isLocalized() const
{
- return !!(this->flags & Flags::localized);
+ return !!(this->flags & data::Flags::localized);
}
//-----------------------------------------------------------------------------
@@ -98,11 +93,11 @@ void NodeInfo::markAsDefault(bool bDefault)
{
if (bDefault)
{
- OSL_ENSURE(flags & Flags::defaultable,"Marking a non-defaultable node as default");
- this->flags |= Flags::defaulted;
+ OSL_ENSURE(flags & data::Flags::defaultable,"Marking a non-defaultable node as default");
+ this->flags |= data::Flags::defaulted;
}
else
- this->flags &= ~Flags::defaulted;
+ this->flags &= ~data::Flags::defaulted;
}
//-----------------------------------------------------------------------------
@@ -126,22 +121,15 @@ bool GroupNode::hasDefaultsAvailable() const
}
//-----------------------------------------------------------------------------
-Node * GroupNode::getFirstChild()
-{
- OSL_ENSURE(numDescendants, "Groups MUST have at least one child");
- return node(this) + 1;
-}
-//-----------------------------------------------------------------------------
-
-Node const * GroupNode::getFirstChild() const
+Node * GroupNode::getFirstChild() const
{
OSL_ENSURE(numDescendants, "Groups MUST have at least one child");
- return node(this) + 1;
+ return const_cast< Node * >(node(this) + 1);
}
//-----------------------------------------------------------------------------
static
-Offset implGetNextChildOffset(GroupNode const * _pParent, Node const * _pChild)
+sal_uInt16 implGetNextChildOffset(GroupNode const * _pParent, Node const * _pChild)
{
OSL_PRECOND(_pChild, "getNextChild: previous child must not be NULL");
OSL_PRECOND(_pChild->getParentNode() == node(_pParent), "getNextChild: not a child of this node");
@@ -151,15 +139,15 @@ Offset implGetNextChildOffset(GroupNode const * _pParent, Node const * _pChild)
"getNextChild: child out of descendants range");
// offset to child's next sibling
- Offset next = 1;
+ sal_uInt16 next = 1;
if ( _pChild->isGroup())
{
next = next + _pChild->group.numDescendants;
}
- if (_pChild->node.info.parent + next > _pParent->numDescendants)
+ if (_pChild->info.parent + next > _pParent->numDescendants)
{
- OSL_ENSURE(_pChild->node.info.parent + next == _pParent->numDescendants+1, "Next child candidate should match next sibling here");
+ OSL_ENSURE(_pChild->info.parent + next == _pParent->numDescendants+1, "Next child candidate should match next sibling here");
return 0;
}
@@ -168,71 +156,67 @@ Offset implGetNextChildOffset(GroupNode const * _pParent, Node const * _pChild)
}
//-----------------------------------------------------------------------------
-Node * GroupNode::getNextChild(Node * _pChild)
+Node * GroupNode::getNextChild(Node * _pChild) const
{
- if (Offset next = implGetNextChildOffset(this, _pChild))
+ if (sal_uInt16 next = implGetNextChildOffset(this, _pChild))
return _pChild + next;
else
return NULL;
}
-//-----------------------------------------------------------------------------
-
-Node const * GroupNode::getNextChild(Node const * _pChild) const
-{
- if (Offset next = implGetNextChildOffset(this, _pChild))
- return _pChild + next;
- else
- return NULL;
+Node * GroupNode::getChild(rtl::OUString const & name) const {
+ for (Node * child = getFirstChild(); child != 0;
+ child = getNextChild(child))
+ {
+ if (child->isNamed(name)) {
+ return child;
+ }
+ }
+ return 0;
}
-//-----------------------------------------------------------------------------
-bool SetNode::isLocalizedValue() const
-{
- return info.isLocalized();
-}
//-----------------------------------------------------------------------------
// TODO: optimize this - keep a list of such structs ....
struct SetNodeTemplateData
{
- Name name;
- Name module;
+ rtl_uString * name;
+ rtl_uString * module;
};
//-----------------------------------------------------------------------------
static inline
-SetNodeTemplateData * readTemplateData(SetElementAddress _aTemplateData)
+SetNodeTemplateData * readTemplateData(sal_uInt8 * _aTemplateData)
{
return reinterpret_cast<SetNodeTemplateData *>( _aTemplateData );
}
//-----------------------------------------------------------------------------
-SetElementAddress SetNode::allocTemplateData(const rtl::OUString &rName,
+sal_uInt8 * SetNode::allocTemplateData(const rtl::OUString &rName,
const rtl::OUString &rModule)
{
SetNodeTemplateData * pData = new SetNodeTemplateData();
OSL_ENSURE(pData, "Creating template data: unexpected NULL data");
- pData->name = allocName(rName);
- pData->module = allocName(rModule);
+ pData->name = acquireString(rName);
+ pData->module = acquireString(rModule);
- return reinterpret_cast<SetElementAddress>( pData );
+ return reinterpret_cast<sal_uInt8 *>( pData );
}
-SetElementAddress SetNode::copyTemplateData(SetElementAddress _aTemplateData)
+sal_uInt8 * SetNode::copyTemplateData(sal_uInt8 * _aTemplateData)
{
SetNodeTemplateData const * pData = readTemplateData(_aTemplateData);
OSL_ENSURE(pData, "Copying template data: unexpected NULL data");
- return allocTemplateData(readName(pData->name), readName(pData->module));
+ return allocTemplateData(rtl::OUString(pData->name), rtl::OUString(pData->module));
}
//-----------------------------------------------------------------------------
-void SetNode::releaseTemplateData(SetElementAddress _aTemplateData)
+void SetNode::releaseTemplateData(sal_uInt8 * _aTemplateData)
{
if (!_aTemplateData) return;
@@ -240,8 +224,8 @@ void SetNode::releaseTemplateData(SetElementAddress _aTemplateData)
OSL_ENSURE(pData, "Freeing template data: unexpected NULL data");
- freeName(pData->name);
- freeName(pData->module);
+ rtl_uString_release(pData->name);
+ rtl_uString_release(pData->module);
delete pData;
}
@@ -254,7 +238,7 @@ rtl::OUString SetNode::getElementTemplateName() const
OSL_ENSURE(pData, "ERROR: No template data found for set");
- return readName(pData->name);
+ return rtl::OUString(pData->name);
}
//-----------------------------------------------------------------------------
@@ -264,24 +248,24 @@ rtl::OUString SetNode::getElementTemplateModule() const
OSL_ENSURE(pData, "ERROR: No template data found for set");
- return readName(pData->module);
+ return rtl::OUString(pData->module);
}
//-----------------------------------------------------------------------------
static inline
-TreeFragment const * implGetFragmentFromList(List _aListEntry)
+TreeFragment * implGetFragmentFromList(TreeFragment * _aListEntry)
{
- return reinterpret_cast<TreeFragment const *>(_aListEntry);
+ return reinterpret_cast<TreeFragment *>(_aListEntry);
}
//-----------------------------------------------------------------------------
-TreeFragment const * SetNode::getFirstElement() const
+TreeFragment * SetNode::getFirstElement() const
{
return implGetFragmentFromList(this->elements);
}
//-----------------------------------------------------------------------------
-TreeFragment const * SetNode::getNextElement(TreeFragment const * _pElement) const
+TreeFragment * SetNode::getNextElement(TreeFragment * _pElement) const
{
OSL_PRECOND(_pElement, "getNextElement: previous element must not be NULL");
OSL_PRECOND(_pElement->header.parent == (Node *)this,
@@ -289,13 +273,47 @@ TreeFragment const * SetNode::getNextElement(TreeFragment const * _pElement) co
return implGetFragmentFromList(_pElement->header.next);
}
+
+TreeFragment * SetNode::getElement(rtl::OUString const & name) const {
+ for (TreeFragment * element = getFirstElement(); element != 0;
+ element = getNextElement(element))
+ {
+ if (element->isNamed(name)) {
+ return element;
+ }
+ }
+ return 0;
+}
+
+void SetNode::addElement(TreeFragment * newElement) {
+ OSL_ASSERT(newElement != 0);
+ newElement->header.next = elements;
+ newElement->header.parent = node(this);
+ elements = newElement;
+}
+
+TreeFragment * SetNode::removeElement(rtl::OUString const & name) {
+ for (TreeFragment ** link = &elements; *link != 0;
+ link = &(*link)->header.next)
+ {
+ if ((*link)->isNamed(name)) {
+ TreeFragment * removed = *link;
+ *link = removed->header.next;
+ removed->header.next = 0;
+ removed->header.parent = 0;
+ return removed;
+ }
+ }
+ return 0;
+}
+
//-----------------------------------------------------------------------------
bool ValueNode::isNull() const
{
- Flags::Type availmask = (info.flags & Flags::defaulted) ?
- Flags::defaultAvailable :
- Flags::valueAvailable;
+ data::Flags::Type availmask = (info.flags & data::Flags::defaulted) ?
+ data::Flags::defaultAvailable :
+ data::Flags::valueAvailable;
return !(info.flags & availmask);
}
@@ -303,22 +321,22 @@ bool ValueNode::isNull() const
bool ValueNode::hasUsableDefault() const
{
- return (info.flags & Flags::defaultable) &&
- (info.flags & (Flags::defaultAvailable| Flags::nullable));
+ return (info.flags & data::Flags::defaultable) &&
+ (info.flags & (data::Flags::defaultAvailable| data::Flags::nullable));
}
//-----------------------------------------------------------------------------
-uno::Type ValueNode::getValueType() const
+com::sun::star::uno::Type ValueNode::getValueType() const
{
- AnyData::TypeCode aType = AnyData::TypeCode( info.type & Type::mask_valuetype );
+ sal_uInt8 aType = sal_uInt8( info.type & data::Type::mask_valuetype );
return getUnoType(aType);
}
//-----------------------------------------------------------------------------
-uno::Any ValueNode::getValue() const
+com::sun::star::uno::Any ValueNode::getValue() const
{
- if (info.flags & Flags::defaulted)
+ if (info.flags & data::Flags::defaulted)
return getDefaultValue();
else
@@ -326,36 +344,93 @@ uno::Any ValueNode::getValue() const
}
//-----------------------------------------------------------------------------
-uno::Any ValueNode::getUserValue() const
+com::sun::star::uno::Any ValueNode::getUserValue() const
{
- if (info.flags & Flags::valueAvailable)
+ if (info.flags & data::Flags::valueAvailable)
{
- AnyData::TypeCode aType = AnyData::TypeCode( info.type & Type::mask_valuetype );
+ sal_uInt8 aType = sal_uInt8( info.type & data::Type::mask_valuetype );
return readData(aType,this->value);
}
else
- return uno::Any();
+ return com::sun::star::uno::Any();
}
//-----------------------------------------------------------------------------
-uno::Any ValueNode::getDefaultValue() const
+com::sun::star::uno::Any ValueNode::getDefaultValue() const
{
- if (info.flags & Flags::defaultAvailable)
+ if (info.flags & data::Flags::defaultAvailable)
{
- AnyData::TypeCode aType = AnyData::TypeCode( info.type & Type::mask_valuetype );
+ sal_uInt8 aType = sal_uInt8( info.type & data::Type::mask_valuetype );
return readData(aType,this->defaultValue);
}
else
- return uno::Any();
+ return com::sun::star::uno::Any();
+}
+
+void ValueNode::setValue(com::sun::star::uno::Any const & newValue) {
+ releaseValue();
+ if (newValue.hasValue()) {
+ sal_uInt8 type = adaptType(newValue);
+ value = allocData(type, newValue);
+ info.flags |= data::Flags::valueAvailable;
+ }
+ info.flags &= ~data::Flags::defaulted;
+}
+
+void ValueNode::setToDefault() {
+ OSL_ASSERT(hasUsableDefault());
+ releaseValue();
+ info.flags |= data::Flags::defaulted;
+}
+
+void ValueNode::changeDefault(com::sun::star::uno::Any const & newDefault) {
+ sal_uInt8 type = static_cast< sal_uInt8 >(
+ info.type & data::Type::mask_valuetype);
+ if (info.flags & data::Flags::defaultAvailable) {
+ OSL_ASSERT(type != data::Type::value_any);
+ freeData(type, defaultValue);
+ defaultValue.data = 0;
+ info.flags &= ~data::Flags::defaultAvailable;
+ }
+ if (newDefault.hasValue()) {
+ type = adaptType(newDefault);
+ defaultValue = allocData(type, newDefault);
+ info.flags |= data::Flags::defaultAvailable;
+ }
+}
+
+void ValueNode::releaseValue() {
+ if ((info.flags & data::Flags::valueAvailable) != 0) {
+ sal_uInt8 type = static_cast< sal_uInt8 >(
+ info.type & data::Type::mask_valuetype);
+ OSL_ASSERT(type != data::Type::value_any);
+ freeData(type, value);
+ value.data = 0;
+ info.flags &= ~data::Flags::valueAvailable;
+ }
+}
+
+sal_uInt8 ValueNode::adaptType(com::sun::star::uno::Any const & newValue) {
+ sal_uInt8 newType = getTypeCode(newValue.getValueType());
+ OSL_ASSERT(newType != data::Type::value_any);
+ sal_uInt8 type = static_cast< sal_uInt8 >(
+ info.type & data::Type::mask_valuetype);
+ if (type == data::Type::value_any) {
+ type = static_cast< sal_uInt8 >(newType & data::Type::mask_valuetype);
+ info.type = (info.type & ~data::Type::mask_valuetype) | type;
+ }
+ OSL_ASSERT(newType == type);
+ return type;
}
+
//-----------------------------------------------------------------------------
bool Node::isNamed(rtl::OUString const & _aName) const
{
rtl_uString *pCmpData = _aName.pData;
- rtl_uString *pNodeData = node.info.name;
+ rtl_uString *pNodeData = info.name;
// Creating an OUString does rather expensive interlocking here.
if (pCmpData == pNodeData)
@@ -371,7 +446,7 @@ bool Node::isNamed(rtl::OUString const & _aName) const
rtl::OUString Node::getName() const
{
- return node.info.getName();
+ return info.getName();
}
//-----------------------------------------------------------------------------
@@ -383,39 +458,39 @@ configmgr::node::Attributes Node::getAttributes() const
}
else
{
- return node.info.getNodeInfoAttributes();
+ return info.getNodeInfoAttributes();
}
}
//-----------------------------------------------------------------------------
bool Node::isDefault() const
{
- return node.info.isDefault();
+ return info.isDefault();
}
//-----------------------------------------------------------------------------
bool Node::isFragmentRoot() const
{
- return ! node.info.parent;
+ return !info.parent;
}
#if OSL_DEBUG_LEVEL > 0
//-----------------------------------------------------------------------------
Node * Node::getParentNode()
{
- return node.info.parent ? this - node.info.parent : NULL;
+ return info.parent ? this - info.parent : NULL;
}
//-----------------------------------------------------------------------------
Node const * Node::getParentNode() const
{
- return node.info.parent ? this - node.info.parent : NULL;
+ return info.parent ? this - info.parent : NULL;
}
#endif
//-----------------------------------------------------------------------------
-static Offset getFragmentIndex(Node const * pNode)
+static sal_uInt16 getFragmentIndex(Node const * pNode)
{
- Offset result = 0;
- while (Offset step = pNode->node.info.parent)
+ sal_uInt16 result = 0;
+ while (sal_uInt16 step = pNode->info.parent)
{
result = result + step;
pNode -= step;
@@ -443,6 +518,18 @@ TreeFragment const * Node::getTreeFragment() const
return static_cast<TreeFragment const *>(pFrag);
}
+Node * Node::getSubnode(rtl::OUString const & name) {
+ if (isGroup()) {
+ return group.getChild(name);
+ } else if (isSet()) {
+ TreeFragment * element = set.getElement(name);
+ return element == 0 ? 0 : element->getRootNode();
+ } else {
+ OSL_ASSERT(false);
+ return 0;
+ }
+}
+
//-----------------------------------------------------------------------------
} // namespace sharable
//-----------------------------------------------------------------------------
diff --git a/configmgr/source/tree/nodeaccess.cxx b/configmgr/source/tree/nodeaccess.cxx
deleted file mode 100644
index e4f1887f30..0000000000
--- a/configmgr/source/tree/nodeaccess.cxx
+++ /dev/null
@@ -1,185 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: nodeaccess.cxx,v $
- * $Revision: 1.7 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General 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_configmgr.hxx"
-
-#include "nodeaccess.hxx"
-#include "treeaccessor.hxx"
-#include "setnodeaccess.hxx"
-#include "groupnodeaccess.hxx"
-#include "valuenodeaccess.hxx"
-#include <osl/diagnose.h>
-
-// -----------------------------------------------------------------------------
-
-namespace configmgr
-{
-// -----------------------------------------------------------------------------
- namespace data
- {
- // -------------------------------------------------------------------------
-
- NodeAccess getSubnode(NodeAccess const & _aParent, configuration::Name const & _aName)
- {
- if (GroupNodeAccess::isInstance(_aParent))
- {
- return GroupNodeAccess(_aParent).getChildNode(_aName);
- }
- else if (SetNodeAccess::isInstance(_aParent))
- {
- TreeAccessor aElement = SetNodeAccess(_aParent).getElementTree(_aName);
- return aElement != NULL ? aElement.getRootNode() : NodeAccess(NULL);
- }
- else
- {
- OSL_ENSURE( ValueNodeAccess::isInstance(_aParent),"ERROR: Unknown node type");
- OSL_ENSURE(!ValueNodeAccess::isInstance(_aParent),"ERROR: Trying to access child of value node");
- return NULL;
- }
- }
- // -------------------------------------------------------------------------
-
- NodeAddress getSubnodeAddress(NodeAddress const & _aNodeAddress, configuration::Name const & _aName)
- {
- return getSubnode( NodeAccess(_aNodeAddress), _aName );
- }
- // -------------------------------------------------------------------------
-
- SetNodeAddress toSetNodeAddress(NodeAddress const & _aNodeAddr)
- {
- SetNodeAccess aNodeAccess(_aNodeAddr);
- return aNodeAccess;
- }
-#if OSL_DEBUG_LEVEL > 0
- // -------------------------------------------------------------------------
-
- GroupNodeAddress toGroupNodeAddress(NodeAddress const & _aNodeAddr)
- {
- GroupNodeAccess aNodeAccess( _aNodeAddr );
- return aNodeAccess;
- }
-#endif
- // -------------------------------------------------------------------------
- // GroupNodeAccess ...
- // -------------------------------------------------------------------------
-
- NodeAddress GroupNodeAccess::implGetChild(configuration::Name const& _aName) const
- {
- using namespace sharable;
- rtl::OUString aNodeName = _aName.toString();
-
- GroupNode const & aNode = data();
- for (Node const * pChild = aNode.getFirstChild();
- pChild != NULL;
- pChild = aNode.getNextChild(pChild))
- {
- if (pChild->isNamed(aNodeName))
- {
- NodeAccess aChildNode(pChild);
- return aChildNode;
- }
- }
- return NodeAddress();
- }
-
- // -------------------------------------------------------------------------
- // SetNodeAccess ...
- // -------------------------------------------------------------------------
-
- TreeAddress SetNodeAccess::implGetElement(configuration::Name const& _aName) const
- {
- using namespace sharable;
- SetNode const & aNode = data();
- for (TreeFragment const * pElement = aNode.getFirstElement();
- pElement != NULL;
- pElement = aNode.getNextElement(pElement))
- {
- if (pElement->isNamed(_aName.toString()))
- return (TreeAddress)pElement;
- }
- return NULL;
- }
- // -------------------------------------------------------------------------*/
-
- void SetNodeAccess::addElement(SetNodeAddress _aSetAddress,
- ElementAddress _aNewElement)
- {
- using namespace sharable;
-
- SetNode * pNode = _aSetAddress;
- OSL_ENSURE(pNode, "ERROR: Trying to add an element to a NULL set node");
-
- // to do(?): insert sorted - find location here
- TreeFragment * pElement = _aNewElement;
- OSL_ENSURE(pElement, "ERROR: Trying to add a NULL element to a set node");
-
- pElement->header.next = pNode->elements;
- pElement->header.parent = reinterpret_cast<Node *>(pNode);
-
- pNode->elements = _aNewElement;
- }
- // -------------------------------------------------------------------------*/
-
- TreeAddress SetNodeAccess::removeElement(SetNodeAddress _aSetAddress,
- configuration::Name const & _aName)
- {
- using namespace sharable;
-
- SetNode * pNode = _aSetAddress;
- OSL_ENSURE(pNode, "ERROR: Trying to add an element to a NULL set node");
-
- TreeAddress aRemoved = NULL;
-
- List * pLink = & pNode->elements;
- while( TreeFragment * pElement = reinterpret_cast<TreeFragment *>(*pLink) )
- {
- if (pElement->isNamed(_aName.toString()))
- {
- aRemoved = *pLink;
-
- *pLink = pElement->header.next;
- pElement->header.next = 0;
- pElement->header.parent = 0;
-
- break;
- }
-
- pLink = & pElement->header.next;
- }
-
- return aRemoved;
- }
-
- }
-// -----------------------------------------------------------------------------
-} // namespace configmgr
-
-
diff --git a/configmgr/source/tree/nodeconverter.cxx b/configmgr/source/tree/nodeconverter.cxx
index 969a3047b0..0048263401 100644
--- a/configmgr/source/tree/nodeconverter.cxx
+++ b/configmgr/source/tree/nodeconverter.cxx
@@ -31,8 +31,7 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_configmgr.hxx"
-#include <stdio.h>
-
+#include "builddata.hxx"
#include "nodeconverter.hxx"
#include "treenodefactory.hxx"
#include <osl/diagnose.h>
@@ -153,7 +152,8 @@ void ONodeConverter::handle(ValueChange& aValueNode)
//--------------------------------------------------------------------------
void ONodeConverter::handle(AddNode& aAddNode)
{
- m_pNode = aAddNode.getNewTree().cloneData(true);
+ rtl::Reference< data::TreeSegment > seg(aAddNode.getNewTree());
+ m_pNode = data::convertTree(seg.is() ? seg->fragment : 0, true);
}
//--------------------------------------------------------------------------
@@ -199,8 +199,8 @@ void OCreateSubtreeAction::handle(RemoveNode& _rChange)
void OCreateSubtreeAction::handle(AddNode& _rChange)
{
// free the node and add it to the subtree
- data::TreeSegment aNewNode = _rChange.getNewTree();
- m_rTree.addChild(aNewNode.cloneData(true));
+ rtl::Reference< data::TreeSegment > aNewNode = _rChange.getNewTree();
+ m_rTree.addChild(data::convertTree(aNewNode.is() ? aNewNode->fragment : 0, true));
}
diff --git a/configmgr/source/tree/nodevisitor.cxx b/configmgr/source/tree/nodevisitor.cxx
index 5b85aa55db..1cda707125 100644
--- a/configmgr/source/tree/nodevisitor.cxx
+++ b/configmgr/source/tree/nodevisitor.cxx
@@ -1,7 +1,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2008 by Sun Microsystems, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -28,204 +28,80 @@
*
************************************************************************/
-// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_configmgr.hxx"
+#include "sal/config.h"
-#include "nodevisitor.hxx"
-#include "nodeaccess.hxx"
-#include "valuenodeaccess.hxx"
-#include "groupnodeaccess.hxx"
-#include "setnodeaccess.hxx"
-#include "treeaccessor.hxx"
-#include "valuenode.hxx"
-#include <osl/diagnose.h>
-
-// -----------------------------------------------------------------------------
-
-namespace configmgr
-{
-// -----------------------------------------------------------------------------
- namespace data
- {
-// -------------------------------------------------------------------------
-typedef NodeVisitor::Result Result;
-
-// -------------------------------------------------------------------------
- // -------------------------------------------------------------------------
- struct NodeVisitor::Dispatcher
- {
- NodeVisitor& m_target;
- Result m_result;
-
- Dispatcher(NodeVisitor& _rTarget)
- : m_target(_rTarget)
- , m_result(NodeVisitor::CONTINUE)
- {}
-
- void applyToNode(sharable::Node const & _aNode);
- void applyToChildren(sharable::GroupNode const & _aNode);
-
- Result dispatch(sharable::Node const& _aNode);
- };
-
- // -------------------------------------------------------------------------
- struct SetVisitor::Dispatcher
- {
- SetVisitor& m_target;
- Result m_result;
-
- Dispatcher(SetVisitor& _rTarget)
- : m_target(_rTarget)
- , m_result(NodeVisitor::CONTINUE)
- {}
-
- void applyToTree(sharable::TreeFragment const & _aElement);
- void applyToElements(sharable::SetNode const & _aNode);
-
- Result dispatch(sharable::TreeFragment const & _aElement);
- };
+#include "osl/diagnose.h"
- // -------------------------------------------------------------------------
-
- inline
- Result NodeVisitor::Dispatcher::dispatch(sharable::Node const& _aNode)
- {
- using namespace sharable::Type;
- switch (_aNode.node.info.type & mask_nodetype)
- {
- case nodetype_value:
- return m_target.handle( ValueNodeAccess(&_aNode.value) );
-
- case nodetype_group:
- return m_target.handle( GroupNodeAccess(&_aNode.group) );
-
- case nodetype_set:
- return m_target.handle( SetNodeAccess(&_aNode.set) );
-
- default:
- OSL_ENSURE(false,"NodeVisitor: invalid node type detected"); // invalid node
- return m_target.handle( NodeAccess(&_aNode) );
- }
- }
- // -------------------------------------------------------------------------
-
- inline
- Result SetVisitor::Dispatcher::dispatch(sharable::TreeFragment const& _aElement)
- {
- return m_target.handle
- (TreeAccessor((sharable::TreeFragment *)(& _aElement )));
- }
- // -------------------------------------------------------------------------
-
- void NodeVisitor::Dispatcher::applyToNode(sharable::Node const & _aNode)
- {
- if (m_result != NodeVisitor::DONE)
- m_result = dispatch(_aNode);
- }
- // -------------------------------------------------------------------------
-
- void SetVisitor::Dispatcher::applyToTree(sharable::TreeFragment const & _aElement)
- {
- if (m_result != NodeVisitor::DONE)
- m_result = dispatch(_aElement);
- }
- // -------------------------------------------------------------------------
-
- void NodeVisitor::Dispatcher::applyToChildren(sharable::GroupNode const & _aNode)
- {
- using sharable::Node;
- for (Node const * pChild = _aNode.getFirstChild();
- pChild != NULL && m_result != NodeVisitor::DONE;
- pChild = _aNode.getNextChild(pChild) )
- m_result = dispatch(*pChild);
+#include "flags.hxx"
+#include "nodevisitor.hxx"
+#include "node.hxx"
+#include "treefragment.hxx"
+
+namespace configmgr { namespace data {
+
+NodeVisitor::~NodeVisitor() {}
+
+bool NodeVisitor::visitNode(sharable::Node * node) {
+ switch (node->info.type & data::Type::mask_nodetype) {
+ case data::Type::nodetype_value:
+ return handle(&node->value);
+ case data::Type::nodetype_group:
+ return handle(&node->group);
+ case data::Type::nodetype_set:
+ return handle(&node->set);
+ default:
+ OSL_ASSERT(false);
+ return false;
}
- // -------------------------------------------------------------------------
+}
- void SetVisitor::Dispatcher::applyToElements(sharable::SetNode const & _aNode)
+bool NodeVisitor::visitChildren(sharable::GroupNode * node) {
+ for (sharable::Node * child = node->getFirstChild(); child != 0;
+ child = node->getNextChild(child))
{
- using sharable::TreeFragment;
- for (TreeFragment const * pElement = _aNode.getFirstElement();
- pElement != NULL && m_result != NodeVisitor::DONE;
- pElement = _aNode.getNextElement(pElement) )
- m_result = dispatch(*pElement);
-
+ if (visitNode(child)) {
+ return true;
+ }
}
- // -------------------------------------------------------------------------
-// -------------------------------------------------------------------------
-
-Result NodeVisitor::visitNode(NodeAccess const& _aNode)
-{
- Dispatcher aDispatcher(*this);
-
- aDispatcher.applyToNode(*static_cast<configmgr::sharable::Node *>(_aNode));
-
- return aDispatcher.m_result;
+ return false;
}
-// -------------------------------------------------------------------------
-
-Result SetVisitor::visitTree(TreeAccessor const& _aNode)
-{
- Dispatcher aDispatcher(*this);
- aDispatcher.applyToTree(*_aNode);
-
- return aDispatcher.m_result;
+bool NodeVisitor::handle(sharable::Node *) {
+ return false;
}
-// -------------------------------------------------------------------------
-
-Result NodeVisitor::visitChildren(GroupNodeAccess const& _aNode)
-{
- Dispatcher aDispatcher(*this);
-
- aDispatcher.applyToChildren(_aNode.data());
- return aDispatcher.m_result;
+bool NodeVisitor::handle(sharable::ValueNode * node) {
+ return handle(sharable::node(node));
}
-// -------------------------------------------------------------------------
-Result SetVisitor::visitElements(SetNodeAccess const& _aNode)
-{
- Dispatcher aDispatcher(*this);
-
- aDispatcher.applyToElements(_aNode.data());
-
- return aDispatcher.m_result;
+bool NodeVisitor::handle(sharable::GroupNode * node) {
+ return handle(sharable::node(node));
}
-// -------------------------------------------------------------------------
-Result NodeVisitor::handle(NodeAccess const& /*_aNode*/)
-{
- return CONTINUE;
+bool NodeVisitor::handle(sharable::SetNode * node) {
+ return handle(sharable::node(node));
}
-// -------------------------------------------------------------------------
-Result NodeVisitor::handle(ValueNodeAccess const& _aNode)
-{
- return handle(NodeAccess(_aNode));
-}
-// -------------------------------------------------------------------------
+SetVisitor::~SetVisitor() {}
-Result NodeVisitor::handle(GroupNodeAccess const& _aNode)
-{
- return handle(NodeAccess(_aNode));
+bool SetVisitor::visitTree(sharable::TreeFragment * tree) {
+ return handle(tree);
}
-// -------------------------------------------------------------------------
-Result NodeVisitor::handle(SetNodeAccess const& _aNode)
-{
- return handle(NodeAccess(static_cast<const sharable::Node *>(_aNode)));
+bool SetVisitor::visitElements(sharable::SetNode * node) {
+ for (sharable::TreeFragment * element = node->getFirstElement();
+ element != 0; element = node->getNextElement(element))
+ {
+ if (handle(element)) {
+ return true;
+ }
+ }
+ return false;
}
-// -------------------------------------------------------------------------
-Result SetVisitor::handle(TreeAccessor const& _aTree)
-{
- return NodeVisitor::visitNode(_aTree.getRootNode());
+bool SetVisitor::handle(sharable::TreeFragment * tree) {
+ return visitNode(tree->getRootNode());
}
-// -------------------------------------------------------------------------
-
-// -------------------------------------------------------------------------
- }
-// -----------------------------------------------------------------------------
-} // namespace configmgr
-
+} }
diff --git a/configmgr/source/tree/subtree.hxx b/configmgr/source/tree/subtree.hxx
index 0c893dfea8..2c9e0b4af7 100644
--- a/configmgr/source/tree/subtree.hxx
+++ b/configmgr/source/tree/subtree.hxx
@@ -41,19 +41,17 @@
namespace configmgr
{
// List sorted by name for binary search
- typedef std::vector< INode* > ChildList;
-
class ChildListSet {
- ChildList m_aChildList;
+ std::vector< INode* > m_aChildList;
ChildListSet(ChildListSet const&);
ChildListSet& operator=(ChildListSet const& aSet);
public:
- ChildList::iterator begin() const { return const_cast<ChildList*>(&m_aChildList)->begin(); }
- ChildList::iterator end() const { return const_cast<ChildList*>(&m_aChildList)->end(); }
+ std::vector< INode* >::iterator begin() const { return const_cast<std::vector< INode* >*>(&m_aChildList)->begin(); }
+ std::vector< INode* >::iterator end() const { return const_cast<std::vector< INode* >*>(&m_aChildList)->end(); }
INode *erase(INode *pNode);
- ChildList::iterator find(INode *pNode) const;
- std::pair<ChildList::iterator, bool> insert(INode *aInsert);
+ std::vector< INode* >::iterator find(INode *pNode) const;
+ std::pair<std::vector< INode* >::iterator, bool> insert(INode *aInsert);
ChildListSet() : m_aChildList(0) {}
ChildListSet(ChildListSet const&, treeop::DeepChildCopy);
@@ -64,21 +62,19 @@ namespace configmgr
class Subtree : public ISubtree
{
ChildListSet m_aChildren;
- virtual INode* doGetChild(OUString const& name) const;
+ virtual INode* doGetChild(rtl::OUString const& name) const;
public:
- typedef treeop::NoChildCopy NoChildCopy;
-
Subtree(){}
- Subtree(const OUString& _rName,
+ Subtree(const rtl::OUString& _rName,
const node::Attributes& _rAttrs)
:ISubtree(_rName, _rAttrs){};
- Subtree(const ISubtree& _rOther, NoChildCopy)
+ Subtree(const ISubtree& _rOther, treeop::NoChildCopy)
: ISubtree(_rOther), m_aChildren(){};
- Subtree(const OUString& _rName,
- const OUString& _rTemplateName, const OUString& _rTemplateModule,
+ Subtree(const rtl::OUString& _rName,
+ const rtl::OUString& _rTemplateName, const rtl::OUString& _rTemplateModule,
const node::Attributes& _rAttrs)
:ISubtree(_rName, _rTemplateName, _rTemplateModule, _rAttrs){};
@@ -86,16 +82,13 @@ namespace configmgr
: ISubtree(_rOther), m_aChildren(_rOther.m_aChildren,_dc){}
virtual INode* addChild(std::auto_ptr<INode> node); // takes ownership
- virtual ::std::auto_ptr<INode> removeChild(OUString const& name);
+ virtual ::std::auto_ptr<INode> removeChild(rtl::OUString const& name);
virtual std::auto_ptr<INode> clone() const;
// Iteration support
virtual void forEachChild(NodeAction& anAction) const;
virtual void forEachChild(NodeModification& anAction);
-
- // "rtti"
- RTTI(Subtree, ISubtree);
};
@@ -104,7 +97,7 @@ namespace configmgr
class SearchNode : public INode
{
public:
- SearchNode(OUString const& aName);
+ SearchNode(rtl::OUString const& aName);
virtual ~SearchNode();
virtual std::auto_ptr<INode> clone() const;
diff --git a/configmgr/source/tree/treechangefactory.cxx b/configmgr/source/tree/treechangefactory.cxx
index 072514bd2c..5c7333eba0 100644
--- a/configmgr/source/tree/treechangefactory.cxx
+++ b/configmgr/source/tree/treechangefactory.cxx
@@ -40,32 +40,24 @@
namespace configmgr
{
//= dummy helpe ============================================================
-bool isGenericSetElementType(OUString const& _aElementType)
+bool isGenericSetElementType(rtl::OUString const& _aElementType)
{
- return !! _aElementType.equals( getGenericSetElementType().toString() );
+ return !! _aElementType.equals( getGenericSetElementType() );
}
-bool isDummySetElementModule(OUString const& _aElementModule)
+bool isDummySetElementModule(rtl::OUString const& _aElementModule)
{
- return !! _aElementModule.equals( getDummySetElementModule().toString() );
+ return !! _aElementModule.equals( getDummySetElementModule() );
}
-configuration::Name getGenericSetElementType()
+rtl::OUString getGenericSetElementType()
{
- using namespace configuration;
- static const Name c_aGenericTypeName =
- makeName( OUString(RTL_CONSTASCII_USTRINGPARAM("*")), Name::NoValidate() );
-
- return c_aGenericTypeName;
+ return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("*"));
}
-configuration::Name getDummySetElementModule()
+rtl::OUString getDummySetElementModule()
{
- using namespace configuration;
- static const Name c_aDummyModuleName =
- makeName( OUString(RTL_CONSTASCII_USTRINGPARAM("cfg:dummy-change")), Name::NoValidate() );
-
- return c_aDummyModuleName;
+ return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("cfg:dummy-change"));
}
//= static default ============================================================
@@ -77,20 +69,19 @@ OTreeChangeFactory& getDefaultTreeChangeFactory()
//= SubtreeChanges ============================================================
std::auto_ptr<SubtreeChange> OTreeChangeFactory::createDummyChange(
- configuration::Name const& _aName,
- configuration::Name const& _aElementTypeName)
+ rtl::OUString const& _aName, rtl::OUString const& _aElementTypeName)
{
std::auto_ptr<SubtreeChange> pResult;
- if (_aElementTypeName.isEmpty())
+ if (_aElementTypeName.getLength() == 0)
{
- pResult.reset( new SubtreeChange(_aName.toString(),node::Attributes()) );
+ pResult.reset( new SubtreeChange(_aName, node::Attributes()) );
}
else
{
- pResult.reset( new SubtreeChange(_aName.toString(),
- _aElementTypeName.toString(),
- getDummySetElementModule().toString(),
+ pResult.reset( new SubtreeChange(_aName,
+ _aElementTypeName,
+ getDummySetElementModule(),
node::Attributes()) );
}
return pResult;
@@ -98,9 +89,9 @@ std::auto_ptr<SubtreeChange> OTreeChangeFactory::createDummyChange(
//-----------------------------------------------
std::auto_ptr<SubtreeChange> OTreeChangeFactory::createSetNodeChange(
- Name const& _aName,
- Name const& _aTemplateName,
- Name const& _aTemplateModule,
+ rtl::OUString const& _aName,
+ rtl::OUString const& _aTemplateName,
+ rtl::OUString const& _aTemplateModule,
node::Attributes _aAttrs,
bool _bToDefault)
{
@@ -113,8 +104,8 @@ std::auto_ptr<SubtreeChange> OTreeChangeFactory::createSetNodeChange(
//= Set Changes ============================================================
std::auto_ptr<AddNode> OTreeChangeFactory::createAddNodeChange(
- data::TreeSegment const & _aNewTree,
- Name const& _aName,
+ rtl::Reference< data::TreeSegment > const & _aNewTree,
+ rtl::OUString const& _aName,
bool _bToDefault)
{
return std::auto_ptr<AddNode>(new AddNode(_aNewTree,_aName,_bToDefault));
@@ -122,7 +113,7 @@ std::auto_ptr<AddNode> OTreeChangeFactory::createAddNodeChange(
//-----------------------------------------------
std::auto_ptr<RemoveNode> OTreeChangeFactory::createRemoveNodeChange(
- Name const& _aName,
+ rtl::OUString const& _aName,
bool _bToDefault)
{
return std::auto_ptr<RemoveNode>(new RemoveNode(_aName,_bToDefault));
diff --git a/configmgr/source/tree/treefragment.cxx b/configmgr/source/tree/treefragment.cxx
index 7efa7d2b3c..0ee33b9485 100644
--- a/configmgr/source/tree/treefragment.cxx
+++ b/configmgr/source/tree/treefragment.cxx
@@ -32,6 +32,7 @@
#include "precompiled_configmgr.hxx"
#include "treefragment.hxx"
+#include "utility.hxx"
#include "attributes.hxx"
#include <rtl/ustring.hxx>
@@ -46,8 +47,15 @@ namespace configmgr
//-----------------------------------------------------------------------------
rtl::OUString TreeFragment::getName() const
{
- return readString(this->header.name);
+ return rtl::OUString(this->header.name);
}
+
+void TreeFragment::setName(rtl::OUString const & name) {
+ rtl_uString * old = header.name;
+ header.name = acquireString(name);
+ rtl_uString_release(old);
+}
+
//-----------------------------------------------------------------------------
bool TreeFragment::isNamed(rtl::OUString const & _aName) const
@@ -59,20 +67,20 @@ bool TreeFragment::isNamed(rtl::OUString const & _aName) const
bool TreeFragment::hasDefaultsAvailable() const
{
- return (this->header.state & State::flag_default_avail) || isDefault();
+ return (this->header.state & data::State::flag_default_avail) || isDefault();
}
//-----------------------------------------------------------------------------
bool TreeFragment::isDefault() const
{
- return (this->header.state & State::mask_state) == State::defaulted;
+ return (this->header.state & data::State::mask_state) == data::State::defaulted;
}
//-----------------------------------------------------------------------------
bool TreeFragment::isNew() const
{
- return (this->header.state & State::mask_state) == State::added;
+ return (this->header.state & data::State::mask_state) == data::State::added;
}
//-----------------------------------------------------------------------------
@@ -80,26 +88,26 @@ configmgr::node::Attributes TreeFragment::getAttributes() const
{
configmgr::node::Attributes aResult;
- switch (this->header.state & State::mask_state)
+ switch (this->header.state & data::State::mask_state)
{
- case State::merged: aResult.setState(configmgr::node::isMerged); break;
- case State::defaulted: aResult.setState(configmgr::node::isDefault); break;
- case State::replaced: aResult.setState(configmgr::node::isReplaced); break;
- case State::added: aResult.setState(configmgr::node::isAdded); break;
+ case data::State::merged: aResult.setState(configmgr::node::isMerged); break;
+ case data::State::defaulted: aResult.setState(configmgr::node::isDefault); break;
+ case data::State::replaced: aResult.setState(configmgr::node::isReplaced); break;
+ case data::State::added: aResult.setState(configmgr::node::isAdded); break;
default: OSL_ASSERT(false); break; // not reachable
}
- aResult.setRemovability(!!(this->header.state & State::flag_removable),
- !!(this->header.state & State::flag_mandatory));
+ aResult.setRemovability(!!(this->header.state & data::State::flag_removable),
+ !!(this->header.state & data::State::flag_mandatory));
OSL_ASSERT( header.count != 0 );
- NodeInfo const & aRootNodeInfo = this->nodes[0].node.info;
+ NodeInfo const & aRootNodeInfo = this->nodes[0].info;
- aResult.setAccess( !!(this->header.state & State::flag_readonly),
- !!(aRootNodeInfo.flags & Flags::finalized) );
+ aResult.setAccess( !!(this->header.state & data::State::flag_readonly),
+ !!(aRootNodeInfo.flags & data::Flags::finalized) );
- aResult.setLocalized ( !!(aRootNodeInfo.flags & Flags::localized));
+ aResult.setLocalized ( !!(aRootNodeInfo.flags & data::Flags::localized));
return aResult;
}
diff --git a/configmgr/source/tree/treesegment.cxx b/configmgr/source/tree/treesegment.cxx
index 693a9ff1f1..5abbc20dc7 100644
--- a/configmgr/source/tree/treesegment.cxx
+++ b/configmgr/source/tree/treesegment.cxx
@@ -1,7 +1,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2008 by Sun Microsystems, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -28,215 +28,64 @@
*
************************************************************************/
-// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_configmgr.hxx"
+#include "sal/config.h"
-#include "treesegment.hxx"
-#include "builddata.hxx"
-#include "treeaccessor.hxx"
-#include "utility.hxx"
-#include <osl/diagnose.h>
-
-// -----------------------------------------------------------------------------
-
-namespace configmgr
-{
-// -----------------------------------------------------------------------------
- namespace data
- {
-// -----------------------------------------------------------------------------
-struct TreeSegment::Impl : configmgr::SimpleReferenceObject
-{
- Impl() : base() {}
- ~Impl();
-
- data::TreeAddress base;
-};
-
-// -----------------------------------------------------------------------------
-TreeSegment::TreeSegment()
-: m_pImpl()
-{
-}
-
-// -----------------------------------------------------------------------------
-TreeSegment::TreeSegment(Impl * _pImpl)
-: m_pImpl(_pImpl)
-{
-}
-
-// -----------------------------------------------------------------------------
-TreeSegment::TreeSegment(TreeSegment const & _aOther)
-: m_pImpl( _aOther.m_pImpl )
-{
-}
-
-// -----------------------------------------------------------------------------
-TreeSegment& TreeSegment::operator=(TreeSegment const & _aOther)
-{
- m_pImpl = _aOther.m_pImpl;
- return *this;
-}
-
-// -----------------------------------------------------------------------------
-TreeSegment::~TreeSegment()
-{
-}
-
-// -----------------------------------------------------------------------------
-void TreeSegment::clear()
-{
- m_pImpl.clear();
-}
-
-// -----------------------------------------------------------------------------
-TreeAccessor TreeSegment::getTreeAccess() const
-{
- return TreeAccessor(getTreeData());
-}
-
-// -----------------------------------------------------------------------------
-// -----------------------------------------------------------------------------
-TreeSegment::Impl::~Impl()
-{
- if (base != NULL)
- destroyTree(base);
-}
-
-// -----------------------------------------------------------------------------
-TreeSegment::Impl* TreeSegment::createNewSegment(RawTreeData& _aTree, RawName const & _aTypeName)
-{
- if (_aTree.get() == NULL) return NULL;
-
- std::auto_ptr<Impl> aNewImpl( new Impl );
-
- aNewImpl->base = buildElementTree(*_aTree,_aTypeName,false); // no defaults for set element trees
-
- if (aNewImpl->base == NULL) aNewImpl.reset();
-
- return aNewImpl.release();
-}
-
-// -----------------------------------------------------------------------------
-TreeSegment::Impl* TreeSegment::createNewSegment(RawName const & _aTreeName, RawTreeData& _aTree)
-{
- if (_aTree.get() == NULL) return NULL;
-
- std::auto_ptr<Impl> aNewImpl( new Impl );
-
- aNewImpl->base = buildTree(_aTreeName,*_aTree,false); // no defaults for set element trees
+#include <memory>
- if (aNewImpl->base == NULL) aNewImpl.reset();
+#include "osl/diagnose.h"
+#include "rtl/ref.hxx"
+#include "salhelper/simplereferenceobject.hxx"
- return aNewImpl.release();
-}
-
-
-// -----------------------------------------------------------------------------
-TreeSegment::Impl* TreeSegment::createNewSegment(TreeAccessor const & _aTree)
-{
- if (_aTree == NULL) return NULL;
-
- std::auto_ptr<Impl> aNewImpl( new Impl );
-
- aNewImpl->base = _aTree.copyTree();
-
- if (aNewImpl->base == NULL) aNewImpl.reset();
-
- return aNewImpl.release();
-}
-
-// -----------------------------------------------------------------------------
-TreeSegment::RawTreeData TreeSegment::cloneData(bool _bUseTreeName) const
-{
- return convertTree(this->getTreeAccess(),_bUseTreeName);
-}
-
-// -----------------------------------------------------------------------------
-TreeSegment TreeSegment::cloneSegment() const
-{
- if (!is()) return TreeSegment();
-
- return createNew( this->getTreeAccess() );
-}
-
-// -----------------------------------------------------------------------------
-bool TreeSegment::is() const
-{
- return hasData() && m_pImpl->base != NULL;
-}
-
-// -----------------------------------------------------------------------------
-TreeSegment::Name TreeSegment::getName() const
-{
- OSL_ENSURE(is(), "Operation requires a valid tree");
+#include "builddata.hxx"
+#include "treesegment.hxx"
- if (!is()) return Name();
+namespace configmgr { namespace data {
- return configuration::makeElementName( getTreeData()->getName(), Name::NoValidate() );
-}
-
-// -----------------------------------------------------------------------------
-void TreeSegment::setName(Name const & _aNewName)
+rtl::Reference< TreeSegment > TreeSegment::create(
+ std::auto_ptr< INode > tree, rtl::OUString const & type)
{
- OSL_ENSURE(is(), "Operation requires a valid tree");
-
- if (is())
- {
- sharable::String aOldName = getTreeDataForUpdate()->header.name;
-
- sharable::String aNewName = sharable::allocString(_aNewName.toString());
-
- getTreeDataForUpdate()->header.name = aNewName;
-
- sharable::freeString(aOldName);
+ rtl::Reference< TreeSegment > r;
+ if (tree.get() != 0) {
+ std::auto_ptr< sharable::TreeFragment > p(
+ buildElementTree(*tree, type, false));
+ r = new TreeSegment(p.get());
+ p.release();
}
+ return r;
}
-// -----------------------------------------------------------------------------
-void TreeSegment::markRemovable()
-{
- OSL_ENSURE(is(), "Operation requires a valid tree");
- if (is())
- getTreeDataForUpdate()->header.state |= State::flag_removable;
-}
-// -----------------------------------------------------------------------------
-TreeAddress TreeSegment::getBaseAddress() const
+rtl::Reference< TreeSegment > TreeSegment::create(
+ rtl::OUString const & name, std::auto_ptr< INode > tree)
{
- return hasData() ? m_pImpl->base : NULL;
+ rtl::Reference< TreeSegment > r;
+ if (tree.get() != 0) {
+ std::auto_ptr< sharable::TreeFragment > p(
+ buildTree(name, *tree, false));
+ r = new TreeSegment(p.get());
+ p.release();
+ }
+ return r;
}
-// -----------------------------------------------------------------------------
-TreeSegment::TreeDataPtr TreeSegment::getTreeData() const
+rtl::Reference< TreeSegment > TreeSegment::create(
+ sharable::TreeFragment * tree)
{
- if (!is()) return NULL;
-
- return m_pImpl->base;
+ rtl::Reference< TreeSegment > r;
+ if (tree != 0) {
+ std::auto_ptr< sharable::TreeFragment > p(data::buildTree(tree));
+ r = new TreeSegment(p.get());
+ p.release();
+ }
+ return r;
}
-// -----------------------------------------------------------------------------
-TreeSegment::TreeDataUpdatePtr TreeSegment::getTreeDataForUpdate() const
-{
- OSL_ASSERT(this->is());
-
- if (!is()) return NULL;
-
- return m_pImpl->base;
+TreeSegment::TreeSegment(sharable::TreeFragment * tree): fragment(tree) {
+ OSL_ASSERT(tree != 0);
}
-// -----------------------------------------------------------------------------
-TreeSegment::NodeDataPtr TreeSegment::getSegmentRootNode() const
-{
- if (sharable::TreeFragment const * pTree = getTreeData())
- return & pTree->nodes[0];
-
- else
- return NULL;
+TreeSegment::~TreeSegment() {
+ destroyTree(fragment);
}
-// -----------------------------------------------------------------------------
-// -----------------------------------------------------------------------------
- }
-// -----------------------------------------------------------------------------
-} // namespace configmgr
-
+} }
diff --git a/configmgr/source/tree/updatehelper.cxx b/configmgr/source/tree/updatehelper.cxx
index b898f8f5e1..3cc8112314 100644
--- a/configmgr/source/tree/updatehelper.cxx
+++ b/configmgr/source/tree/updatehelper.cxx
@@ -39,18 +39,12 @@
#include "treeactions.hxx"
#include "treechangefactory.hxx"
#include "treenodefactory.hxx"
-#include "treeprovider.hxx"
// -----------------------------------------------------------------------------
#include "node.hxx"
#include "treefragment.hxx"
-#include "nodeaccess.hxx"
-#include "treeaccessor.hxx"
#include "builddata.hxx"
#include "nodevisitor.hxx"
-#include "valuenodeaccess.hxx"
-#include "groupnodeaccess.hxx"
-#include "setnodeaccess.hxx"
// -----------------------------------------------------------------------------
#include "tracer.hxx"
#include <osl/diagnose.h>
@@ -69,30 +63,30 @@ namespace configmgr
class AdjustUpdate : ChangeTreeModification
{
SubtreeChange& m_rChangeList; // list which containes changes merged with the existing nodes
- data::NodeAccess m_aRefNode; // reference node needed for merging
+ sharable::Node * m_refNode; // reference node needed for merging
OTreeNodeConverter m_aNodeConverter;
public:
static bool adjust(SubtreeChange& _rResultTree, SubtreeChange& _aUpdateTree,
- data::NodeAccess const& _aTargetNode)
+ sharable::Node * targetNode)
{
- return AdjustUpdate(_rResultTree,_aTargetNode).impl_adjust(_aUpdateTree);
+ return AdjustUpdate(_rResultTree, targetNode).impl_adjust(_aUpdateTree);
}
static bool adjust(SubtreeChange& _rResultTree, SubtreeChange& _aUpdateTree,
- data::NodeAccess const& _aTargetNode,
+ sharable::Node * targetNode,
OTreeNodeFactory& _rNodeFactory)
{
- return AdjustUpdate(_rResultTree,_aTargetNode,_rNodeFactory).impl_adjust(_aUpdateTree);
+ return AdjustUpdate(_rResultTree, targetNode, _rNodeFactory).impl_adjust(_aUpdateTree);
}
private:
- AdjustUpdate(SubtreeChange& rList, data::NodeAccess const & _aNode)
+ AdjustUpdate(SubtreeChange& rList, sharable::Node * node)
:m_rChangeList(rList)
- ,m_aRefNode(_aNode)
+ ,m_refNode(node)
,m_aNodeConverter()
{}
- AdjustUpdate(SubtreeChange& rList, data::NodeAccess const & _aNode, OTreeNodeFactory& _rNodeFactory)
+ AdjustUpdate(SubtreeChange& rList, sharable::Node * node, OTreeNodeFactory& _rNodeFactory)
:m_rChangeList(rList)
- ,m_aRefNode(_aNode)
+ ,m_refNode(node)
,m_aNodeConverter(_rNodeFactory)
{}
@@ -111,9 +105,9 @@ private:
class ApplyUpdate : public ChangeTreeModification
{
- data::NodeAddress m_aCurrentNode;
+ sharable::Node * m_aCurrentNode;
public:
- ApplyUpdate(data::NodeAddress _aNode)
+ ApplyUpdate(sharable::Node * _aNode)
: m_aCurrentNode(_aNode)
{}
@@ -121,9 +115,6 @@ public:
void handle(AddNode& aAddNode);
void handle(RemoveNode& aRemoveNode);
void handle(SubtreeChange& aSubtree);
-
- static
- void applyChange(ValueChange& _rValueChange, data::ValueNodeAddress & _aValueNodeAddr);
};
//--------------------------------------------------------------------------
class ApplyValueChange
@@ -133,45 +124,25 @@ class ApplyValueChange
public:
static
- data::ValueNodeAccess node(data::ValueNodeAddress & _aValueNodeAddr)
- { return data::ValueNodeAccess(_aValueNodeAddr); }
-
- static
- uno::Any getValue(data::ValueNodeAddress & _aValueNodeAddr)
- { return node(_aValueNodeAddr).getValue(); }
-
- static
- uno::Any getDefault(data::ValueNodeAddress & _aValueNodeAddr)
- { return node(_aValueNodeAddr).getDefaultValue(); }
-
- static
- void apply(ValueChange& _rValueChange, data::ValueNodeAddress & _aValueNodeAddr);
+ void apply(ValueChange& _rValueChange, sharable::ValueNode * valueNode);
};
//--------------------------------------------------------------------------
//--------------------------------------------------------------------------
// apply a already matching set of changes to the target tree
- void applyUpdateToTree(SubtreeChange& _anUpdateTree, data::NodeAddress _aRootNode)
+ void applyUpdateToTree(SubtreeChange& _anUpdateTree, sharable::Node * _aRootNode)
{
ApplyUpdate aUpdater(_aRootNode);
_anUpdateTree.forEachChange(aUpdater);
}
//--------------------------------------------------------------------------
- static inline
- bool adjust_helper(SubtreeChange& _rResultTree, SubtreeChange& _aUpdateTree,
- data::NodeAddress _aTargetAddress )
- {
- data::NodeAccess aTargetNode(_aTargetAddress);
- return AdjustUpdate::adjust(_rResultTree, _aUpdateTree, aTargetNode);
- }
-//--------------------------------------------------------------------------
// apply a set of changes to the target tree
- void applyUpdateWithAdjustmentToTree(SubtreeChange& _anUpdateTree, data::NodeAddress _aRootNode)
+ void applyUpdateWithAdjustmentToTree(SubtreeChange& _anUpdateTree, sharable::Node * _aRootNode)
{
// POST: pSubtree = pSubtree + aChangeList
- SubtreeChange aActualChanges(_anUpdateTree, SubtreeChange::NoChildCopy());
+ SubtreeChange aActualChanges(_anUpdateTree, treeop::NoChildCopy());
- if ( adjust_helper(aActualChanges,_anUpdateTree, _aRootNode) )
+ if ( AdjustUpdate::adjust(aActualChanges,_anUpdateTree, _aRootNode) )
{
applyUpdateToTree(aActualChanges, _aRootNode);
}
@@ -182,16 +153,16 @@ public:
//--------------------------------------------------------------------------
static inline
-configuration::Name getNodeName(INode const & _aNode)
+rtl::OUString getNodeName(INode const & _aNode)
{
- return configuration::makeName( _aNode.getName(), configuration::Name::NoValidate() );
+ return _aNode.getName();
}
//--------------------------------------------------------------------------
static inline
-configuration::Name getChangeNodeName(Change const & _aChange)
+rtl::OUString getChangeNodeName(Change const & _aChange)
{
- return configuration::makeName( _aChange.getNodeName(), configuration::Name::NoValidate() );
+ return _aChange.getNodeName();
}
//--------------------------------------------------------------------------
@@ -212,9 +183,9 @@ bool AdjustUpdate::impl_adjust(SubtreeChange& _aUpdateTree)
inline bool AdjustUpdate::checkNode() const
{
// Change a Value
- OSL_ENSURE(m_aRefNode.isValid(),"AdjustUpdate: no data");
+ OSL_ENSURE(m_refNode != 0, "AdjustUpdate: no data");
- return m_aRefNode.isValid();
+ return m_refNode != 0;
}
//--------------------------------------------------------------------------
@@ -223,13 +194,12 @@ void AdjustUpdate::handle(ValueChange& _rChange)
if (checkNode())
{
// We need to find the element in the tree
- data::NodeAccess aChildNodeAcc = data::getSubnode(m_aRefNode, getChangeNodeName(_rChange));
- data::NodeAccess aChildNode(aChildNodeAcc);
+ sharable::Node * childNode = m_refNode->getSubnode(getChangeNodeName(_rChange));
// We have a node so we can keep the Change and the values do not differ
- if (aChildNode.isValid())
+ if (childNode != 0)
{
- bool bIsValue = data::ValueNodeAccess::isInstance(aChildNode);
+ bool bIsValue = childNode->isValue();
OSL_ENSURE(bIsValue, "AdjustUpdate : node must be a value node!");
if (bIsValue && _rChange.isChange())
@@ -243,9 +213,9 @@ void AdjustUpdate::handle(ValueChange& _rChange)
std::auto_ptr<ValueNode> pNode = m_aNodeConverter.createCorrespondingNode(_rChange);
OSL_ENSURE(m_rChangeList.isSetNodeChange(), "Adding a new value to a non-set node");
- OUString sTypeName = m_rChangeList.getElementTemplateName();
+ rtl::OUString sTypeName = m_rChangeList.getElementTemplateName();
- data::TreeSegment aNewTree = data::TreeSegment::createNew(base_ptr(pNode),sTypeName);
+ rtl::Reference< data::TreeSegment > aNewTree = data::TreeSegment::create(base_ptr(pNode),sTypeName);
// add the tree to the change list
std::auto_ptr<Change> pChange( new AddNode( aNewTree,_rChange.getNodeName(), _rChange.isToDefault()) );
m_rChangeList.addChange(pChange);
@@ -259,23 +229,21 @@ void AdjustUpdate::handle(SubtreeChange& _rChange)
if (checkNode())
{
// We need to find the element in the tree
- data::NodeAccess aChildNodeAcc = data::getSubnode(m_aRefNode, getChangeNodeName(_rChange));
- data::NodeAccess aChildNode(aChildNodeAcc);
+ sharable::Node * childNode = m_refNode->getSubnode(getChangeNodeName(_rChange));
// if there is a node we continue
- if (aChildNode.isValid())
+ if (childNode != 0)
{
- bool bIsSubtree = data::GroupNodeAccess::isInstance(aChildNode) ||
- data::SetNodeAccess::isInstance(aChildNode);
+ bool bIsSubtree = childNode->isGroup() || childNode->isSet();
OSL_ENSURE(bIsSubtree, "AdjustUpdate : node must be a inner node!");
if (bIsSubtree)
{
// generate a new change
- std::auto_ptr<SubtreeChange> pChange( new SubtreeChange(_rChange, SubtreeChange::NoChildCopy()) );
+ std::auto_ptr<SubtreeChange> pChange( new SubtreeChange(_rChange, treeop::NoChildCopy()) );
// recurse
- if ( adjust(*pChange,_rChange,aChildNode,m_aNodeConverter.nodeFactory()) )
+ if ( adjust(*pChange,_rChange,childNode,m_aNodeConverter.nodeFactory()) )
m_rChangeList.addChange(base_ptr(pChange));
}
else
@@ -291,9 +259,9 @@ void AdjustUpdate::handle(SubtreeChange& _rChange)
pNode->setLevels(treeop::ALL_LEVELS,treeop::ALL_LEVELS);
OSL_ENSURE(m_rChangeList.isSetNodeChange(), "Adding a new value to a non-set node");
- OUString sTypeName = m_rChangeList.getElementTemplateName();
+ rtl::OUString sTypeName = m_rChangeList.getElementTemplateName();
- data::TreeSegment aNewTree = data::TreeSegment::createNew(base_ptr(pNode), sTypeName);
+ rtl::Reference< data::TreeSegment > aNewTree = data::TreeSegment::create(base_ptr(pNode), sTypeName);
// add the tree to the change list
std::auto_ptr<Change> pChange( new AddNode(aNewTree,_rChange.getNodeName(), _rChange.isToDefault()) );
@@ -308,10 +276,10 @@ void AdjustUpdate::handle(RemoveNode& _rChange)
if (checkNode())
{
// We need to find the element in the tree
- data::NodeAccess aChildNode = data::getSubnode(m_aRefNode, getChangeNodeName(_rChange));
+ sharable::Node * childNode = m_refNode->getSubnode(getChangeNodeName(_rChange));
// only if there is a node, we will keep the change
- if (aChildNode.isValid())
+ if (childNode != 0)
{
// generate a new change
std::auto_ptr<Change> pChange( new RemoveNode(_rChange.getNodeName(),_rChange.isToDefault()) );
@@ -326,11 +294,11 @@ void AdjustUpdate::handle(AddNode& _rChange)
if (checkNode())
{
// We need to find the element in the tree
- data::NodeAccess aChildNode = data::getSubnode(m_aRefNode, getChangeNodeName(_rChange));
+ sharable::Node * childNode = m_refNode->getSubnode(getChangeNodeName(_rChange));
- data::TreeSegment aNewNode = _rChange.getNewTree();
+ rtl::Reference< data::TreeSegment > aNewNode = _rChange.getNewTree();
std::auto_ptr<AddNode> pChange( new AddNode(aNewNode,_rChange.getNodeName(),_rChange.isToDefault()) );
- if (aChildNode.isValid())
+ if (childNode != 0)
{
pChange->setReplacing();
}
@@ -350,29 +318,27 @@ void ApplyValueChange::adjust(uno::Any& aActual, uno::Any const& aTarget)
//--------------------------------------------------------------------------
// _rValueChange.applyTo(_aValueNode)
-void ApplyValueChange::apply(ValueChange& _rValueChange, data::ValueNodeAddress & _aValueNodeAddr)
+void ApplyValueChange::apply(ValueChange& _rValueChange, sharable::ValueNode * valueNode)
{
- using data::ValueNodeAccess;
-
switch (_rValueChange.getMode())
{
case ValueChange::wasDefault:
- OSL_ASSERT(node(_aValueNodeAddr).isDefault());
+ OSL_ASSERT(valueNode->info.isDefault());
case ValueChange::changeValue:
- adjust( _rValueChange.m_aOldValue, getValue(_aValueNodeAddr));
- ValueNodeAccess::setValue(_aValueNodeAddr,_rValueChange.getNewValue());
+ adjust( _rValueChange.m_aOldValue, valueNode->getValue());
+ valueNode->setValue(_rValueChange.getNewValue());
break;
case ValueChange::setToDefault:
- adjust( _rValueChange.m_aOldValue, getValue(_aValueNodeAddr));
- adjust( _rValueChange.m_aValue, getDefault(_aValueNodeAddr));
- ValueNodeAccess::setToDefault(_aValueNodeAddr);
+ adjust(_rValueChange.m_aOldValue, valueNode->getValue());
+ adjust(_rValueChange.m_aValue, valueNode->getDefaultValue());
+ valueNode->setToDefault();
break;
case ValueChange::changeDefault:
- adjust( _rValueChange.m_aOldValue, getDefault(_aValueNodeAddr));
- ValueNodeAccess::changeDefault(_aValueNodeAddr,_rValueChange.getNewValue());
+ adjust(_rValueChange.m_aOldValue, valueNode->getDefaultValue());
+ valueNode->changeDefault(_rValueChange.getNewValue());
break;
default:
@@ -387,10 +353,10 @@ void ApplyUpdate::handle(ValueChange& _rChange)
// Change a Value
OSL_ENSURE(m_aCurrentNode != NULL,"Cannot apply ValueChange without node");
- data::NodeAddress aChildNodeAddr = data::getSubnodeAddress(m_aCurrentNode, getChangeNodeName(_rChange));
- OSL_ENSURE(aChildNodeAddr != NULL,"Cannot apply Change: No node to change");
+ sharable::Node * childNode = m_aCurrentNode->getSubnode(getChangeNodeName(_rChange));
+ OSL_ENSURE(childNode != 0, "Cannot apply Change: No node to change");
- data::ValueNodeAddress aValueAddr = aChildNodeAddr->valueData();
+ sharable::ValueNode * aValueAddr = childNode->valueData();
OSL_ENSURE(aValueAddr != NULL,"Cannot apply ValueChange: Node is not a value");
if (aValueAddr != NULL)
@@ -403,19 +369,18 @@ void ApplyUpdate::handle(SubtreeChange& _rChange)
// handle traversion
OSL_ENSURE(m_aCurrentNode != NULL,"Cannot apply SubtreeChange without node");
- data::NodeAddress aChildNodeAddr = data::getSubnodeAddress(m_aCurrentNode, getChangeNodeName(_rChange));
- OSL_ENSURE(aChildNodeAddr != NULL,"Cannot apply Change: No node to change");
+ sharable::Node * childNode = m_aCurrentNode->getSubnode(getChangeNodeName(_rChange));
+ OSL_ENSURE(childNode != 0, "Cannot apply Change: No node to change");
- OSL_ENSURE( data::toGroupNodeAddress(aChildNodeAddr) != NULL ||
- data::toSetNodeAddress(aChildNodeAddr) != NULL ,
+ OSL_ENSURE( childNode->isGroup() || childNode->isSet(),
"Cannot Apply SubtreeChange: Node is not an inner node");
- if (aChildNodeAddr != NULL)
+ if (childNode != 0)
{
- aChildNodeAddr->node.info.markAsDefault( _rChange.isToDefault() );
+ childNode->info.markAsDefault( _rChange.isToDefault() );
- data::NodeAddress aOldNode = m_aCurrentNode;
- m_aCurrentNode = aChildNodeAddr;
+ sharable::Node * aOldNode = m_aCurrentNode;
+ m_aCurrentNode = childNode;
_rChange.forEachChange(*this);
@@ -428,7 +393,7 @@ void ApplyUpdate::handle(AddNode& _rChange)
{
OSL_ENSURE(m_aCurrentNode != NULL,"Cannot apply AddNode without node");
- data::SetNodeAddress aSetNodeAddr = data::toSetNodeAddress(m_aCurrentNode);
+ sharable::SetNode * aSetNodeAddr = sharable::SetNode::from(m_aCurrentNode);
OSL_ENSURE(aSetNodeAddr != NULL,"Cannot apply AddNode: Node is not a set node");
// Add a new element
@@ -436,19 +401,15 @@ void ApplyUpdate::handle(AddNode& _rChange)
{
if (_rChange.isReplacing())
{
- data::TreeAddress aOldNodeAddr =
- data::SetNodeAccess::removeElement(aSetNodeAddr,getChangeNodeName(_rChange));
-
- OSL_ENSURE(aOldNodeAddr != NULL, "ApplyUpdate: AddNode: can't recover node being replaced");
-
- data::TreeAccessor aOldNodeAccess(aOldNodeAddr);
- _rChange.takeReplacedTree( data::TreeSegment::createNew(aOldNodeAccess) );
- }
+ sharable::TreeFragment * old = aSetNodeAddr->removeElement(getChangeNodeName(_rChange));
+ OSL_ASSERT(old != 0);
+ _rChange.takeReplacedTree(data::TreeSegment::create(old));
+ }
- data::TreeAddress aNewAddress = data::buildTree(_rChange.getNewTree().getTreeAccess());
+ sharable::TreeFragment * aNewAddress = data::buildTree(_rChange.getNewTree()->fragment);
OSL_ENSURE(aNewAddress != NULL, "ApplyUpdate: AddNode: could not create new element");
- data::SetNodeAccess::addElement(aSetNodeAddr,aNewAddress);
+ aSetNodeAddr->addElement(aNewAddress);
_rChange.setInsertedAddress( aNewAddress );
}
@@ -459,19 +420,15 @@ void ApplyUpdate::handle(RemoveNode& _rChange)
{
OSL_ENSURE(m_aCurrentNode != NULL,"Cannot apply RemoveNode without node");
- data::SetNodeAddress aSetNodeAddr = data::toSetNodeAddress(m_aCurrentNode);
+ sharable::SetNode * aSetNodeAddr = sharable::SetNode::from(m_aCurrentNode);
OSL_ENSURE(aSetNodeAddr != NULL,"Cannot apply RemoveNode: Node is not a set node");
// Remove an element
if (aSetNodeAddr != NULL)
{
- data::TreeAddress aOldNodeAddr =
- data::SetNodeAccess::removeElement(aSetNodeAddr,getChangeNodeName(_rChange));
-
- OSL_ENSURE(aOldNodeAddr != NULL, "ApplyUpdate: Remove: can't recover node being removed");
-
- data::TreeAccessor aOldNodeAccess(aOldNodeAddr);
- _rChange.takeRemovedTree( data::TreeSegment::createNew(aOldNodeAccess) );
+ sharable::TreeFragment * old = aSetNodeAddr->removeElement(getChangeNodeName(_rChange));
+ OSL_ASSERT(old != 0);
+ _rChange.takeRemovedTree(data::TreeSegment::create(old));
}
}
//--------------------------------------------------------------------------
@@ -481,30 +438,30 @@ void ApplyUpdate::handle(RemoveNode& _rChange)
{
protected:
SubtreeChange& m_rChangeList;
- data::NodeAccess m_aCacheNode;
-
+ sharable::Node * m_cacheNode;
+
public:
- ForwardTreeDifferenceBuilder(SubtreeChange& rList, data::NodeAccess const & _aCacheNode)
+ ForwardTreeDifferenceBuilder(SubtreeChange& rList, sharable::Node * cacheNode)
: m_rChangeList(rList)
- , m_aCacheNode(_aCacheNode)
+ , m_cacheNode(cacheNode)
{
}
virtual void handle(ValueNode const& _aNewNode)
{
- data::NodeAccess aChildNode = data::getSubnode(m_aCacheNode,getNodeName(_aNewNode));
+ sharable::Node * childNode = m_cacheNode->getSubnode(getNodeName(_aNewNode));
- OSL_ENSURE(aChildNode.isValid(), "TreeDifferenceBuilder: could not find expected node !");
+ OSL_ENSURE(childNode != 0, "TreeDifferenceBuilder: could not find expected node !");
- data::ValueNodeAccess aValueNode( aChildNode );
+ sharable::ValueNode * valueNode = childNode->valueData();
- OSL_ENSURE(aValueNode.isValid(), "TreeDifferenceBuilder: node must be a value node!");
+ OSL_ENSURE(valueNode != 0, "TreeDifferenceBuilder: node must be a value node!");
// if the values differ add a new change
- if (aValueNode.isValid() && _aNewNode.getValue() != aValueNode.getValue())
+ if (_aNewNode.getValue() != valueNode->getValue())
{
bool bNewDefault = _aNewNode.isDefault();
- bool bOldDefault = aValueNode.isDefault();
+ bool bOldDefault = valueNode->info.isDefault();
ValueChange::Mode eMode;
if (bNewDefault)
@@ -520,26 +477,25 @@ void ApplyUpdate::handle(RemoveNode& _rChange)
std::auto_ptr<Change> pChange(
new ValueChange(_aNewNode.getName(), _aNewNode.getAttributes(), eMode,
- _aNewNode.getValue(), aValueNode.getValue()) );
+ _aNewNode.getValue(), valueNode->getValue()) );
m_rChangeList.addChange(pChange);
}
}
virtual void handle(ISubtree const& _aNewNode)
{
- data::NodeAccess aChildNode = data::getSubnode(m_aCacheNode,getNodeName(_aNewNode));
+ sharable::Node * childNode = m_cacheNode->getSubnode(getNodeName(_aNewNode));
- if (aChildNode.isValid())
+ if (childNode != 0)
{
- OSL_ENSURE( data::GroupNodeAccess::isInstance(aChildNode) ||
- data::SetNodeAccess::isInstance(aChildNode) ,
+ OSL_ENSURE( childNode->isGroup() || childNode->isSet(),
"ForwardTreeDifferenceBuilder: Node must be an inner node");
// generate a new change
std::auto_ptr<SubtreeChange> pNewChange( new SubtreeChange(_aNewNode) );
// .. and recurse
- ForwardTreeDifferenceBuilder aNextLevel(*pNewChange, aChildNode);
+ ForwardTreeDifferenceBuilder aNextLevel(*pNewChange, childNode);
aNextLevel.applyToChildren(_aNewNode);
// now count if there are any changes
@@ -549,15 +505,15 @@ void ApplyUpdate::handle(RemoveNode& _rChange)
if (aCounter.hasChanges())
m_rChangeList.addChange(base_ptr(pNewChange));
}
- else if (data::SetNodeAccess::isInstance(m_aCacheNode))
+ else if (m_cacheNode != 0 && m_cacheNode->isSet())
{
// Subtree not in Cache, add in TreeChangeList
// SubtreeChange* pChange = new SubtreeChange(_rSubtree);
OSL_ENSURE(m_rChangeList.isSetNodeChange(), "Found newly added node in non-set node");
- OUString sTypeName = m_rChangeList.getElementTemplateName();
+ rtl::OUString sTypeName = m_rChangeList.getElementTemplateName();
std::auto_ptr<INode> pSubtree( _aNewNode.clone() );
- data::TreeSegment aNewTree = data::TreeSegment::createNew(pSubtree,sTypeName);
+ rtl::Reference< data::TreeSegment > aNewTree = data::TreeSegment::create(pSubtree,sTypeName);
std::auto_ptr<Change> pAdd(new AddNode(aNewTree, _aNewNode.getName(), _aNewNode.isDefault()));
@@ -570,149 +526,93 @@ void ApplyUpdate::handle(RemoveNode& _rChange)
};
// -----------------------------------------------------------------------------
- struct BackwardTreeDifferenceBuilder : data::SetVisitor
- {
- protected:
- SubtreeChange& m_rChangeList;
- ISubtree const * m_pNewNode;
-
- using NodeVisitor::handle;
- public:
- BackwardTreeDifferenceBuilder(SubtreeChange& rList, ISubtree const* pNode)
- : m_rChangeList(rList)
- , m_pNewNode(pNode)
- {
- }
+class BackwardTreeDifferenceBuilder: public data::SetVisitor {
+public:
+ BackwardTreeDifferenceBuilder(SubtreeChange & list, ISubtree const * node):
+ m_changeList(list), m_newNode(node) {}
- Result applyToChildren(data::NodeAccess const & _aCacheNode)
- {
- if (data::GroupNodeAccess::isInstance(_aCacheNode))
- {
- OSL_ENSURE( !m_rChangeList.isSetNodeChange(), "Building a set change for a group node" );
- return visitChildren( data::GroupNodeAccess(_aCacheNode) );
- }
- else if (data::SetNodeAccess::isInstance(_aCacheNode))
- {
- OSL_ENSURE( m_rChangeList.isSetNodeChange(), "Building a group change for a set node" );
- return visitElements( data::SetNodeAccess(_aCacheNode) );
- }
- else
- {
- OSL_ENSURE( m_rChangeList.ISA(ValueChange), "BackwardTreeDifferenceBuilder: Unknown node type" );
- OSL_ENSURE( !m_rChangeList.ISA(ValueChange), "Trying to build a change tree for a value node" );
- return DONE;
- }
+ void applyToChildren(sharable::Node * cacheNode) {
+ OSL_ASSERT(cacheNode != 0);
+ if (cacheNode->isGroup()) {
+ OSL_ASSERT(!m_changeList.isSetNodeChange());
+ visitChildren(&cacheNode->group);
+ } else if (cacheNode->isSet()) {
+ OSL_ASSERT(m_changeList.isSetNodeChange());
+ visitElements(&cacheNode->set);
+ } else {
+ OSL_ASSERT(false);
}
+ }
- private:
- virtual Result handle(data::ValueNodeAccess const & /*_aCacheNode*/)
- {
-#if 0 // do we really need to do nothing here?
- OUString aNodeName = _aCacheNode.getName().toString();
-
- INode const* pNewChild = m_pNewNode->getChild(aNodeName);
-
- //OSL_ENSURE(pNewChild, "BackwardTreeDifferenceBuilder: New (value) node is missing !");
-
- // if (!pNewChild) return DONE; // error stop !
-#endif
-
- return CONTINUE;
- }
-
- virtual Result handle(data::NodeAccess const & _aCacheNode)
- {
- // value nodes are handled separately
- OSL_ASSERT(!data::ValueNodeAccess::isInstance(_aCacheNode));
-
- OUString aNodeName = _aCacheNode.getName().toString();
-
- INode const* pNewChild = m_pNewNode->getChild(aNodeName);
- //OSL_ENSURE(pNewChild, "BackwardTreeDifferenceBuilder: New node is missing !");
-
- ISubtree const * pNewTree = pNewChild ? pNewChild->asISubtree() : NULL;
- //OSL_ENSURE(pNewChild, "BackwardTreeDifferenceBuilder: Inner node expected !");
-
- if (pNewTree)
- {
- // Traverse down to next change
- Change* pChange = m_rChangeList.getChange(aNodeName);
-
- std::auto_ptr<Change> pNewChange;
- SubtreeChange * pGroupChange = NULL;
-
- if (pChange)
- {
- OSL_ENSURE(pChange->ISA(SubtreeChange),"BackwardTreeDifferenceBuilder: Found wrong change for this Group Node");
- if (pChange->ISA(SubtreeChange))
- pGroupChange = static_cast<SubtreeChange*>(pChange);
- }
- else
- {
- pGroupChange = new SubtreeChange(*pNewTree);
- pNewChange.reset( pGroupChange );
- }
-
- if (pGroupChange)
- {
- BackwardTreeDifferenceBuilder aNextLevel(*pGroupChange, pNewTree);
- aNextLevel.applyToChildren(_aCacheNode);
-
- if (pNewChange.get())
- {
- // now count if there are any real changes
- OChangeActionCounter aCounter;
- aCounter.applyToChange(*pNewChange);
-
- if (aCounter.hasChanges())
- m_rChangeList.addChange(pNewChange);
+private:
+ using NodeVisitor::handle;
+
+ virtual bool handle(sharable::Node * node) {
+ OSL_ASSERT(!node->isValue());
+ INode const * newChild = m_newNode->getChild(node->getName());
+ ISubtree const * newTree = newChild == 0 ? 0 : newChild->asISubtree();
+ if (newTree != 0) {
+ // Traverse down to next change:
+ Change * change = m_changeList.getChange(node->getName());
+ std::auto_ptr< Change > newChange;
+ SubtreeChange * groupChange = 0;
+ if (change == 0) {
+ groupChange = new SubtreeChange(*newTree);
+ newChange.reset(groupChange);
+ } else {
+ groupChange = dynamic_cast< SubtreeChange * >(change);
+ OSL_ASSERT(groupChange != 0);
+ }
+ if (groupChange != 0) {
+ BackwardTreeDifferenceBuilder(*groupChange, newTree).
+ applyToChildren(node);
+ if (newChange.get() != 0) {
+ // Now count if there are any real changes:
+ OChangeActionCounter counter;
+ counter.applyToChange(*newChange);
+ if (counter.hasChanges()) {
+ m_changeList.addChange(newChange);
}
}
}
- else
- {
- // return DONE; // error stop !
- }
-
- return CONTINUE;
}
+ return false;
+ }
- virtual Result handle(data::TreeAccessor const & _aCacheElement)
- {
- OUString aElementName = _aCacheElement.getName().toString();
-
- INode const* pNewElement = m_pNewNode->getChild(aElementName);
+ virtual bool handle(sharable::ValueNode *) {
+ return false;
+ }
- if (pNewElement)
- {
- // continue: handle the root node
- return SetVisitor::handle(_aCacheElement);
- }
- else
- {
- // Remove Node
- std::auto_ptr<Change> pRemove(new RemoveNode(aElementName,
- _aCacheElement->isNew()));
+ virtual bool handle(sharable::TreeFragment * tree) {
+ INode const * newElement = m_newNode->getChild(tree->getName());
+ if (newElement == 0) {
+ // Remove node:
+ std::auto_ptr< Change > remove(
+ new RemoveNode(tree->getName(), tree->isNew()));
+ m_changeList.addChange(remove);
+ return false;
+ } else {
+ // Handle the root node:
+ return SetVisitor::handle(tree);
+ }
+ }
- m_rChangeList.addChange(pRemove);
+ SubtreeChange & m_changeList;
+ ISubtree const * m_newNode;
+};
- return CONTINUE;
- }
- }
- };
-// -----------------------------------------------------------------------------
//--------------------------------------------------------------------------
// apply a set of changes to the target tree, return true, if there are changes found
- bool createUpdateFromDifference(SubtreeChange& _rResultingUpdateTree, data::NodeAccess const & _aExistingData, ISubtree const & _aNewData)
+ bool createUpdateFromDifference(SubtreeChange& _rResultingUpdateTree, sharable::Node * existingData, ISubtree const & _aNewData)
{
- OSL_ENSURE( _aExistingData.isValid(), "Trying to create diffrence for empty data" );
+ OSL_ENSURE(existingData != 0, "Trying to create diffrence for empty data");
// create the differences
- ForwardTreeDifferenceBuilder aForwardTreeDifference(_rResultingUpdateTree, _aExistingData);
+ ForwardTreeDifferenceBuilder aForwardTreeDifference(_rResultingUpdateTree, existingData);
aForwardTreeDifference.applyToChildren(_aNewData);
BackwardTreeDifferenceBuilder aBackwardTreeDifference(_rResultingUpdateTree, & _aNewData);
- aBackwardTreeDifference.applyToChildren(_aExistingData);
+ aBackwardTreeDifference.applyToChildren(existingData);
return true;
}
diff --git a/configmgr/source/tree/valuenodeaccess.cxx b/configmgr/source/tree/valuenodeaccess.cxx
deleted file mode 100644
index 1e03933774..0000000000
--- a/configmgr/source/tree/valuenodeaccess.cxx
+++ /dev/null
@@ -1,174 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: valuenodeaccess.cxx,v $
- * $Revision: 1.8 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General 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_configmgr.hxx"
-
-#include "valuenodeaccess.hxx"
-#include <osl/diagnose.h>
-
-// -----------------------------------------------------------------------------
-
-namespace configmgr
-{
-// -----------------------------------------------------------------------------
- namespace data
- {
-
-void ValueNodeAccess::setValue(ValueNodeAddress _aValueNode,
- uno::Any const& _aValue)
-{
- sharable::ValueNode * node = _aValueNode;
-
- using namespace sharable;
- AnyData::TypeCode aType = AnyData::TypeCode( node->info.type & Type::mask_valuetype );
-
- // release old data
- if (node->info.flags & Flags::valueAvailable)
- {
- OSL_ASSERT(aType != Type::value_any);
-
- freeData(aType,node->value);
- node = _aValueNode;
-
- node->value.data = 0;
- node->info.flags ^= Flags::valueAvailable;
- }
-
- // set new value
- if (_aValue.hasValue())
- {
- AnyData::TypeCode aNewType = getTypeCode(_aValue.getValueType());
- OSL_ASSERT(aNewType != Type::value_any);
-
- // set new type, if appropriate
- if (aType == Type::value_any)
- {
- OSL_ASSERT(Type::value_any == 0);
- OSL_ASSERT(aNewType != Type::value_any);
-
- aType = AnyData::TypeCode( aNewType & Type::mask_valuetype );
-
- node->info.type |= aType;
- }
-
- OSL_ENSURE(aType == aNewType, "ERROR: setValue() - Value type does not match");
- if (aType == aNewType)
- {
- // store the data
- sharable::AnyData aNewData = allocData(aType,_aValue);
- node = _aValueNode;
-
- node->value = aNewData;
- node->info.flags |= Flags::valueAvailable;
- }
- }
- node->info.flags &= ~Flags::defaulted;
-}
-//-----------------------------------------------------------------------------
-
-void ValueNodeAccess::setToDefault(ValueNodeAddress _aValueNode)
-{
- sharable::ValueNode * node = _aValueNode;
-
- using namespace sharable;
- OSL_ENSURE(node->hasUsableDefault(), "ERROR: setToDefault() - Value does not have a default");
-
- // release value data
- if (node->info.flags & Flags::valueAvailable)
- {
- AnyData::TypeCode aType = AnyData::TypeCode( node->info.type & Type::mask_valuetype );
- OSL_ASSERT(aType != Type::value_any);
-
- freeData(aType,node->value);
- node = _aValueNode;
-
- node->value.data = 0;
- node->info.flags ^= Flags::valueAvailable;
- }
-
- node->info.flags |= Flags::defaulted;
-}
-//-----------------------------------------------------------------------------
-
-void ValueNodeAccess::changeDefault(ValueNodeAddress _aValueNode,
- uno::Any const& _aValue)
-{
- sharable::ValueNode * node = _aValueNode;
-
- using namespace sharable;
- AnyData::TypeCode aType = AnyData::TypeCode( node->info.type & Type::mask_valuetype );
-
- // release old data
- if (node->info.flags & Flags::defaultAvailable)
- {
- OSL_ASSERT(aType != Type::value_any);
-
- freeData(aType,node->defaultValue);
- node = _aValueNode;
-
- node->defaultValue.data = 0;
- node->info.flags ^= Flags::defaultAvailable;
- }
-
- // set new value
- if (_aValue.hasValue())
- {
- AnyData::TypeCode aNewType = getTypeCode(_aValue.getValueType());
- OSL_ASSERT(aNewType != Type::value_any);
-
- // set new type, if appropriate
- if (aType == Type::value_any)
- {
- OSL_ASSERT(Type::value_any == 0);
- OSL_ASSERT(aNewType != Type::value_any);
-
- aType = AnyData::TypeCode( aNewType & Type::mask_valuetype );
-
- node->info.type |= aType;
- }
-
- OSL_ENSURE(aType == aNewType, "ERROR: changeDefault() - Value type does not match");
- if (aType == aNewType)
- {
- // store the data
- sharable::AnyData aNewData = allocData(aType,_aValue);
- node = _aValueNode;
-
- node->defaultValue = aNewData;
- node->info.flags |= Flags::defaultAvailable;
- }
- }
-}
-
- } // namespace data
-} // namespace configmgr
-
-
diff --git a/configmgr/source/treecache/cacheaccess.cxx b/configmgr/source/treecache/cacheaccess.cxx
index 2ea48dc469..6f8101161f 100644
--- a/configmgr/source/treecache/cacheaccess.cxx
+++ b/configmgr/source/treecache/cacheaccess.cxx
@@ -32,14 +32,11 @@
#include "precompiled_configmgr.hxx"
#include "cacheaccess.hxx"
-#include "nodeaccess.hxx"
#include "tracer.hxx"
#include "configpath.hxx"
namespace configmgr
{
- using namespace configuration;
-
// -------------------------------------------------------------------------
CacheClientAccess::CacheClientAccess(ConfigChangeBroadcastHelper * _pBroadcastHelper)
@@ -63,28 +60,28 @@ ConfigChangeBroadcastHelper * CacheClientAccess::releaseBroadcaster()
// -------------------------------------------------------------------------
-bool CacheClientAccess::hasModule(const CacheLine::Path& _aLocation)
+bool CacheClientAccess::hasModule(const configuration::AbsolutePath& _aLocation)
{
return this->m_aData.hasModule(_aLocation.getModuleName());
}
// -------------------------------------------------------------------------
-bool CacheClientAccess::hasModuleDefaults(CacheLine::Path const& _aLocation)
+bool CacheClientAccess::hasModuleDefaults(configuration::AbsolutePath const& _aLocation)
{
return this->m_aData.hasModuleDefaults(_aLocation.getModuleName());
}
// -------------------------------------------------------------------------
-void CacheClientAccess::attachModule(data::TreeAddress _aLocation, CacheLine::Name const & _aModule)
+void CacheClientAccess::attachModule(sharable::TreeFragment * _aLocation, rtl::OUString const & _aModule)
{
this->m_aData.attachModule(_aLocation, _aModule);
}
// -------------------------------------------------------------------------
-data::NodeAddress CacheClientAccess::acquireNode(CacheLine::Path const& rLocation )
+sharable::Node * CacheClientAccess::acquireNode(configuration::AbsolutePath const& rLocation )
{
CFG_TRACE_INFO("CacheClientAccess: Requesting data for path '%s'", OUSTRING2ASCII(rLocation.toString()) );
- data::NodeAddress aResult = this->m_aData.acquireNode(rLocation);
+ sharable::Node * aResult = this->m_aData.acquireNode(rLocation);
if (aResult != NULL)
{
@@ -97,7 +94,7 @@ data::NodeAddress CacheClientAccess::acquireNode(CacheLine::Path const& rLocatio
}
// -------------------------------------------------------------------------
-oslInterlockedCount CacheClientAccess::releaseNode( CacheLine::Path const& rLocation )
+oslInterlockedCount CacheClientAccess::releaseNode( configuration::AbsolutePath const& rLocation )
{
CFG_TRACE_INFO("Tree Info: Releasing subtree data for path '%s'", OUSTRING2ASCII(rLocation.toString()) );
@@ -107,7 +104,7 @@ oslInterlockedCount CacheClientAccess::releaseNode( CacheLine::Path const& rLoca
}
// -----------------------------------------------------------------------------
-void CacheClientAccess::applyUpdate(backend::UpdateInstance & _aUpdate) CFG_UNO_THROW_RTE( )
+void CacheClientAccess::applyUpdate(backend::UpdateInstance & _aUpdate) SAL_THROW((com::sun::star::uno::RuntimeException))
{
CFG_TRACE_INFO("CacheClientAccess: Merging changes into subtree '%s'", OUSTRING2ASCII(_aUpdate.root().toString()) );
@@ -115,19 +112,15 @@ void CacheClientAccess::applyUpdate(backend::UpdateInstance & _aUpdate) CFG_UNO_
}
// -----------------------------------------------------------------------------
-data::NodeAddress CacheClientAccess::findInnerNode( CacheLine::Path const& aComponentName )
+sharable::Node * CacheClientAccess::findInnerNode( configuration::AbsolutePath const& aComponentName )
{
- data::NodeAddress aNode = this->m_aData.getNode(aComponentName);
-
- if (aNode != NULL && data::NodeAccess(aNode)->isValue() )
- aNode = data::NodeAddress();
-
- return aNode;
+ sharable::Node * node = m_aData.getNode(aComponentName);
+ return node == 0 || node->isValue() ? 0 : node;
}
// -------------------------------------------------------------------------
-bool CacheClientAccess::insertDefaults( backend::NodeInstance const & _aDefaultData ) CFG_UNO_THROW_RTE( )
+bool CacheClientAccess::insertDefaults( backend::NodeInstance const & _aDefaultData ) SAL_THROW((com::sun::star::uno::RuntimeException))
{
CFG_TRACE_INFO("Tree Info: Adding default data for path '%s'", OUSTRING2ASCII(_aDefaultData.root().toString()) );
@@ -151,25 +144,25 @@ CacheLoadingAccess::~CacheLoadingAccess()
// -------------------------------------------------------------------------
/// gets a tree reference for the given path if exists
-data::TreeAddress CacheLoadingAccess::getTreeAddress(CacheLine::Name const & _aModule)
+sharable::TreeFragment * CacheLoadingAccess::getTreeAddress(rtl::OUString const & _aModule)
{
return this->m_aData.getTreeAddress(_aModule);
}
// -------------------------------------------------------------------------
-void CacheLoadingAccess::createModule(CacheLine::Name const & _aModule)
+void CacheLoadingAccess::createModule(rtl::OUString const & _aModule)
{
this->m_aData.createModule(_aModule);
}
// -------------------------------------------------------------------------
-bool CacheLoadingAccess::hasModule(CacheLine::Name const & _aModule)
+bool CacheLoadingAccess::hasModule(rtl::OUString const & _aModule)
{
return this->m_aData.hasModule(_aModule);
}
// -------------------------------------------------------------------------
-bool CacheLoadingAccess::acquireModule(CacheLine::Name const & _aModule)
+bool CacheLoadingAccess::acquireModule(rtl::OUString const & _aModule)
{
- CFG_TRACE_INFO("Tree Info: Requesting data for module '%s'", OUSTRING2ASCII(_aModule.toString()));
+ CFG_TRACE_INFO("Tree Info: Requesting data for module '%s'", OUSTRING2ASCII(_aModule));
if (this->m_aData.acquireModule(_aModule))
{
@@ -185,9 +178,9 @@ bool CacheLoadingAccess::acquireModule(CacheLine::Name const & _aModule)
}
// -------------------------------------------------------------------------
-oslInterlockedCount CacheLoadingAccess::releaseModule( CacheLine::Name const & _aModule )
+oslInterlockedCount CacheLoadingAccess::releaseModule( rtl::OUString const & _aModule )
{
- CFG_TRACE_INFO("Tree Info: Releasing data for module '%s'", OUSTRING2ASCII(_aModule.toString()) );
+ CFG_TRACE_INFO("Tree Info: Releasing data for module '%s'", OUSTRING2ASCII(_aModule) );
oslInterlockedCount nRet = this->m_aData.releaseModule(_aModule,true); // keep
if (nRet == 0)
@@ -213,15 +206,15 @@ bool CacheLoadingAccess::isEmpty()
}
// -------------------------------------------------------------------------
-data::TreeAddress CacheLoadingAccess::addComponentData( backend::ComponentInstance const & _aComponentInstance,
+sharable::TreeFragment * CacheLoadingAccess::addComponentData( backend::ComponentInstance const & _aComponentInstance,
bool _bIncludesDefaults
- ) CFG_UNO_THROW_RTE()
+ ) SAL_THROW((com::sun::star::uno::RuntimeException))
{
CFG_TRACE_INFO("CacheLoadingAccess: Adding component data for module '%s' : %s",
- OUSTRING2ASCII(_aComponentInstance.component().toString()),
+ OUSTRING2ASCII(_aComponentInstance.component()),
_bIncludesDefaults ? "Data includes defaults." : "Data does not include defaults." );
- data::TreeAddress aResult = this->m_aData.addComponentData(_aComponentInstance, _bIncludesDefaults);
+ sharable::TreeFragment * aResult = this->m_aData.addComponentData(_aComponentInstance, _bIncludesDefaults);
if (aResult != NULL)
{
m_aDeadModules.erase( _aComponentInstance.component() );
@@ -234,7 +227,7 @@ data::TreeAddress CacheLoadingAccess::addComponentData( backend::ComponentInstan
}
// -------------------------------------------------------------------------
// -----------------------------------------------------------------------------
-void CacheLoadingAccess::addChangesToPending( backend::ConstUpdateInstance const& _anUpdate ) CFG_UNO_THROW_RTE( )
+void CacheLoadingAccess::addChangesToPending( backend::ConstUpdateInstance const& _anUpdate ) SAL_THROW((com::sun::star::uno::RuntimeException))
{
// NICE: m_pPending[_rLocation] += pSubtreeChange;
CFG_TRACE_INFO("CacheLoadingAccess: Adding pending changes for subtree '%s'", OUSTRING2ASCII(_anUpdate.root().toString()) );
@@ -243,29 +236,27 @@ void CacheLoadingAccess::addChangesToPending( backend::ConstUpdateInstance const
}
// -----------------------------------------------------------------------------
-std::auto_ptr<SubtreeChange> CacheLoadingAccess::releasePendingChanges(CacheLine::Name const& _aComponentName)
+std::auto_ptr<SubtreeChange> CacheLoadingAccess::releasePendingChanges(rtl::OUString const& _aComponentName)
{
- CFG_TRACE_INFO("Tree Info: extract pending changes from subtree '%s'", OUSTRING2ASCII(_aComponentName.toString()) );
+ CFG_TRACE_INFO("Tree Info: extract pending changes from subtree '%s'", OUSTRING2ASCII(_aComponentName) );
return this->m_aData.releasePending(_aComponentName);
}
// -----------------------------------------------------------------------------
-bool CacheLoadingAccess::findPendingChangedModules( ExtendedCacheData::PendingModuleList & _rPendingList )
+bool CacheLoadingAccess::findPendingChangedModules( std::vector< rtl::OUString > & _rPendingList )
{
this->m_aData.findPendingModules(_rPendingList);
return !_rPendingList.empty();
}
// -----------------------------------------------------------------------------
-void CacheLoadingAccess::clearData(DisposeList& _rList) CFG_NOTHROW()
+void CacheLoadingAccess::clearData(std::vector< rtl::Reference<CacheLine> >& _rList) SAL_THROW(())
{
CFG_TRACE_INFO("Tree Info: Removing all module trees for cleanup" );
- typedef ExtendedCacheData::ModuleList ModuleList;
-
- ModuleList& rModules = this->m_aData.accessModuleList();
+ ExtendedCacheData::ModuleList& rModules = this->m_aData.accessModuleList();
- for(ModuleList::iterator it = rModules.begin();
+ for(ExtendedCacheData::ModuleList::iterator it = rModules.begin();
it != rModules.end();
++it)
{
@@ -278,7 +269,7 @@ void CacheLoadingAccess::clearData(DisposeList& _rList) CFG_NOTHROW()
}
// -------------------------------------------------------------------------
-TimeStamp CacheLoadingAccess::collectDisposeList(CacheLoadingAccess::DisposeList & _rList, TimeStamp const & _aLimitTime, TimeInterval const & _aDelay)
+TimeStamp CacheLoadingAccess::collectDisposeList(std::vector< rtl::Reference<CacheLine> > & _rList, TimeStamp const & _aLimitTime, TimeInterval const & _aDelay)
{
TimeStamp aRetTime = TimeStamp::never();
@@ -286,16 +277,16 @@ TimeStamp CacheLoadingAccess::collectDisposeList(CacheLoadingAccess::DisposeList
ExtendedCacheData::ModuleList& rActiveModules = this->m_aData.accessModuleList();
- DeadModuleList::iterator it = m_aDeadModules.begin();
+ std::map< rtl::OUString, TimeStamp >::iterator it = m_aDeadModules.begin();
while (it != m_aDeadModules.end())
{
- DeadModuleList::iterator current = it;
+ std::map< rtl::OUString, TimeStamp >::iterator current = it;
// increment here, as we may later erase(current)
++it;
#if (OSL_DEBUG_LEVEL > 0) || defined _DBG_UTIL || defined CFG_TRACE_ENABLE
- OUString sCurrentName( current->first.toString() );
+ rtl::OUString sCurrentName( current->first );
#endif
TimeStamp aExpireTime = current->second + _aDelay;
if (aExpireTime <= _aLimitTime)
@@ -304,7 +295,7 @@ TimeStamp CacheLoadingAccess::collectDisposeList(CacheLoadingAccess::DisposeList
if (itModule != rActiveModules.end())
{
- CacheLineRef xModule = itModule->second;
+ rtl::Reference<CacheLine> xModule = itModule->second;
bool bHandled = false;
diff --git a/configmgr/source/treecache/cacheaccess.hxx b/configmgr/source/treecache/cacheaccess.hxx
index 4a8c6fdcef..fbe1396a9f 100644
--- a/configmgr/source/treecache/cacheaccess.hxx
+++ b/configmgr/source/treecache/cacheaccess.hxx
@@ -34,17 +34,17 @@
#include "cachedata.hxx"
#include "timestamp.hxx"
#include "utility.hxx"
+#include <boost/utility.hpp>
#include <osl/mutex.hxx>
#ifndef _CONFIGMGR_UTILITY_HXX_
#include <utility.hxx>
#endif
#include <rtl/ref.hxx>
+#include <salhelper/simplereferenceobject.hxx>
namespace configmgr
{
////////////////////////////////////////////////////////////////////////////////
- using ::rtl::OUString;
-
class ConfigChangeBroadcastHelper;
namespace backend
{
@@ -52,7 +52,7 @@ namespace configmgr
}
//-----------------------------------------------------------------------------
- class CacheClientAccess : public configmgr::SimpleReferenceObject, Noncopyable
+ class CacheClientAccess: private boost::noncopyable, public salhelper::SimpleReferenceObject
{
private:
CacheData m_aData;
@@ -72,88 +72,86 @@ namespace configmgr
ConfigChangeBroadcastHelper * releaseBroadcaster();
// attach a module with a given name
- void attachModule(data::TreeAddress _aLocation, CacheLine::Name const & _aModule);
+ void attachModule(sharable::TreeFragment * _aLocation, rtl::OUString const & _aModule);
/// check if the given module exists already (and is not empty)
- bool hasModule(const CacheLine::Path& _aLocation);
+ bool hasModule(const configuration::AbsolutePath& _aLocation);
/// checks if the given module exists and has defaults available
- bool hasModuleDefaults(CacheLine::Path const & _aLocation);
+ bool hasModuleDefaults(configuration::AbsolutePath const & _aLocation);
/// retrieve the subtree at _aPath (maybe if it has the requested defaults) and clientAcquire() it
- data::NodeAddress acquireNode(CacheLine::Path const& _aPath);
+ sharable::Node * acquireNode(configuration::AbsolutePath const& _aPath);
/** add or merge the given subtree at the given location,
return <TRUE/> if the tree has defaults then
*/
- bool insertDefaults( backend::NodeInstance const & _aDefaultData ) CFG_UNO_THROW_RTE( );
+ bool insertDefaults( backend::NodeInstance const & _aDefaultData ) SAL_THROW((com::sun::star::uno::RuntimeException));
/// clientRelease() the tree at aComponentName, and return the resulting reference count
- oslInterlockedCount releaseNode( CacheLine::Path const& _aPath );
+ oslInterlockedCount releaseNode( configuration::AbsolutePath const& _aPath );
/// retrieve the given subtree without changing its ref count
- data::NodeAddress findInnerNode(CacheLine::Path const& _aPath );
+ sharable::Node * findInnerNode(configuration::AbsolutePath const& _aPath );
/// merge the given change list into this tree - reflects old data to _aUpdate
- void applyUpdate(backend::UpdateInstance & _aUpdate) CFG_UNO_THROW_RTE( );
+ void applyUpdate(backend::UpdateInstance & _aUpdate) SAL_THROW((com::sun::star::uno::RuntimeException));
};
////////////////////////////////////////////////////////////////////////////////
- class CacheLoadingAccess : public configmgr::SimpleReferenceObject, Noncopyable
+ class CacheLoadingAccess: private boost::noncopyable, public salhelper::SimpleReferenceObject
{
public:
- typedef std::vector< CacheLineRef > DisposeList;
friend class backend::CacheController;
private:
friend class CacheDisposeScheduler;
- typedef std::map< CacheLine::Name, TimeStamp > DeadModuleList;
ExtendedCacheData m_aData;
- DeadModuleList m_aDeadModules; /// list of nodes which are registered for throwing away
+ std::map< rtl::OUString, TimeStamp > m_aDeadModules; /// list of nodes which are registered for throwing away
public:
explicit
CacheLoadingAccess();
~CacheLoadingAccess();
/// gets a tree address for the given module if it exists
- data::TreeAddress getTreeAddress(CacheLine::Name const & _aModule);
+ sharable::TreeFragment * getTreeAddress(rtl::OUString const & _aModule);
/// return TRUE if there is no data (left) in this object's cache data
bool isEmpty();
// create a module with a given name
- void createModule(CacheLine::Name const & _aModule);
+ void createModule(rtl::OUString const & _aModule);
/// check if the given module exists already (and is not empty)
- bool hasModule(CacheLine::Name const & _aLocation);
+ bool hasModule(rtl::OUString const & _aLocation);
/// retrieve the subtree at aComponentName and clientAcquire() it, true if succeeded
- bool acquireModule(CacheLine::Name const & _aModule);
+ bool acquireModule(rtl::OUString const & _aModule);
/// clientRelease() the tree at aComponentName, and return the resulting reference count
- oslInterlockedCount releaseModule( CacheLine::Name const & _aModule );
+ oslInterlockedCount releaseModule( rtl::OUString const & _aModule );
/// collect the modules that can be disposed now (i.e. released after _rLimitReleaseTime)
- TimeStamp collectDisposeList(CacheLoadingAccess::DisposeList & _rList,
+ TimeStamp collectDisposeList(std::vector< rtl::Reference<CacheLine> > & _rList,
TimeStamp const & _aLimitTime,
TimeInterval const & _aDelay);
/// clear the contained tree, return all remaining modules
- void clearData( DisposeList& _rDisposeList) CFG_NOTHROW();
+ void clearData( std::vector< rtl::Reference<CacheLine> >& _rDisposeList) SAL_THROW(());
// stuff that is particular for CacheLoadingAccess
/** add the given subtree at the given location,
return the tree that is then pertinent and clientAcquire() it once
*/
- data::TreeAddress addComponentData( backend::ComponentInstance const & _aComponentInstance,
+ sharable::TreeFragment * addComponentData( backend::ComponentInstance const & _aComponentInstance,
bool _bIncludesDefaults
- ) CFG_UNO_THROW_RTE();
+ ) SAL_THROW((com::sun::star::uno::RuntimeException));
/// merge the given change list into the pending change list of this tree
- void addChangesToPending( backend::ConstUpdateInstance const& _anUpdate ) CFG_UNO_THROW_RTE( );
+ void addChangesToPending( backend::ConstUpdateInstance const& _anUpdate ) SAL_THROW((com::sun::star::uno::RuntimeException));
/// retrieve accumulated pending changes
- std::auto_ptr<SubtreeChange> releasePendingChanges(CacheLine::Name const& _aModule);
+ std::auto_ptr<SubtreeChange> releasePendingChanges(rtl::OUString const& _aModule);
/// find the modules having pending changes
- bool findPendingChangedModules( ExtendedCacheData::PendingModuleList & _rPendingList );
+ bool findPendingChangedModules( std::vector< rtl::OUString > & _rPendingList );
};
diff --git a/configmgr/source/treecache/cachecontroller.cxx b/configmgr/source/treecache/cachecontroller.cxx
index 4f460c37b3..6aa34a68ca 100644
--- a/configmgr/source/treecache/cachecontroller.cxx
+++ b/configmgr/source/treecache/cachecontroller.cxx
@@ -34,7 +34,6 @@
#include "cachecontroller.hxx"
#include "disposetimer.hxx"
#include "cachewritescheduler.hxx"
-#include "treeaccessor.hxx"
#include "builddata.hxx"
#include "localizedtreeactions.hxx"
#include "configexcept.hxx"
@@ -65,16 +64,16 @@ static const rtl::OUString kCacheWriteInterval(
RTL_CONSTASCII_USTRINGPARAM( CONTEXT_ITEM_PREFIX_ "CacheWriteInterval"));
// -------------------------------------------------------------------------
-OTreeDisposeScheduler* CacheController::createDisposer(const CreationContext& _xContext)
+OTreeDisposeScheduler* CacheController::createDisposer(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _xContext)
{
ContextReader aReader(_xContext);
sal_uInt32 c_nDefaultDelay = 0;
- OUString sDefaultDelay;
+ rtl::OUString sDefaultDelay;
aReader.getBestContext()->getValueByName(kCacheDisposeDelay) >>= sDefaultDelay;
c_nDefaultDelay = sDefaultDelay.toInt32()==0?900:sDefaultDelay.toInt32() ;
sal_uInt32 c_nDefaultInterval = 0;
- OUString sDefaultInterval;
+ rtl::OUString sDefaultInterval;
aReader.getBestContext()->getValueByName(kCacheDisposeInterval) >>= sDefaultInterval;
c_nDefaultInterval = sDefaultInterval.toInt32()==0?60:sDefaultInterval.toInt32();
@@ -86,11 +85,11 @@ OTreeDisposeScheduler* CacheController::createDisposer(const CreationContext& _x
// -----------------------------------------------------------------------------
-OCacheWriteScheduler* CacheController::createCacheWriter(const CreationContext& _xContext)
+OCacheWriteScheduler* CacheController::createCacheWriter(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _xContext)
{
ContextReader aReader(_xContext);
sal_uInt32 c_nDefaultInterval=0;
- OUString sDefaultInterval;
+ rtl::OUString sDefaultInterval;
aReader.getBestContext()->getValueByName(kCacheWriteInterval) >>= sDefaultInterval;
c_nDefaultInterval = sDefaultInterval.toInt32()==0?2:sDefaultInterval.toInt32();
@@ -99,12 +98,12 @@ OCacheWriteScheduler* CacheController::createCacheWriter(const CreationContext&
}
// ----------------------------------------------------------------------------
-CacheController::CacheRef CacheController::getCacheAlways(RequestOptions const & _aOptions)
+rtl::Reference<CacheLoadingAccess> CacheController::getCacheAlways(RequestOptions const & _aOptions)
{
- CacheRef aResult = m_aCacheMap.get(_aOptions);
+ rtl::Reference<CacheLoadingAccess> aResult = m_aCacheMap.get(_aOptions);
if (!aResult.is())
{
- CacheRef aNewCache( new Cache() );
+ rtl::Reference<CacheLoadingAccess> aNewCache( new CacheLoadingAccess() );
aResult = m_aCacheMap.insert(_aOptions,aNewCache);
}
return aResult;
@@ -135,7 +134,7 @@ void CacheController::disposeAll(bool _bFlushRemainingUpdates)
}
// -------------------------------------------------------------------------
-void CacheController::dispose() CFG_UNO_THROW_RTE()
+void CacheController::dispose() SAL_THROW((com::sun::star::uno::RuntimeException))
{
UnoApiLock aLock;
@@ -167,7 +166,7 @@ void CacheController::disposeOne(RequestOptions const & _aOptions, bool _bFlushU
CFG_TRACE_WARNING_NI("Found orphaned Changes in the cache - Discarding.");
}
- CacheRef aRemoved = m_aCacheMap.remove(_aOptions);
+ rtl::Reference<CacheLoadingAccess> aRemoved = m_aCacheMap.remove(_aOptions);
if (aRemoved.is())
{
@@ -184,12 +183,10 @@ void CacheController::disposeUser(RequestOptions const & _aUserOptions, bool _bF
CFG_TRACE_INFO("CacheController: Disposing data and TreeInfo(s) for user '%s'",
OUSTRING2ASCII(_aUserOptions.getEntity()) );
- typedef std::vector< std::pair< RequestOptions, CacheRef > > DisposeList;
-
- DisposeList aDisposeList;
+ std::vector< std::pair< RequestOptions, rtl::Reference<CacheLoadingAccess> > > aDisposeList;
// collect the ones to dispose
{
- OUString sUser = _aUserOptions.getEntity();
+ rtl::OUString sUser = _aUserOptions.getEntity();
OSL_ASSERT(sUser.getLength());
// This depends on the fact that Options are sorted (by struct ltOptions)
@@ -245,7 +242,7 @@ void CacheController::disposeUser(RequestOptions const & _aUserOptions, bool _bF
}
// got all out of external reach - now dispose/notify without lock
- for (DisposeList::iterator i = aDisposeList.begin(); i != aDisposeList.end(); ++i)
+ for (std::vector< std::pair< RequestOptions, rtl::Reference<CacheLoadingAccess> > >::iterator i = aDisposeList.begin(); i != aDisposeList.end(); ++i)
{
if (i->second.is())
implDisposeOne(i->second, i->first, _bFlushUpdates);
@@ -253,7 +250,7 @@ void CacheController::disposeUser(RequestOptions const & _aUserOptions, bool _bF
}
// -------------------------------------------------------------------------
-void CacheController::implDisposeOne(CacheRef const & _aDisposedCache, RequestOptions const & _aOptions, bool _bFlushUpdates)
+void CacheController::implDisposeOne(rtl::Reference<CacheLoadingAccess> const & _aDisposedCache, RequestOptions const & _aOptions, bool _bFlushUpdates)
{
OSL_ASSERT(_aDisposedCache.is());
CFG_TRACE_INFO("Now removing Cache section (user '%s' with locale '%s')",
@@ -275,7 +272,7 @@ void CacheController::implDisposeOne(CacheRef const & _aDisposedCache, RequestOp
CFG_TRACE_ERROR_NI("- Failed with exception %s (ignoring here)", OUSTRING2ASCII(e.Message) );
}
- Cache::DisposeList aDisposedList;
+ std::vector< rtl::Reference<CacheLine> > aDisposedList;
_aDisposedCache->clearData(aDisposedList);
if (aDisposedList.size() > 0)
@@ -286,7 +283,7 @@ void CacheController::implDisposeOne(CacheRef const & _aDisposedCache, RequestOp
}
// -------------------------------------------------------------------------
-CacheController::CacheController(BackendRef const & _xBackend,
+CacheController::CacheController(rtl::Reference< backend::IMergedDataProvider > const & _xBackend,
const uno::Reference<uno::XComponentContext>& xContext)
: m_aNotifier()
, m_xBackend(_xBackend)
@@ -310,12 +307,12 @@ CacheController::~CacheController()
}
// -------------------------------------------------------------------------
-void CacheController::closeModules(Cache::DisposeList & _aList, RequestOptions const & _aOptions)
+void CacheController::closeModules(std::vector< rtl::Reference<CacheLine> > & _aList, RequestOptions const & _aOptions)
{
//Remove listeners from Backend as module no longer in cache
for (sal_uInt32 i =0; i < _aList.size(); ++i)
{
- Name aModuleName = _aList[i]->getModuleName();
+ rtl::OUString aModuleName = _aList[i]->getModuleName();
ComponentRequest aRequest(aModuleName, _aOptions);
m_xBackend->removeRequestListener(this, aRequest);
}
@@ -351,18 +348,18 @@ std::auto_ptr<ISubtree> reduceSubtreeForLocale(std::auto_ptr<ISubtree> _pSubtree
#endif
// -------------------------------------------------------------------------
-CacheLocation CacheController::loadComponent(ComponentRequest const & _aRequest)
+sharable::TreeFragment * CacheController::loadComponent(ComponentRequest const & _aRequest)
{
- CFG_TRACE_INFO("CacheController: loading component '%s'", OUSTRING2ASCII(_aRequest.getComponentName().toString()));
+ CFG_TRACE_INFO("CacheController: loading component '%s'", OUSTRING2ASCII(_aRequest.getComponentName()));
RTL_LOGFILE_CONTEXT_AUTHOR(aLog, "configmgr::backend::CacheController", "jb99855", "configmgr: CacheController::loadComponent()");
RTL_LOGFILE_CONTEXT_TRACE1(aLog, "component: %s", RTL_LOGFILE_OU2A(_aRequest.getComponentName().toString()) );
- CacheRef aCache = this->getCacheAlways(_aRequest.getOptions());
+ rtl::Reference<CacheLoadingAccess> aCache = this->getCacheAlways(_aRequest.getOptions());
OSL_ENSURE(aCache.is(), "Could not create CacheAccess");
- data::TreeAddress aTemplateResultAdddress;
+ sharable::TreeFragment * aTemplateResultAdddress;
OSL_ENSURE(!_aRequest.isForcingReload(),"CacheController: No support for forced requests");
if (aCache->hasModule(_aRequest.getComponentName()))
@@ -376,15 +373,13 @@ CacheLocation CacheController::loadComponent(ComponentRequest const & _aRequest)
}
else
{
- ComponentResult aData = this->loadDirectly(_aRequest,true);
-
- bool bWithDefaults = ! m_xBackend->isStrippingDefaults();
+ ResultHolder< ComponentInstance > aData = this->loadDirectly(_aRequest,true);
CFG_TRACE_INFO_NI("CacheController: adding loaded data to the cache");
aCache->createModule(_aRequest.getComponentName());
- aCache->addComponentData(aData.instance(), bWithDefaults);
+ aCache->addComponentData(aData.instance(), true);
if (aData.instance().templateData().get()!=NULL)
aTemplateResultAdddress = addTemplates(aData.mutableInstance().componentTemplateData() );
@@ -396,37 +391,37 @@ CacheLocation CacheController::loadComponent(ComponentRequest const & _aRequest)
}
// -------------------------------------------------------------------------
-ComponentResult CacheController::getComponentData(ComponentRequest const & _aRequest,
- bool _bAddListenter ) CFG_UNO_THROW_ALL()
+ResultHolder< ComponentInstance > CacheController::getComponentData(ComponentRequest const & _aRequest,
+ bool _bAddListenter ) SAL_THROW((com::sun::star::uno::Exception))
{
// TODO: Insert check here, if the data is in the cache already - and then clone
RTL_LOGFILE_CONTEXT_AUTHOR(aLog, "configmgr::backend::CacheController", "jb99855", "configmgr: CacheController::getComponentData()");
RTL_LOGFILE_CONTEXT_TRACE1(aLog, "component: %s", RTL_LOGFILE_OU2A(_aRequest.getComponentName().toString()) );
- ComponentResult aRet = this->loadDirectly(_aRequest, _bAddListenter);
+ ResultHolder< ComponentInstance > aRet = this->loadDirectly(_aRequest, _bAddListenter);
return aRet;
}
// -------------------------------------------------------------------------
-NodeResult CacheController::getDefaultData(NodeRequest const & _aRequest) CFG_UNO_THROW_ALL( )
+ResultHolder< NodeInstance > CacheController::getDefaultData(NodeRequest const & _aRequest) SAL_THROW((com::sun::star::uno::Exception))
{
// TODO: Insert check here, if the data is in the cache already - and then clone
RTL_LOGFILE_CONTEXT_AUTHOR(aLog, "configmgr::backend::CacheController", "jb99855", "configmgr: CacheController::getDefaultData()");
RTL_LOGFILE_CONTEXT_TRACE1(aLog, "path: %s", RTL_LOGFILE_OU2A(_aRequest.getPath().toString()) );
- NodeResult aRet = this->loadDefaultsDirectly(_aRequest);
+ ResultHolder< NodeInstance > aRet = this->loadDefaultsDirectly(_aRequest);
return aRet;
}
// -------------------------------------------------------------------------
-AbsolutePath CacheController::encodeTemplateLocation(const Name& _rName, const Name &_rModule) const
+configuration::AbsolutePath CacheController::encodeTemplateLocation(const rtl::OUString& _rName, const rtl::OUString &_rModule) const
{
namespace Path = configuration::Path;
// static const
-// Component aTemplateRoot = wrapSimpleName(OUString::createFromAscii("org.openoffice.Templates"));
+// Component aTemplateRoot = wrapSimpleName(rtl::OUString::createFromAscii("org.openoffice.Templates"));
Path::Component aTemplateModule = Path::wrapSimpleName(_rModule);
Path::Component aTemplateName = Path::wrapSimpleName(_rName);
@@ -435,32 +430,32 @@ AbsolutePath CacheController::encodeTemplateLocation(const Name& _rName, const N
aResult.prepend(aTemplateModule);
// aResult.prepend(aTemplateRoot);
- return AbsolutePath(aResult);
+ return configuration::AbsolutePath(aResult);
}
// -------------------------------------------------------------------------
#if 0
static
-AbsolutePath templateLoadLocation(const AbsolutePath &_rTemplateLocation)
+configuration::AbsolutePath templateLoadLocation(const configuration::AbsolutePath &_rTemplateLocation)
{
namespace Path = configuration::Path;
static const
- Path::Component aTemplateRoot = Path::wrapSimpleName(OUString::createFromAscii("org.openoffice.Templates"));
+ Path::Component aTemplateRoot = Path::wrapSimpleName(rtl::OUString::createFromAscii("org.openoffice.Templates"));
Path::Rep aResult(_rTemplateLocation.rep());
aResult.prepend(aTemplateRoot);
- return AbsolutePath(aResult);
+ return configuration::AbsolutePath(aResult);
}
#endif
// -------------------------------------------------------------------------
-std::auto_ptr<ISubtree> CacheController::loadTemplateData(TemplateRequest const & _aTemplateRequest) CFG_UNO_THROW_ALL( )
+std::auto_ptr<ISubtree> CacheController::loadTemplateData(TemplateRequest const & _aTemplateRequest) SAL_THROW((com::sun::star::uno::Exception))
{
std::auto_ptr<ISubtree> aMultiTemplates;
- TemplateResult aTemplateInstance = m_xBackend->getTemplateData(_aTemplateRequest);
+ ResultHolder< TemplateInstance > aTemplateInstance = m_xBackend->getTemplateData(_aTemplateRequest);
if (aTemplateInstance.is())
{
- OSL_ASSERT(aTemplateInstance->name().isEmpty());
+ OSL_ASSERT(aTemplateInstance->name().getLength() == 0);
if (ISubtree * pMulti = aTemplateInstance->data()->asISubtree())
{
aTemplateInstance.releaseAndClear();
@@ -481,13 +476,13 @@ std::auto_ptr<ISubtree> CacheController::loadTemplateData(TemplateRequest const
return aMultiTemplates;
}
// -------------------------------------------------------------------------
-data::TreeAddress CacheController::addTemplates ( backend::ComponentData const & _aComponentInstance )
+sharable::TreeFragment * CacheController::addTemplates ( backend::ComponentDataStruct const & _aComponentInstance )
{
OSL_PRECOND(_aComponentInstance.data.get(), "addTemplates: Data must not be NULL");
- CacheLine::Name aModuleName = _aComponentInstance.name;
+ rtl::OUString aModuleName = _aComponentInstance.name;
m_aTemplates.createModule(aModuleName);
- AbsolutePath aTemplateLocation = AbsolutePath::makeModulePath(_aComponentInstance.name , AbsolutePath::NoValidate());
- data::TreeAddress aTemplateAddr = NULL;
+ configuration::AbsolutePath aTemplateLocation = configuration::AbsolutePath::makeModulePath(_aComponentInstance.name);
+ sharable::TreeFragment * aTemplateAddr = NULL;
if (!m_aTemplates.hasNode(aTemplateLocation ))
{
@@ -499,10 +494,10 @@ data::TreeAddress CacheController::addTemplates ( backend::ComponentData const &
}
// -------------------------------------------------------------------------
-CacheLocation CacheController::loadTemplate(TemplateRequest const & _aRequest) CFG_UNO_THROW_ALL( )
+sharable::TreeFragment * CacheController::loadTemplate(TemplateRequest const & _aRequest) SAL_THROW((com::sun::star::uno::Exception))
{
- OSL_ENSURE(!_aRequest.getTemplateName().isEmpty(), "CacheController::loadTemplate : invalid template name !");
+ OSL_ENSURE(_aRequest.getTemplateName().getLength() != 0, "CacheController::loadTemplate : invalid template name !");
RTL_LOGFILE_CONTEXT_AUTHOR(aLog, "configmgr::backend::CacheController", "jb99855", "configmgr: CacheController::loadTemplate()");
RTL_LOGFILE_CONTEXT_TRACE2(aLog, "requested template: %s/%s",
RTL_LOGFILE_OU2A(_aRequest.getComponentName().toString()) ,
@@ -510,11 +505,11 @@ CacheLocation CacheController::loadTemplate(TemplateRequest const & _aRequest) C
"*" : RTL_LOGFILE_OU2A(_aRequest.getComponentName().toString()) );
- AbsolutePath aTemplateLocation = encodeTemplateLocation(_aRequest.getTemplateName(), _aRequest.getComponentName());
+ configuration::AbsolutePath aTemplateLocation = encodeTemplateLocation(_aRequest.getTemplateName(), _aRequest.getComponentName());
- CacheLine::Name aModuleName = aTemplateLocation.getModuleName();
+ rtl::OUString aModuleName = aTemplateLocation.getModuleName();
- AbsolutePath aTemplateParent (aTemplateLocation.getParentPath());
+ configuration::AbsolutePath aTemplateParent (aTemplateLocation.getParentPath());
//Load-if-not-there (componentwise)
if (!m_aTemplates.hasNode(aTemplateParent))
@@ -524,10 +519,10 @@ CacheLocation CacheController::loadTemplate(TemplateRequest const & _aRequest) C
std::auto_ptr<ISubtree> aMultiTemplates = loadTemplateData(aTemplateRequest);
//add-if-not-loaded
- addTemplates(backend::ComponentData(aMultiTemplates, aModuleName));
+ addTemplates(backend::ComponentDataStruct(aMultiTemplates, aModuleName));
}
- data::TreeAddress aTemplateAddr = m_aTemplates.getTemplateTree(aTemplateLocation);
+ sharable::TreeFragment * aTemplateAddr = m_aTemplates.getTemplateTree(aTemplateLocation);
if (aTemplateAddr == NULL)
throw uno::Exception(::rtl::OUString::createFromAscii("Unknown template. Type description could not be found in the given module."), NULL);
@@ -535,8 +530,8 @@ CacheLocation CacheController::loadTemplate(TemplateRequest const & _aRequest) C
}
// -----------------------------------------------------------------------------
-TemplateResult CacheController::getTemplateData(TemplateRequest const & _aRequest)
- CFG_UNO_THROW_ALL()
+ResultHolder< TemplateInstance > CacheController::getTemplateData(TemplateRequest const & _aRequest)
+ SAL_THROW((com::sun::star::uno::Exception))
{
RTL_LOGFILE_CONTEXT_AUTHOR(aLog, "configmgr::backend::CacheController", "jb99855", "configmgr: CacheController::getTemplateData()");
RTL_LOGFILE_CONTEXT_TRACE2(aLog, "requested template: %s/%s",
@@ -544,26 +539,24 @@ TemplateResult CacheController::getTemplateData(TemplateRequest const & _aReques
_aRequest.isComponentRequest() ?
"*" : RTL_LOGFILE_OU2A(_aRequest.getComponentName().toString()) );
- AbsolutePath aTemplateLocation = encodeTemplateLocation(_aRequest.getTemplateName(), _aRequest.getComponentName());
+ configuration::AbsolutePath aTemplateLocation = encodeTemplateLocation(_aRequest.getTemplateName(), _aRequest.getComponentName());
loadTemplate(_aRequest);
- //AbsolutePath aTemplateLocation = ensureTemplate(_aRequest.getTemplateName(), _aRequest.getComponentName());
+ //configuration::AbsolutePath aTemplateLocation = ensureTemplate(_aRequest.getTemplateName(), _aRequest.getComponentName());
- data::TreeAddress aTemplateAddr = m_aTemplates.getTemplateTree(aTemplateLocation);
+ sharable::TreeFragment * aTemplateAddr = m_aTemplates.getTemplateTree(aTemplateLocation);
if (aTemplateAddr == NULL)
throw uno::Exception(::rtl::OUString::createFromAscii("Unknown template. Type description could not be found in the given module."), NULL);
- data::TreeAccessor aTemplateTree(aTemplateAddr);
-
- std::auto_ptr<INode> aResultTree = data::convertTree(aTemplateTree, true);
+ std::auto_ptr<INode> aResultTree = data::convertTree(aTemplateAddr, true);
TemplateInstance aResult(aResultTree,_aRequest.getTemplateName(), _aRequest.getComponentName());
- return TemplateResult(aResult);
+ return ResultHolder< TemplateInstance >(aResult);
}
// -----------------------------------------------------------------------------
-void CacheController::saveAndNotify(UpdateRequest const & _anUpdate) CFG_UNO_THROW_ALL( )
+void CacheController::saveAndNotify(UpdateRequest const & _anUpdate) SAL_THROW((com::sun::star::uno::Exception))
{
RTL_LOGFILE_CONTEXT_AUTHOR(aLog, "configmgr::backend::CacheController", "jb99855", "configmgr: CacheController::saveAndNotify()");
RTL_LOGFILE_CONTEXT_TRACE1(aLog, "location: %s", RTL_LOGFILE_OU2A(_anUpdate.getUpdateRoot().toString()) );
@@ -573,11 +566,11 @@ void CacheController::saveAndNotify(UpdateRequest const & _anUpdate) CFG_UNO_THR
// caller must own a read lock on this cache line
CFG_TRACE_INFO("CacheController: saving an update for '%s'",OUSTRING2ASCII(_anUpdate.getUpdateRoot().toString()));
- CacheRef aCache = m_aCacheMap.get(_anUpdate.getOptions());
+ rtl::Reference<CacheLoadingAccess> aCache = m_aCacheMap.get(_anUpdate.getOptions());
OSL_ENSURE(aCache.is(), "No cache data to update in saveAndNotify");
- if (!aCache.is()) throw lang::DisposedException(OUString::createFromAscii("Tree to be updated was already disposed"), NULL);
+ if (!aCache.is()) throw lang::DisposedException(rtl::OUString::createFromAscii("Tree to be updated was already disposed"), NULL);
aCache->addChangesToPending(_anUpdate.getUpdate());
@@ -607,7 +600,7 @@ void CacheController::saveAndNotify(UpdateRequest const & _anUpdate) CFG_UNO_THR
}
// -----------------------------------------------------------------------------
-void CacheController::flushPendingUpdates()CFG_UNO_THROW_ALL()
+void CacheController::flushPendingUpdates()SAL_THROW((com::sun::star::uno::Exception))
{
CacheMap::Map aFlushList = m_aCacheMap.copy();
@@ -615,7 +608,7 @@ void CacheController::flushPendingUpdates()CFG_UNO_THROW_ALL()
saveAllPendingChanges(it->second,it->first);
}
-void CacheController::flushCacheWriter()CFG_NOTHROW()
+void CacheController::flushCacheWriter()SAL_THROW(())
{
//OSL_ASSERT(m_bDisposing);
@@ -660,15 +653,15 @@ bool CacheController::normalizeResult(std::auto_ptr<ISubtree> & _aResult, Reque
}
// -----------------------------------------------------------------------------
-ComponentResult CacheController::loadDirectly(ComponentRequest const & _aRequest, bool _bAddListenter) CFG_UNO_THROW_ALL( )
+ResultHolder< ComponentInstance > CacheController::loadDirectly(ComponentRequest const & _aRequest, bool _bAddListenter) SAL_THROW((com::sun::star::uno::Exception))
{
- CFG_TRACE_INFO("CacheController: loading data for component '%s' from the backend", OUSTRING2ASCII(_aRequest.getComponentName().toString()));
+ CFG_TRACE_INFO("CacheController: loading data for component '%s' from the backend", OUSTRING2ASCII(_aRequest.getComponentName()));
- AbsolutePath aRequestPath = AbsolutePath::makeModulePath(_aRequest.getComponentName(), AbsolutePath::NoValidate());
+ configuration::AbsolutePath aRequestPath = configuration::AbsolutePath::makeModulePath(_aRequest.getComponentName());
NodeRequest aNodeRequest(aRequestPath, _aRequest.getOptions());
- ComponentResult aResult = m_xBackend->getNodeData(_aRequest, this, _bAddListenter?this:NULL);
+ ResultHolder< ComponentInstance > aResult = m_xBackend->getNodeData(_aRequest, this, _bAddListenter?this:NULL);
OSL_PRECOND(aResult.mutableInstance().mutableData().get(), "loadDirectly: Data must not be NULL");
@@ -678,9 +671,9 @@ ComponentResult CacheController::loadDirectly(ComponentRequest const & _aRequest
{
CFG_TRACE_ERROR_NI(" - cannot normalized result: failing");
- OUString sMsg(RTL_CONSTASCII_USTRINGPARAM("Requested data at '"));
+ rtl::OUString sMsg(RTL_CONSTASCII_USTRINGPARAM("Requested data at '"));
sMsg += aRequestPath.toString();
- sMsg += OUString(RTL_CONSTASCII_USTRINGPARAM("'is not available: "));
+ sMsg += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("'is not available: "));
throw com::sun::star::container::NoSuchElementException(sMsg,NULL);
}
@@ -691,11 +684,11 @@ ComponentResult CacheController::loadDirectly(ComponentRequest const & _aRequest
}
// -----------------------------------------------------------------------------
-NodeResult CacheController::loadDefaultsDirectly(NodeRequest const & _aRequest) CFG_UNO_THROW_ALL( )
+ResultHolder< NodeInstance > CacheController::loadDefaultsDirectly(NodeRequest const & _aRequest) SAL_THROW((com::sun::star::uno::Exception))
{
CFG_TRACE_INFO("CacheController: loading defaults for '%s' from the backend", OUSTRING2ASCII(_aRequest.getPath().toString()));
- NodeResult aResult = m_xBackend->getDefaultData(_aRequest);
+ ResultHolder< NodeInstance > aResult = m_xBackend->getDefaultData(_aRequest);
CFG_TRACE_INFO_NI("- loading defaultscompleted - normalizing result");
@@ -707,19 +700,19 @@ NodeResult CacheController::loadDefaultsDirectly(NodeRequest const & _aRequest)
}
// -----------------------------------------------------------------------------
-void CacheController::saveDirectly(UpdateRequest const & _anUpdate) CFG_UNO_THROW_ALL( )
+void CacheController::saveDirectly(UpdateRequest const & _anUpdate) SAL_THROW((com::sun::star::uno::Exception))
{
m_xBackend->updateNodeData(_anUpdate);
}
// -----------------------------------------------------------------------------
-void CacheController::savePendingChanges(CacheRef const & _aCache, ComponentRequest const & _aComponent) CFG_UNO_THROW_ALL( )
+void CacheController::savePendingChanges(rtl::Reference<CacheLoadingAccess> const & _aCache, ComponentRequest const & _aComponent) SAL_THROW((com::sun::star::uno::Exception))
{
- CFG_TRACE_INFO("CacheController: saving updates for tree: '%s'", OUSTRING2ASCII(_aComponent.getComponentName().toString()));
+ CFG_TRACE_INFO("CacheController: saving updates for tree: '%s'", OUSTRING2ASCII(_aComponent.getComponentName()));
try
{
- CFG_TRACE_INFO2("CacheController: saving updates for tree: '%s'", OUSTRING2ASCII(_aComponent.getComponentName().toString()));
+ CFG_TRACE_INFO2("CacheController: saving updates for tree: '%s'", OUSTRING2ASCII(_aComponent.getComponentName()));
std::auto_ptr<SubtreeChange> aChangeData = _aCache->releasePendingChanges(_aComponent.getComponentName());
@@ -727,7 +720,7 @@ void CacheController::savePendingChanges(CacheRef const & _aCache, ComponentRequ
{
CFG_TRACE_INFO_NI("- found changes - sending to backend");
- AbsolutePath aRootPath = AbsolutePath::makeModulePath(_aComponent.getComponentName(), AbsolutePath::NoValidate());
+ configuration::AbsolutePath aRootPath = configuration::AbsolutePath::makeModulePath(_aComponent.getComponentName());
backend::UpdateRequest anUpdateSpec(aChangeData.get(),aRootPath,_aComponent.getOptions());
@@ -744,7 +737,7 @@ void CacheController::savePendingChanges(CacheRef const & _aCache, ComponentRequ
{
(void)e;
CFG_TRACE_ERROR_NI("CacheController: saving tree '%s' failed: %s",
- OUSTRING2ASCII(_aComponent.getComponentName().toString()),
+ OUSTRING2ASCII(_aComponent.getComponentName()),
OUSTRING2ASCII(e.Message) );
refreshComponent(_aComponent);
@@ -755,21 +748,19 @@ void CacheController::savePendingChanges(CacheRef const & _aCache, ComponentRequ
}
// -----------------------------------------------------------------------------
-bool CacheController::saveAllPendingChanges(CacheRef const & _aCache, RequestOptions const & _aOptions)
- CFG_UNO_THROW_RTE( )
+bool CacheController::saveAllPendingChanges(rtl::Reference<CacheLoadingAccess> const & _aCache, RequestOptions const & _aOptions)
+ SAL_THROW((com::sun::star::uno::RuntimeException))
{
CFG_TRACE_INFO("CacheController: Saving all pending changes for cache line");
OSL_ASSERT(_aCache.is());
- typedef ExtendedCacheData::PendingModuleList PMList;
-
- PMList aPendingModules;
+ std::vector< rtl::OUString > aPendingModules;
_aCache->findPendingChangedModules(aPendingModules);
CFG_TRACE_INFO_NI("Found %d changed modules",int(aPendingModules.size()));
bool bSuccess = true;
- for (PMList::iterator it = aPendingModules.begin();
+ for (std::vector< rtl::OUString >::iterator it = aPendingModules.begin();
it != aPendingModules.end();
++it )
{
@@ -791,14 +782,14 @@ bool CacheController::saveAllPendingChanges(CacheRef const & _aCache, RequestOpt
//-----------------------------------------------------------------------------
-void CacheController::freeComponent(ComponentRequest const & _aRequest) CFG_NOTHROW()
+void CacheController::freeComponent(ComponentRequest const & _aRequest) SAL_THROW(())
{
CFG_TRACE_INFO("CacheController: releasing module '%s' for user '%s' with locale '%s'",
- OUSTRING2ASCII(_aRequest.getComponentName().toString()),
+ OUSTRING2ASCII(_aRequest.getComponentName()),
OUSTRING2ASCII(_aRequest.getOptions().getEntity()),
OUSTRING2ASCII(_aRequest.getOptions().getLocale()) );
- CacheRef aCache = m_aCacheMap.get(_aRequest.getOptions());
+ rtl::Reference<CacheLoadingAccess> aCache = m_aCacheMap.get(_aRequest.getOptions());
OSL_ENSURE(aCache.is(), "Releasing a nonexisting module");
@@ -812,12 +803,12 @@ void CacheController::freeComponent(ComponentRequest const & _aRequest) CFG_NOTH
}
}
// -----------------------------------------------------------------------------
-void CacheController::dataChanged(const ComponentRequest& _aRequest) CFG_NOTHROW()
+void CacheController::dataChanged(const ComponentRequest& _aRequest) SAL_THROW(())
{
refreshComponent(_aRequest);
}
// -----------------------------------------------------------------------------
-void CacheController::refreshAllComponents() CFG_UNO_THROW_ALL()
+void CacheController::refreshAllComponents() SAL_THROW((com::sun::star::uno::Exception))
{
CacheMap::Map aRefreshList = m_aCacheMap.copy();
diff --git a/configmgr/source/treecache/cachecontroller.hxx b/configmgr/source/treecache/cachecontroller.hxx
index 9827dde057..e62f82f9ae 100644
--- a/configmgr/source/treecache/cachecontroller.hxx
+++ b/configmgr/source/treecache/cachecontroller.hxx
@@ -28,14 +28,14 @@
*
************************************************************************/
-/* PLEASE DON'T DELETE ANY COMMENT LINES, ALSO IT'S UNNECESSARY. */
-
-
#ifndef CONFIGMGR_BACKEND_CACHECONTROLLER_HXX
#define CONFIGMGR_BACKEND_CACHECONTROLLER_HXX
+#include "sal/config.h"
+
+#include "salhelper/simplereferenceobject.hxx"
+
#include "utility.hxx"
-#include "cacheddataprovider.hxx"
#include "mergeddataprovider.hxx"
#include "cacheaccess.hxx"
#include "cachemulticaster.hxx"
@@ -57,28 +57,20 @@ namespace configmgr
trying to ensure consistency with a backend
and provides access to the data for clients
*/
- class CacheController
-
- : public ICachedDataProvider
- , public IDirectDataProvider // Refcounted
- , public INodeDataListener
+ class CacheController:
+ public salhelper::SimpleReferenceObject,
+ public ITemplateDataProvider, public INodeDataListener
{
- typedef backend::IMergedDataProvider Backend;
- typedef rtl::Reference< Backend > BackendRef;
- typedef ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >
- CreationContext;
public:
/** ctor
*/
explicit
- CacheController(BackendRef const & _xBackend,
+ CacheController(rtl::Reference< backend::IMergedDataProvider > const & _xBackend,
const uno::Reference<uno::XComponentContext>& xContext);
- // ICachedDataProvider implementation
- public:
- // disposing the cache before destroying
- virtual void dispose() CFG_UNO_THROW_RTE();
-
+ // disposing the cache before destroying
+ void dispose() SAL_THROW((com::sun::star::uno::RuntimeException));
+
/** locates data of a component in the cache.
<p> If the data isn't in the cache it is loaded from the backend. </p>
@@ -93,14 +85,14 @@ namespace configmgr
if loading the data fails.
The exact exception being thrown may depend on the underlying backend.
*/
- virtual CacheLocation loadComponent(ComponentRequest const & _aRequest)
- CFG_UNO_THROW_ALL();
+ sharable::TreeFragment * loadComponent(ComponentRequest const & _aRequest)
+ SAL_THROW((com::sun::star::uno::Exception));
/** releases data of a component from the cache.
- <p> Should be called when a client is done with a component.
+ <p> Should be called when a client is done with a component.
Each calls to <method>loadComponent</method> should
- be balanced by exactly one call to <method>freeComponent</method>.
+ be balanced by exactly one call to <method>freeComponent</method>.
</p>
@param _aRequest
@@ -109,8 +101,8 @@ namespace configmgr
@returns
data that can be used to locate the loaded data in the cache.
*/
- virtual void freeComponent(ComponentRequest const & _aRequest)
- CFG_NOTHROW();
+ void freeComponent(ComponentRequest const & _aRequest)
+ SAL_THROW(());
/** refreshes data of an existing component from the backend
@@ -118,7 +110,7 @@ namespace configmgr
backend and the change are notified to all registered listeners.
</p>
<p> If the data isn't in the cache nothing is done and
- a NULL location is returned.
+ a NULL location is returned.
</p>
<p>Note: the caller <strong>must not</strong> hold any lock on the cache line affected.</p>
@@ -129,32 +121,39 @@ namespace configmgr
@returns
data that can be used to locate the refreshed data in the cache.
- <p>If there is no data to refresh a NULL location is returned.</p>
+ <p>If there is no data to refresh a NULL location is returned.</p>
@throws com::sun::star::uno::Exception
if loading the data fails.
The exact exception being thrown may depend on the underlying backend.
*/
- virtual CacheLocation refreshComponent(ComponentRequest const & _aRequest)
- CFG_UNO_THROW_ALL();
+ sharable::TreeFragment * refreshComponent(ComponentRequest const & _aRequest)
+ SAL_THROW((com::sun::star::uno::Exception));
/** refreshes data of all existing components from the backend
<p> If the data is in the cache already, it is refreshed from the
backend and the change are notified to all registered listeners.
</p>
<p> If the data isn't in the cache nothing is done and
- a NULL location is returned.
+ a NULL location is returned.
</p>
<p>Note: the caller <strong>must not</strong> hold any lock on the cache line affected.</p>
-
+
@throws com::sun::star::uno::Exception
if loading the data fails.
The exact exception being thrown may depend on the underlying backend.
*/
- virtual void refreshAllComponents()
- CFG_UNO_THROW_ALL();
-
+ void refreshAllComponents()
+ SAL_THROW((com::sun::star::uno::Exception));
+
+ /** flushes data of all pending updates from cache to the backend(s)
+ @throws com::sun::star::uno::Exception
+ if flushing the data fails.
+ The exact exception being thrown may depend on the underlying backend.
+ */
+ void flushPendingUpdates() SAL_THROW((com::sun::star::uno::Exception));
+
/** locates a template in the cache.
<p> If the data isn't in the cache it is loaded from the backend. </p>
@@ -171,8 +170,8 @@ namespace configmgr
if loading the template data fails.
The exact exception being thrown may depend on the underlying backend.
*/
- virtual CacheLocation loadTemplate(TemplateRequest const & _aRequest)
- CFG_UNO_THROW_ALL();
+ sharable::TreeFragment * loadTemplate(TemplateRequest const & _aRequest)
+ SAL_THROW((com::sun::star::uno::Exception));
/** saves changes to the backend and notifies them to registered listeners.
@@ -180,11 +179,11 @@ namespace configmgr
and before any subsequent changes to the same component.
</p>
- <p> Notifications are guaranteed to be delivered
+ <p> Notifications are guaranteed to be delivered
before any subsequent changes to the same component are possible.
</p>
- <p> Note: the caller <strong>must</strong> hold a read lock (but no write lock)
+ <p> Note: the caller <strong>must</strong> hold a read lock (but no write lock)
on the cache line affected during the call.</p>
@param _anUpdate
@@ -194,30 +193,18 @@ namespace configmgr
if saving the changes to the backend fails.
The exact exception being thrown may depend on the underlying backend.
*/
- virtual void saveAndNotify(UpdateRequest const & _anUpdate)
- CFG_UNO_THROW_ALL();
+ void saveAndNotify(UpdateRequest const & _anUpdate)
+ SAL_THROW((com::sun::star::uno::Exception));
- /** @returns
+ /** @returns
an object that can used to broadcast changes done through this object.
- <p> The object returned is guaranteed to live as long
- as this ICachedDataProvider lives.
+ <p> The object returned is guaranteed to live as long
+ as this object lives.
</p>
*/
- virtual ICachedDataNotifier & getNotifier() CFG_NOTHROW()
+ CacheChangeMulticaster & getNotifier() SAL_THROW(())
{ return m_aNotifier; }
- /** @returns
- an object that can be used to retrieve owned copies of the data,
- defaults and templates.
- <p> The object returned is guaranteed to live as long
- as this ICachedDataProvider lives.
- </p>
- */
- virtual IDirectDataProvider & getDirectDataProvider() CFG_NOTHROW()
- { return *this; }
-
- // IDirectDataProvider implementation
- public:
/** loads merged data for a (complete) tree and returns it as return value.
@param _aRequest
@@ -234,9 +221,9 @@ namespace configmgr
The exact exception being thrown may depend on the underlying backend.
*/
- virtual ComponentResult getComponentData(ComponentRequest const & _aRequest,
+ ResultHolder< ComponentInstance > getComponentData(ComponentRequest const & _aRequest,
bool _bAddListenter)
- CFG_UNO_THROW_ALL();
+ SAL_THROW((com::sun::star::uno::Exception));
/** loads default data for a (partial) tree and returns it as return value
@@ -252,8 +239,8 @@ namespace configmgr
if the default cannot be retrieved.
The exact exception being thrown may depend on the underlying backend.
*/
- virtual NodeResult getDefaultData(NodeRequest const & _aRequest)
- CFG_UNO_THROW_ALL();
+ ResultHolder< NodeInstance > getDefaultData(NodeRequest const & _aRequest)
+ SAL_THROW((com::sun::star::uno::Exception));
/** loads a given template and returns it as return value
@@ -272,58 +259,53 @@ namespace configmgr
if the template cannot be retrieved.
The exact exception being thrown may depend on the underlying backend.
*/
- virtual TemplateResult getTemplateData(TemplateRequest const & _aRequest)
- CFG_UNO_THROW_ALL();
+ virtual ResultHolder< TemplateInstance > getTemplateData(TemplateRequest const & _aRequest)
+ SAL_THROW((com::sun::star::uno::Exception));
//INodeDataListener Implementation
/** Triggered when component data is changed
@param _aRequest
identifies the data that changed
*/
- virtual void dataChanged(const ComponentRequest& _aRequest) CFG_NOTHROW();
+ virtual void dataChanged(const ComponentRequest& _aRequest) SAL_THROW(());
protected:
// ref counted, that's why no public dtor
~CacheController();
// implementation
private:
- typedef CacheLoadingAccess Cache;
- typedef rtl::Reference<Cache> CacheRef;
-
- private:
- AbsolutePath encodeTemplateLocation(const Name& _rName, const Name &_rModule) const;
+ configuration::AbsolutePath encodeTemplateLocation(rtl::OUString const & _rName, rtl::OUString const & _rModule) const;
- AbsolutePath ensureTemplate(Name const& _rName, Name const& _rModule) CFG_UNO_THROW_ALL( );
+ configuration::AbsolutePath ensureTemplate(rtl::OUString const& _rName, rtl::OUString const& _rModule) SAL_THROW((com::sun::star::uno::Exception));
// adjust a node result for locale, ...
bool normalizeResult(std::auto_ptr<ISubtree> & _aResult, RequestOptions const & _aOptions);
// reads data from the backend directly
- ComponentResult loadDirectly(ComponentRequest const & _aRequest, bool _bAddListenter )
- CFG_UNO_THROW_ALL( );
+ ResultHolder< ComponentInstance > loadDirectly(ComponentRequest const & _aRequest, bool _bAddListenter )
+ SAL_THROW((com::sun::star::uno::Exception));
// reads default data from the backend directly
- NodeResult loadDefaultsDirectly(NodeRequest const & _aRequest) CFG_UNO_THROW_ALL( );
+ ResultHolder< NodeInstance > loadDefaultsDirectly(NodeRequest const & _aRequest) SAL_THROW((com::sun::star::uno::Exception));
// writes an update to the backend directly
- void saveDirectly(UpdateRequest const & _anUpdate) CFG_UNO_THROW_ALL( );
+ void saveDirectly(UpdateRequest const & _anUpdate) SAL_THROW((com::sun::star::uno::Exception));
// writes updates for a component to the backend directly
- void savePendingChanges(CacheRef const & _aCache, ComponentRequest const & _aComponent)
- CFG_UNO_THROW_ALL( );
+ void savePendingChanges(rtl::Reference<CacheLoadingAccess> const & _aCache, ComponentRequest const & _aComponent)
+ SAL_THROW((com::sun::star::uno::Exception));
// saves all pending changes from a cache access to the backend
- bool saveAllPendingChanges(CacheRef const & _aCache, RequestOptions const & _aOptions)
- CFG_UNO_THROW_RTE( );
+ bool saveAllPendingChanges(rtl::Reference<CacheLoadingAccess> const & _aCache, RequestOptions const & _aOptions)
+ SAL_THROW((com::sun::star::uno::RuntimeException));
// load templates componentwise from backend
std::auto_ptr<ISubtree> loadTemplateData(TemplateRequest const & _aRequest)
- CFG_UNO_THROW_ALL( );
+ SAL_THROW((com::sun::star::uno::Exception));
- void flushPendingUpdates() CFG_UNO_THROW_ALL();
- void flushCacheWriter() CFG_NOTHROW();
+ void flushCacheWriter() SAL_THROW(());
// add templates componentwise to cache
- data::TreeAddress addTemplates ( backend::ComponentData const & _aComponentInstance );
- CacheRef getCacheAlways(RequestOptions const & _aOptions);
+ sharable::TreeFragment * addTemplates ( backend::ComponentDataStruct const & _aComponentInstance );
+ rtl::Reference<CacheLoadingAccess> getCacheAlways(RequestOptions const & _aOptions);
- OTreeDisposeScheduler * createDisposer(const CreationContext& _xContext);
- OCacheWriteScheduler * createCacheWriter(const CreationContext& _xContext);
+ OTreeDisposeScheduler * createDisposer(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _xContext);
+ OCacheWriteScheduler * createCacheWriter(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _xContext);
@@ -331,14 +313,14 @@ namespace configmgr
void disposeAll(bool _bFlushRemainingUpdates);
void disposeOne(RequestOptions const & _aOptions, bool _bFlushUpdates = true);
void disposeUser(RequestOptions const & _aUserOptions, bool _bFlushUpdates = true);
- void implDisposeOne(CacheRef const & _aCache, RequestOptions const & _aOptions, bool _bFlushUpdates);
+ void implDisposeOne(rtl::Reference<CacheLoadingAccess> const & _aCache, RequestOptions const & _aOptions, bool _bFlushUpdates);
- void closeModules(Cache::DisposeList & _aList, RequestOptions const & _aOptions);
+ void closeModules(std::vector< rtl::Reference<CacheLine> > & _aList, RequestOptions const & _aOptions);
private:
- typedef AutoReferenceMap<RequestOptions,Cache,lessRequestOptions> CacheMap;
+ typedef AutoReferenceMap<RequestOptions,CacheLoadingAccess,lessRequestOptions> CacheMap;
CacheChangeMulticaster m_aNotifier;
- BackendRef m_xBackend;
+ rtl::Reference< backend::IMergedDataProvider > m_xBackend;
CacheMap m_aCacheMap;
TemplateCacheData m_aTemplates;
diff --git a/configmgr/source/treecache/cachedata.cxx b/configmgr/source/treecache/cachedata.cxx
index b4786ae47c..244614426d 100644
--- a/configmgr/source/treecache/cachedata.cxx
+++ b/configmgr/source/treecache/cachedata.cxx
@@ -33,7 +33,6 @@
#include "cachedata.hxx"
#include "node.hxx"
-#include "nodeaccess.hxx"
#include "updatehelper.hxx"
#include "tracer.hxx"
#include <osl/diagnose.h>
@@ -41,14 +40,13 @@
namespace configmgr
{
- using namespace configuration;
// ---------------------------- Client Acquire helper ----------------------------
struct CacheLineClientRef
{
- CacheLineRef xModule;
+ rtl::Reference<CacheLine> xModule;
- CacheLineClientRef(CacheLineRef const& _xModule)
+ CacheLineClientRef(rtl::Reference<CacheLine> const& _xModule)
: xModule(_xModule)
{
if (xModule.is())
@@ -61,7 +59,7 @@ namespace configmgr
xModule->clientRelease();
}
- void rebind(CacheLineRef const& _xModule)
+ void rebind(rtl::Reference<CacheLine> const& _xModule)
{
if (_xModule.is())
_xModule->clientAcquire();
@@ -78,9 +76,9 @@ namespace configmgr
}
/// return the contained module so that the client reference will be kept active
- CacheLineRef keepModule()
+ rtl::Reference<CacheLine> keepModule()
{
- CacheLineRef xRet = xModule;
+ rtl::Reference<CacheLine> xRet = xModule;
this->keep();
return xRet;
}
@@ -91,7 +89,7 @@ namespace configmgr
};
// -----------------------------------------------------------------------------
- static inline CacheLine::Name implExtractModuleName(CacheLine::Path const& aConfigPath)
+ static inline rtl::OUString implExtractModuleName(configuration::AbsolutePath const& aConfigPath)
{
return aConfigPath.getModuleName();
}
@@ -109,37 +107,37 @@ namespace configmgr
}
// -----------------------------------------------------------------------------
inline
- CacheLineRef CacheData::internalGetModule(const CacheLine::Name& _aModuleName ) const
+ rtl::Reference<CacheLine> CacheData::internalGetModule(rtl::OUString const & _aModuleName ) const
{
- OSL_ASSERT(!_aModuleName.isEmpty());
+ OSL_ASSERT(_aModuleName.getLength() != 0);
ModuleList::const_iterator it = m_aModules.find(_aModuleName);
- return it!=m_aModules.end() ? it->second : CacheLineRef();
+ return it!=m_aModules.end() ? it->second : rtl::Reference<CacheLine>();
}
// -----------------------------------------------------------------------------
inline
- CacheLineRef CacheData::internalGetModule(const CacheLine::Path& _aPath) const
+ rtl::Reference<CacheLine> CacheData::internalGetModule(const configuration::AbsolutePath& _aPath) const
{
return internalGetModule( implExtractModuleName(_aPath) );
}
// -----------------------------------------------------------------------------
inline
- void CacheData::internalAddModule(const CacheLine::Name& _aName, const CacheLineRef & _aModule)
+ void CacheData::internalAddModule(rtl::OUString const & _aName, const rtl::Reference<CacheLine> & _aModule)
{
//OSL_PRECOND(m_aModules.find(_aName) == m_aModules.end(), "ERROR: Module already present in CacheData");
m_aModules[_aName] = _aModule;
- CFG_TRACE_INFO("CacheData Data: Added new module tree for module %s", OUSTRING2ASCII(_aName.toString()) );
+ CFG_TRACE_INFO("CacheData Data: Added new module tree for module %s", OUSTRING2ASCII(_aName) );
}
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
- CacheLineRef CacheData::internalAttachModule(data::TreeAddress _aLocation, const CacheLine::Name& _aName) CFG_UNO_THROW_RTE( )
+ rtl::Reference<CacheLine> CacheData::internalAttachModule(sharable::TreeFragment * _aLocation, rtl::OUString const & _aName) SAL_THROW((com::sun::star::uno::RuntimeException))
{
- CacheLineRef aNewModule = doCreateAttachedModule(_aLocation,_aName);
+ rtl::Reference<CacheLine> aNewModule = doCreateAttachedModule(_aLocation,_aName);
internalAddModule( _aName, aNewModule );
@@ -148,51 +146,51 @@ namespace configmgr
// -------------------------------------------------------------------------
- void CacheData::attachModule(data::TreeAddress _aLocation, CacheLine::Name const & _aModule)
+ void CacheData::attachModule(sharable::TreeFragment * _aLocation, rtl::OUString const & _aModule)
{
this->internalAttachModule(_aLocation,_aModule);
}
// -------------------------------------------------------------------------
- CacheLineRef CacheData::doCreateAttachedModule(data::TreeAddress _aLocation, const CacheLine::Name& _aName) CFG_UNO_THROW_RTE( )
+ rtl::Reference<CacheLine> CacheData::doCreateAttachedModule(sharable::TreeFragment * _aLocation, rtl::OUString const & _aName) SAL_THROW((com::sun::star::uno::RuntimeException))
{
return CacheLine::createAttached( _aName, _aLocation );
}
// -----------------------------------------------------------------------------
/// gets a data segment reference for the given path if exists
- data::TreeAddress CacheData::getTreeAddress(const CacheLine::Name & _aModule) const
+ sharable::TreeFragment * CacheData::getTreeAddress(rtl::OUString const & _aModule) const
{
- CacheLineRef aModule = internalGetModule(_aModule);
+ rtl::Reference<CacheLine> aModule = internalGetModule(_aModule);
return aModule.is() ? aModule->getTreeAddress() : NULL;
}
// -------------------------------------------------------------------------
- bool CacheData::hasModule(const CacheLine::Name & _aModule) const
+ bool CacheData::hasModule(rtl::OUString const & _aModule) const
{
- CacheLineRef aModule = internalGetModule(_aModule);
+ rtl::Reference<CacheLine> aModule = internalGetModule(_aModule);
return aModule.is() && !aModule->isEmpty();
}
// -------------------------------------------------------------------------
- bool CacheData::hasModuleDefaults(const CacheLine::Name & _aModule) const
+ bool CacheData::hasModuleDefaults(rtl::OUString const & _aModule) const
{
- CacheLineRef aModule = internalGetModule(_aModule);
+ rtl::Reference<CacheLine> aModule = internalGetModule(_aModule);
return aModule.is() && !aModule->hasDefaults();
}
// -------------------------------------------------------------------------
- data::TreeAddress CacheData::internalGetPartialTree(const CacheLine::Path& aComponentName ) const
+ sharable::TreeFragment * CacheData::internalGetPartialTree(const configuration::AbsolutePath& aComponentName ) const
{
- CacheLineRef xModule = internalGetModule(aComponentName);
+ rtl::Reference<CacheLine> xModule = internalGetModule(aComponentName);
if ( !xModule.is() )
return NULL;
- data::TreeAddress pSubtree = xModule->getPartialTree(aComponentName);
+ sharable::TreeFragment * pSubtree = xModule->getPartialTree(aComponentName);
OSL_ENSURE( pSubtree == NULL || xModule->clientReferences() != 0 ,
"WARNING: returning subtree from module without clients\n" );
@@ -206,17 +204,17 @@ namespace configmgr
return pSubtree;
}
// -----------------------------------------------------------------------------
- data::NodeAddress CacheData::internalGetNode(const CacheLine::Path& aComponentName ) const
+ sharable::Node * CacheData::internalGetNode(const configuration::AbsolutePath& aComponentName ) const
{
- CacheLineRef xModule = internalGetModule(aComponentName);
+ rtl::Reference<CacheLine> xModule = internalGetModule(aComponentName);
if ( !xModule.is() )
- return data::NodeAddress();
+ return 0;
if ( xModule->isEmpty() )
- return data::NodeAddress();
+ return 0;
- data::NodeAddress pNode = xModule->getNode(aComponentName);
+ sharable::Node * pNode = xModule->getNode(aComponentName);
OSL_ENSURE( pNode == NULL || xModule->clientReferences() != 0,
"WARNING: returning node from module without clients\n" );
@@ -231,9 +229,9 @@ namespace configmgr
}
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
- bool CacheData::acquireModule(CacheLine::Name const & _aModule)
+ bool CacheData::acquireModule(rtl::OUString const & _aModule)
{
- CacheLineRef xModule = internalGetModule(_aModule);
+ rtl::Reference<CacheLine> xModule = internalGetModule(_aModule);
if (xModule.is())
{
@@ -244,16 +242,16 @@ namespace configmgr
return xModule.is();
}
// -----------------------------------------------------------------------------
- data::NodeAddress CacheData::acquireNode(CacheLine::Path const& _aPath)
+ sharable::Node * CacheData::acquireNode(configuration::AbsolutePath const& _aPath)
{
CacheLineClientRef aClientRef(internalGetModule(_aPath));
- data::NodeAddress aNodeAddr = internalGetNode(_aPath);
+ sharable::Node * aNodeAddr = internalGetNode(_aPath);
if (sharable::Node const * pNode = aNodeAddr)
{
if (pNode->isValue())
- aNodeAddr = data::NodeAddress(); // invalid: cannot acquire single value
+ aNodeAddr = 0; // invalid: cannot acquire single value
}
else
OSL_ASSERT( aNodeAddr == NULL );
@@ -265,13 +263,13 @@ namespace configmgr
}
// -----------------------------------------------------------------------------
- bool CacheData::insertDefaults( backend::NodeInstance const & _aDefaultInstance) CFG_UNO_THROW_RTE( )
+ bool CacheData::insertDefaults( backend::NodeInstance const & _aDefaultInstance) SAL_THROW((com::sun::star::uno::RuntimeException))
{
OSL_PRECOND(_aDefaultInstance.data().get(), "insertDefaults: Data must not be NULL");
- OSL_PRECOND(_aDefaultInstance.root().isModuleRoot(), "insertDefaults: Default tree being added must be for module");
+ OSL_PRECOND(_aDefaultInstance.root().getDepth() == 1, "insertDefaults: Default tree being added must be for module");
// we should already have the module in cache !
- CacheLineRef xModule = internalGetModule(_aDefaultInstance.root().location());
+ rtl::Reference<CacheLine> xModule = internalGetModule(_aDefaultInstance.root());
OSL_ENSURE( xModule.is(), "CacheData::insertDefaults: No module to insert the defaults to - where did the data segment come from ?");
@@ -280,16 +278,16 @@ namespace configmgr
// make sure to keep the module alive
CacheLineClientRef( xModule ).keep();
- data::TreeAddress aResultTree = xModule->insertDefaults(_aDefaultInstance);
+ sharable::TreeFragment * aResultTree = xModule->insertDefaults(_aDefaultInstance);
return aResultTree != NULL;
}
// -----------------------------------------------------------------------------
- void CacheData::applyUpdate( backend::UpdateInstance & _anUpdate ) CFG_UNO_THROW_RTE( )
+ void CacheData::applyUpdate( backend::UpdateInstance & _anUpdate ) SAL_THROW((com::sun::star::uno::RuntimeException))
{
// request the subtree, atleast one level must exist!
- data::NodeAddress aNodeAddr = internalGetNode(_anUpdate.root().location());
+ sharable::Node * aNodeAddr = internalGetNode(_anUpdate.root());
if (aNodeAddr != NULL)
{
@@ -298,7 +296,7 @@ namespace configmgr
else
{
OSL_ENSURE(false, "CacheData::applyUpdate called for non-existing tree");
- OUString aStr(RTL_CONSTASCII_USTRINGPARAM("CacheData: update to non-existing node: "));
+ rtl::OUString aStr(RTL_CONSTASCII_USTRINGPARAM("CacheData: update to non-existing node: "));
aStr += _anUpdate.root().toString();
@@ -306,9 +304,9 @@ namespace configmgr
}
}
// -----------------------------------------------------------------------------
- oslInterlockedCount CacheData::releaseModule( CacheLine::Name const & _aModule, bool _bKeepDeadModule )
+ oslInterlockedCount CacheData::releaseModule( rtl::OUString const & _aModule, bool _bKeepDeadModule )
{
- CacheLineRef xModule = internalGetModule(_aModule);
+ rtl::Reference<CacheLine> xModule = internalGetModule(_aModule);
const oslInterlockedCount c_nErrorCount = -1;
@@ -327,28 +325,28 @@ namespace configmgr
}
// -----------------------------------------------------------------------------
- data::TreeAddress CacheData::getTemplateTree(CacheLine::Path const& aTemplateName ) const
+ sharable::TreeFragment * CacheData::getTemplateTree(configuration::AbsolutePath const& aTemplateName ) const
{
return internalGetPartialTree(aTemplateName);
}
// -----------------------------------------------------------------------------
- data::NodeAddress CacheData::getNode(const CacheLine::Path& _rPath)
+ sharable::Node * CacheData::getNode(const configuration::AbsolutePath& _rPath)
{
return internalGetNode(_rPath);
}
// -----------------------------------------------------------------------------
- bool CacheData::hasNode(const CacheLine::Path& _rPath) const
+ bool CacheData::hasNode(const configuration::AbsolutePath& _rPath) const
{
return internalGetNode(_rPath) != NULL;
}
// -----------------------------------------------------------------------------
- data::TreeAddress TemplateCacheData::addTemplates( backend::ComponentData const & _aComponentInstance) CFG_UNO_THROW_RTE( )
+ sharable::TreeFragment * TemplateCacheData::addTemplates( backend::ComponentDataStruct const & _aComponentInstance) SAL_THROW((com::sun::star::uno::RuntimeException))
{
OSL_PRECOND(_aComponentInstance.data.get(), "addTemplates: Data must not be NULL");
// we should already have the module in cache !
- CacheLine::Name aModuleName ( _aComponentInstance.name);
- CacheLineRef xModule = internalGetModule(aModuleName);
+ rtl::OUString aModuleName ( _aComponentInstance.name);
+ rtl::Reference<CacheLine> xModule = internalGetModule(aModuleName);
OSL_ENSURE( xModule.is(), "ExtendedCacheData::addTemplates: No module to add the templates to - where did the data segment come from ?");
@@ -357,11 +355,11 @@ namespace configmgr
// make sure to keep the module alive
CacheLineClientRef( xModule ).keep();
- static const OUString aDummyTemplateName(RTL_CONSTASCII_USTRINGPARAM("cfg:Template"));
- static const OUString aDummyTemplateModule(RTL_CONSTASCII_USTRINGPARAM("cfg:Templates"));
+ static const rtl::OUString aDummyTemplateName(RTL_CONSTASCII_USTRINGPARAM("cfg:Template"));
+ static const rtl::OUString aDummyTemplateModule(RTL_CONSTASCII_USTRINGPARAM("cfg:Templates"));
_aComponentInstance.data->makeSetNode(aDummyTemplateName,aDummyTemplateModule);
- data::TreeAddress aResult = xModule->setComponentData(_aComponentInstance, true);
+ sharable::TreeFragment * aResult = xModule->setComponentData(_aComponentInstance, true);
OSL_ASSERT(aResult != NULL);
@@ -369,56 +367,56 @@ namespace configmgr
}
// -----------------------------------------------------------------------------
- CacheLineRef TemplateCacheData::doCreateAttachedModule(data::TreeAddress _aLocation, const CacheLine::Name& _aName) CFG_UNO_THROW_RTE( )
+ rtl::Reference<CacheLine> TemplateCacheData::doCreateAttachedModule(sharable::TreeFragment * _aLocation, rtl::OUString const & _aName) SAL_THROW((com::sun::star::uno::RuntimeException))
{
- CacheLineRef aNewModule = CacheLine::createAttached(_aName, _aLocation);
+ rtl::Reference<CacheLine> aNewModule = CacheLine::createAttached(_aName, _aLocation);
return aNewModule.get();
}
// -----------------------------------------------------------------------------
- void TemplateCacheData::createModule(const CacheLine::Name& _aModule) CFG_UNO_THROW_RTE()
+ void TemplateCacheData::createModule(rtl::OUString const & _aModule) SAL_THROW((com::sun::star::uno::RuntimeException))
{
- CacheLineRef aNewModule = CacheLine::createNew(_aModule);
+ rtl::Reference<CacheLine> aNewModule = CacheLine::createNew(_aModule);
internalAddModule( _aModule, aNewModule.get() );
}
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
inline
- ExtendedCacheLineRef ExtendedCacheData::implExtended(const CacheLineRef& _aSimpleRef) const
+ rtl::Reference<ExtendedCacheLine> ExtendedCacheData::implExtended(const rtl::Reference<CacheLine>& _aSimpleRef) const
{
CacheLine * pBasic = _aSimpleRef.get();
ExtendedCacheLine * pExtended = static_cast<ExtendedCacheLine *>(pBasic);
- return ExtendedCacheLineRef(pExtended);
+ return rtl::Reference<ExtendedCacheLine>(pExtended);
}
// -----------------------------------------------------------------------------
- CacheLineRef ExtendedCacheData::doCreateAttachedModule(data::TreeAddress _aLocation, const CacheLine::Name& _aName) CFG_UNO_THROW_RTE( )
+ rtl::Reference<CacheLine> ExtendedCacheData::doCreateAttachedModule(sharable::TreeFragment * _aLocation, rtl::OUString const & _aName) SAL_THROW((com::sun::star::uno::RuntimeException))
{
- ExtendedCacheLineRef aNewModule =
+ rtl::Reference<ExtendedCacheLine> aNewModule =
ExtendedCacheLine::createAttached(_aName, _aLocation);
- return CacheLineRef( aNewModule.get() );
+ return rtl::Reference<CacheLine>( aNewModule.get() );
}
// -----------------------------------------------------------------------------
- void ExtendedCacheData::createModule(const CacheLine::Name& _aModule) CFG_UNO_THROW_RTE()
+ void ExtendedCacheData::createModule(rtl::OUString const & _aModule) SAL_THROW((com::sun::star::uno::RuntimeException))
{
- ExtendedCacheLineRef aNewModule = ExtendedCacheLine::createNew(_aModule);
+ rtl::Reference<ExtendedCacheLine> aNewModule = ExtendedCacheLine::createNew(_aModule);
internalAddModule( _aModule, aNewModule.get() );
}
// -----------------------------------------------------------------------------
- data::TreeAddress ExtendedCacheData::addComponentData(backend::ComponentInstance const & _aComponentInstance,
- bool _bWithDefaults) CFG_UNO_THROW_RTE( )
+ sharable::TreeFragment * ExtendedCacheData::addComponentData(backend::ComponentInstance const & _aComponentInstance,
+ bool _bWithDefaults) SAL_THROW((com::sun::star::uno::RuntimeException))
{
OSL_PRECOND(_aComponentInstance.data().get(), "addComponentData: Data must not be NULL");
// we should already have the module in cache !
- //CacheLineRef xModule = internalGetModule(_aNodeInstance.root().location());
- CacheLineRef xModule = internalGetModule(_aComponentInstance.component() );
+ //rtl::Reference<CacheLine> xModule = internalGetModule(_aNodeInstance.root().location());
+ rtl::Reference<CacheLine> xModule = internalGetModule(_aComponentInstance.component() );
OSL_ENSURE( xModule.is(), "ExtendedCacheData::addComponentData: No module to add the subtree to - where did the data segment come from ?");
@@ -426,7 +424,7 @@ namespace configmgr
CacheLineClientRef aClientRef( xModule );
- data::TreeAddress aResult = xModule->setComponentData(_aComponentInstance.componentNodeData(), _bWithDefaults);
+ sharable::TreeFragment * aResult = xModule->setComponentData(_aComponentInstance.componentNodeData(), _bWithDefaults);
OSL_ASSERT(aResult != NULL);
@@ -436,10 +434,10 @@ namespace configmgr
}
// -----------------------------------------------------------------------------
- void ExtendedCacheData::addPending(backend::ConstUpdateInstance const & _anUpdate) CFG_UNO_THROW_RTE( )
+ void ExtendedCacheData::addPending(backend::ConstUpdateInstance const & _anUpdate) SAL_THROW((com::sun::star::uno::RuntimeException))
{
// do we already have the module in cache ?
- CacheLineRef xModule = internalGetModule(_anUpdate.root().location());
+ rtl::Reference<CacheLine> xModule = internalGetModule(_anUpdate.root());
if (xModule.is())
{
@@ -452,9 +450,9 @@ namespace configmgr
}
// -----------------------------------------------------------------------------
- std::auto_ptr<SubtreeChange> ExtendedCacheData::releasePending(CacheLine::Name const& _aModule)
+ std::auto_ptr<SubtreeChange> ExtendedCacheData::releasePending(rtl::OUString const& _aModule)
{
- ExtendedCacheLineRef xModule = implExtended(internalGetModule(_aModule));
+ rtl::Reference<ExtendedCacheLine> xModule = implExtended(internalGetModule(_aModule));
if (xModule.is())
{
@@ -471,16 +469,16 @@ namespace configmgr
}
// -----------------------------------------------------------------------------
- bool ExtendedCacheData::hasPending(CacheLine::Name const & _aModule)
+ bool ExtendedCacheData::hasPending(rtl::OUString const & _aModule)
{
- ExtendedCacheLineRef xModule = implExtended(internalGetModule(_aModule));
+ rtl::Reference<ExtendedCacheLine> xModule = implExtended(internalGetModule(_aModule));
return xModule.is() && xModule->hasPending();
}
// -----------------------------------------------------------------------------
- void ExtendedCacheData::findPendingModules( PendingModuleList & _rPendingList )
+ void ExtendedCacheData::findPendingModules( std::vector< rtl::OUString > & _rPendingList )
{
ModuleList& rModules = CacheData::accessModuleList();
for (ModuleList::iterator it = rModules.begin();
diff --git a/configmgr/source/treecache/cachedata.hxx b/configmgr/source/treecache/cachedata.hxx
index c732e8daf7..b2231f59e9 100644
--- a/configmgr/source/treecache/cachedata.hxx
+++ b/configmgr/source/treecache/cachedata.hxx
@@ -46,8 +46,6 @@
namespace configmgr
{
////////////////////////////////////////////////////////////////////////////////
- using ::rtl::OUString;
-
namespace backend
{
struct NodeInstance;
@@ -67,51 +65,51 @@ namespace configmgr
virtual ~CacheData();
// attach a module with a given name
- void attachModule(data::TreeAddress _aLocation, CacheLine::Name const & _aModule);
+ void attachModule(sharable::TreeFragment * _aLocation, rtl::OUString const & _aModule);
/// check if the given module exists already (and is not empty)
- bool hasModule(CacheLine::Name const & _aModule) const;
+ bool hasModule(rtl::OUString const & _aModule) const;
/// checks if the given module exists and has defaults available
- bool hasModuleDefaults(CacheLine::Name const & _aModule) const;
+ bool hasModuleDefaults(rtl::OUString const & _aModule) const;
/// gets a tree address for the given module if it exists
- data::TreeAddress getTreeAddress(CacheLine::Name const & _aModule) const;
+ sharable::TreeFragment * getTreeAddress(rtl::OUString const & _aModule) const;
/// checks whether a certain node exists in the tree
- bool hasNode(CacheLine::Path const & _aLocation) const;
+ bool hasNode(configuration::AbsolutePath const & _aLocation) const;
/// retrieve the given node without changing its ref count
- data::NodeAddress getNode(CacheLine::Path const & _rPath);
+ sharable::Node * getNode(configuration::AbsolutePath const & _rPath);
/// retrieve the given template tree without changing its ref count
- data::TreeAddress getTemplateTree( CacheLine::Path const & aTemplateName ) const;
+ sharable::TreeFragment * getTemplateTree( configuration::AbsolutePath const & aTemplateName ) const;
/// retrieve the subtree at _aPath and clientAcquire() it
- data::NodeAddress acquireNode(CacheLine::Path const & _aPath );
+ sharable::Node * acquireNode(configuration::AbsolutePath const & _aPath );
/// retrieve the subtree at _aPath and clientAcquire() it, return true on success
- bool acquireModule( CacheLine::Name const & _aModule );
+ bool acquireModule( rtl::OUString const & _aModule );
/// clientRelease() the tree at aComponentName, and return the resulting reference count
- oslInterlockedCount releaseModule( CacheLine::Name const & _aModule, bool _bKeepDeadModule = false );
+ oslInterlockedCount releaseModule( rtl::OUString const & _aModule, bool _bKeepDeadModule = false );
bool insertDefaults( backend::NodeInstance const & _aDefaultInstance
- ) CFG_UNO_THROW_RTE();
+ ) SAL_THROW((com::sun::star::uno::RuntimeException));
/// merge the given changes into this tree - reflects old values to _anUpdate
- void applyUpdate( backend::UpdateInstance & _anUpdate) CFG_UNO_THROW_RTE( );
+ void applyUpdate( backend::UpdateInstance & _anUpdate) SAL_THROW((com::sun::star::uno::RuntimeException));
// low-level interface for cache management
- typedef std::map<CacheLine::Name, CacheLineRef> ModuleList;
+ typedef std::map<rtl::OUString, rtl::Reference<CacheLine> > ModuleList;
ModuleList& accessModuleList() { return m_aModules; }
protected:
- virtual CacheLineRef doCreateAttachedModule(data::TreeAddress _aLocation, const CacheLine::Name& _aName) CFG_UNO_THROW_RTE( );
+ virtual rtl::Reference<CacheLine> doCreateAttachedModule(sharable::TreeFragment * _aLocation, rtl::OUString const & _aName) SAL_THROW((com::sun::star::uno::RuntimeException));
- data::TreeAddress internalGetPartialTree(CacheLine::Path const & _aPath ) const;
- data::NodeAddress internalGetNode(const CacheLine::Path& _rPath) const;
+ sharable::TreeFragment * internalGetPartialTree(configuration::AbsolutePath const & _aPath ) const;
+ sharable::Node * internalGetNode(const configuration::AbsolutePath& _rPath) const;
- CacheLineRef internalAttachModule(data::TreeAddress _aLocation, const CacheLine::Name& _aName) CFG_UNO_THROW_RTE( );
- void internalAddModule(CacheLine::Name const & _aName, CacheLineRef const & _aModule);
+ rtl::Reference<CacheLine> internalAttachModule(sharable::TreeFragment * _aLocation, rtl::OUString const & _aName) SAL_THROW((com::sun::star::uno::RuntimeException));
+ void internalAddModule(rtl::OUString const & _aName, rtl::Reference<CacheLine> const & _aModule);
- CacheLineRef internalGetModule(const CacheLine::Name& _aName) const;
- CacheLineRef internalGetModule(const CacheLine::Path& _aLocation) const;
+ rtl::Reference<CacheLine> internalGetModule(rtl::OUString const & _aName) const;
+ rtl::Reference<CacheLine> internalGetModule(const configuration::AbsolutePath& _aLocation) const;
private:
ModuleList m_aModules;
@@ -130,13 +128,13 @@ namespace configmgr
/** add the given template tree at the given location,
return the tree that is now pertinent and clientAcquire() it once
*/
- data::TreeAddress addTemplates( backend::ComponentData const & _aComponentInstance
- ) CFG_UNO_THROW_RTE();
+ sharable::TreeFragment * addTemplates( backend::ComponentDataStruct const & _aComponentInstance
+ ) SAL_THROW((com::sun::star::uno::RuntimeException));
// create a new module with the given name
- void createModule(CacheLine::Name const & _aModule) CFG_UNO_THROW_RTE();
+ void createModule(rtl::OUString const & _aModule) SAL_THROW((com::sun::star::uno::RuntimeException));
private:
- virtual CacheLineRef doCreateAttachedModule(data::TreeAddress _aLocation, const CacheLine::Name& _aName) CFG_UNO_THROW_RTE( );
+ virtual rtl::Reference<CacheLine> doCreateAttachedModule(sharable::TreeFragment * _aLocation, rtl::OUString const & _aName) SAL_THROW((com::sun::star::uno::RuntimeException));
};
//-----------------------------------------------------------------------------
/** A collection of CacheLines
@@ -152,28 +150,26 @@ namespace configmgr
/** add the given subtree at the given location,
return the tree that is now pertinent and clientAcquire() it once
*/
- data::TreeAddress addComponentData( backend::ComponentInstance const & _aComponentInstance,
+ sharable::TreeFragment * addComponentData( backend::ComponentInstance const & _aComponentInstance,
bool _bWithDefaults
- ) CFG_UNO_THROW_RTE();
-
- typedef std::vector< CacheLine::Name > PendingModuleList;
+ ) SAL_THROW((com::sun::star::uno::RuntimeException));
/// find the modules having pending changes
- bool hasPending(CacheLine::Name const & _aModule);
+ bool hasPending(rtl::OUString const & _aModule);
/// find the modules having pending changes
- void findPendingModules( PendingModuleList & _rPendingList );
+ void findPendingModules( std::vector< rtl::OUString > & _rPendingList );
/// add or merge the given subtreechange at the given location
- void addPending(backend::ConstUpdateInstance const & _anUpdate) CFG_UNO_THROW_RTE( );
+ void addPending(backend::ConstUpdateInstance const & _anUpdate) SAL_THROW((com::sun::star::uno::RuntimeException));
/// remove and return pending changes for the given component
- std::auto_ptr<SubtreeChange> releasePending(CacheLine::Name const & _aModule) CFG_UNO_THROW_RTE( );
+ std::auto_ptr<SubtreeChange> releasePending(rtl::OUString const & _aModule) SAL_THROW((com::sun::star::uno::RuntimeException));
// create a new module with the given name
- void createModule(CacheLine::Name const & _aModule) CFG_UNO_THROW_RTE();
+ void createModule(rtl::OUString const & _aModule) SAL_THROW((com::sun::star::uno::RuntimeException));
private:
- virtual CacheLineRef doCreateAttachedModule(data::TreeAddress _aLocation, const CacheLine::Name& _aName) CFG_UNO_THROW_RTE( );
+ virtual rtl::Reference<CacheLine> doCreateAttachedModule(sharable::TreeFragment * _aLocation, rtl::OUString const & _aName) SAL_THROW((com::sun::star::uno::RuntimeException));
- ExtendedCacheLineRef implExtended(CacheLineRef const & _aSimpleRef) const;
+ rtl::Reference<ExtendedCacheLine> implExtended(rtl::Reference<CacheLine> const & _aSimpleRef) const;
};
//-----------------------------------------------------------------------------
diff --git a/configmgr/source/treecache/cachefactory.cxx b/configmgr/source/treecache/cachefactory.cxx
index 8307725fb4..1cc33f2b4f 100644
--- a/configmgr/source/treecache/cachefactory.cxx
+++ b/configmgr/source/treecache/cachefactory.cxx
@@ -40,18 +40,15 @@ namespace configmgr
{
// -------------------------------------------------------------------------
- typedef rtl::Reference< backend::IMergedDataProvider > MergedBackendRef;
-// -------------------------------------------------------------------------
-
static
- rtl::Reference<TreeManager> buildCacheManager(MergedBackendRef const & _xBackend,
- CacheFactory::CreationContext const & _xContext)
+ rtl::Reference<TreeManager> buildCacheManager(rtl::Reference< backend::IMergedDataProvider > const & _xBackend,
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & _xContext)
{
rtl::Reference< TreeManager > xCache;
if (_xBackend.is())
{
- rtl::Reference< backend::ICachedDataProvider > xLoader
+ rtl::Reference< backend::CacheController > xLoader
= new backend::CacheController(_xBackend.get(), _xContext);
xCache.set( new TreeManager(xLoader.get()) );
@@ -62,9 +59,9 @@ namespace configmgr
// -------------------------------------------------------------------------
rtl::Reference<TreeManager>
- CacheFactory::createCacheManager(CreationContext const & _xContext)
+ CacheFactory::createCacheManager(::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & _xContext)
{
- MergedBackendRef xBackend = backend::BackendFactory::instance(_xContext).createBackend();
+ rtl::Reference< backend::IMergedDataProvider > xBackend = backend::BackendFactory::instance(_xContext).createBackend();
return buildCacheManager(xBackend, _xContext);
}
diff --git a/configmgr/source/treecache/cacheline.cxx b/configmgr/source/treecache/cacheline.cxx
index a4b6a05d3b..6125401aaf 100644
--- a/configmgr/source/treecache/cacheline.cxx
+++ b/configmgr/source/treecache/cacheline.cxx
@@ -32,8 +32,6 @@
#include "precompiled_configmgr.hxx"
#include "cacheline.hxx"
-#include "setnodeaccess.hxx"
-#include "treeaccessor.hxx"
#include "builddata.hxx"
#include "treechangefactory.hxx"
#include "mergechange.hxx"
@@ -44,7 +42,7 @@
namespace configmgr
{
// -----------------------------------------------------------------------------
- static inline CacheLine::Name implExtractModuleName(CacheLine::Path const& _aConfigPath)
+ static inline rtl::OUString implExtractModuleName(configuration::AbsolutePath const& _aConfigPath)
{
return _aConfigPath.getModuleName();
}
@@ -56,7 +54,7 @@ namespace configmgr
// -----------------------------------------------------------------------------
- CacheLine::CacheLine(Name const & _aModuleName)
+ CacheLine::CacheLine(rtl::OUString const & _aModuleName)
: m_base(NULL)
, m_name(_aModuleName)
, m_nDataRefs(0)
@@ -64,7 +62,7 @@ namespace configmgr
}
// -----------------------------------------------------------------------------
- CacheLine::CacheLine(Name const & _aModuleName, data::TreeAddress _pSegment)
+ CacheLine::CacheLine(rtl::OUString const & _aModuleName, sharable::TreeFragment * _pSegment)
: m_base(_pSegment)
, m_name(_aModuleName)
, m_nDataRefs(0)
@@ -73,7 +71,7 @@ namespace configmgr
// -----------------------------------------------------------------------------
- void CacheLine::setBase(data::TreeAddress _base)
+ void CacheLine::setBase(sharable::TreeFragment * _base)
{
OSL_PRECOND(m_base == NULL, "CacheLine: Data base address was already set");
OSL_PRECOND( _base != NULL, "CacheLine: Cannot set NULL base address");
@@ -81,11 +79,11 @@ namespace configmgr
}
// -----------------------------------------------------------------------------
- CacheLineRef CacheLine::createAttached( Name const & _aModuleName,
- data::TreeAddress _aSegment
- ) CFG_UNO_THROW_RTE( )
+ rtl::Reference<CacheLine> CacheLine::createAttached( rtl::OUString const & _aModuleName,
+ sharable::TreeFragment * _aSegment
+ ) SAL_THROW((com::sun::star::uno::RuntimeException))
{
- if (_aModuleName.isEmpty())
+ if (_aModuleName.getLength() == 0)
{
OSL_ENSURE(false, "Cannot make a cache line without a name");
return NULL;
@@ -96,39 +94,39 @@ namespace configmgr
return NULL;
}
- CacheLineRef xResult = new CacheLine(_aModuleName,_aSegment);
+ rtl::Reference<CacheLine> xResult = new CacheLine(_aModuleName,_aSegment);
return xResult;
}
// -----------------------------------------------------------------------------
- CacheLineRef CacheLine::createNew( Name const & _aModuleName
- ) CFG_UNO_THROW_RTE( )
+ rtl::Reference<CacheLine> CacheLine::createNew( rtl::OUString const & _aModuleName
+ ) SAL_THROW((com::sun::star::uno::RuntimeException))
{
- if (_aModuleName.isEmpty())
+ if (_aModuleName.getLength() == 0)
{
OSL_ENSURE(false, "Cannot make a cache line without a name");
return NULL;
}
- CacheLineRef xResult = new CacheLine(_aModuleName);
+ rtl::Reference<CacheLine> xResult = new CacheLine(_aModuleName);
return xResult;
}
// -------------------------------------------------------------------------
- CacheLine::Name CacheLine::getModuleName() const
+ rtl::OUString CacheLine::getModuleName() const
{
return m_name;
}
// -----------------------------------------------------------------------------
- data::TreeAddress CacheLine::getPartialTree(Path const& aConfigName) const
+ sharable::TreeFragment * CacheLine::getPartialTree(configuration::AbsolutePath const& aConfigName) const
{
- data::SetNodeAccess aParentSet( internalGetNode(aConfigName.getParentPath()) );
+ sharable::Node * parent = internalGetNode(aConfigName.getParentPath());
- if (aParentSet.isValid())
- return aParentSet.getElementTree(aConfigName.getLocalName().getName());
+ if (parent != 0 && parent->isSet())
+ return parent->set.getElement(aConfigName.getLocalName().getName());
else
return NULL;
}
@@ -136,48 +134,34 @@ namespace configmgr
bool CacheLine::hasDefaults() const
{
- if ( m_base != NULL ) return false; // cannot get defaults without data
-
- data::TreeAccessor aModuleTree(m_base);
- OSL_ASSERT( aModuleTree != NULL);
-
- return aModuleTree->hasDefaultsAvailable();
+ return m_base != 0 && m_base->hasDefaultsAvailable();
}
// -----------------------------------------------------------------------------
- data::NodeAccess CacheLine::internalGetNode(Path const& aConfigName) const
+ sharable::Node * CacheLine::internalGetNode(configuration::AbsolutePath const& aConfigName) const
{
- OSL_ENSURE( m_base != NULL, "Cannot get a node from a dataless module");
-
- data::TreeAccessor aModuleTree(m_base);
- OSL_ASSERT(aModuleTree != NULL);
-
- data::NodeAccess aNode = aModuleTree.getRootNode();
- OSL_ENSURE( aNode.isValid(), "CacheLine contains no nodes");
-
- Path::Iterator it = aConfigName.begin();
- OSL_ENSURE( it != aConfigName.end(), "Empty Path can't match any module");
- OSL_ENSURE( aNode.isValid() && aNode.getName() == it->getInternalName(), "Module part in config path does not match selected CacheLine");
-
- // find child of node
- // might be done using a visitor
- while(aNode.isValid() && ++it != aConfigName.end())
- {
- aNode = data::getSubnode(aNode,it->getName());
- }
- return aNode;
+ OSL_ASSERT(m_base != 0);
+ sharable::Node * node = m_base->getRootNode();
+ OSL_ASSERT(node != 0);
+ std::vector< configuration::Path::Component >::const_reverse_iterator i(
+ aConfigName.begin());
+ OSL_ASSERT(
+ i != aConfigName.end() && node->getName() == i->getInternalName());
+ while (node != 0 && ++i != aConfigName.end()) {
+ node = node->getSubnode(i->getName());
+ }
+ return node;
}
// -----------------------------------------------------------------------------
- data::NodeAddress CacheLine::getNode(Path const& aConfigName) const
+ sharable::Node * CacheLine::getNode(configuration::AbsolutePath const& aConfigName) const
{
- data::NodeAccess aNode = internalGetNode(aConfigName);
- return aNode;
+ return internalGetNode(aConfigName);
}
// -------------------------------------------------------------------------
- data::TreeAddress CacheLine::setComponentData( backend::ComponentData const & _aComponentInstance,
+ sharable::TreeFragment * CacheLine::setComponentData( backend::ComponentDataStruct const & _aComponentInstance,
bool _bWithDefaults
- ) CFG_UNO_THROW_RTE( )
+ ) SAL_THROW((com::sun::star::uno::RuntimeException))
{
OSL_PRECOND(_aComponentInstance.data.get(), "CacheLine::insertDefaults: inserting NULL defaults !");
OSL_PRECOND(_aComponentInstance.name == this->getModuleName(),"Data location does not match module");
@@ -193,11 +177,11 @@ namespace configmgr
}
// -----------------------------------------------------------------------------
- data::TreeAddress CacheLine::insertDefaults( backend::NodeInstance const & _aDefaultInstance
- ) CFG_UNO_THROW_RTE( )
+ sharable::TreeFragment * CacheLine::insertDefaults( backend::NodeInstance const & _aDefaultInstance
+ ) SAL_THROW((com::sun::star::uno::RuntimeException))
{
OSL_PRECOND(_aDefaultInstance.data().get(), "CacheLine::insertDefaults: inserting NULL defaults !");
- OSL_PRECOND(_aDefaultInstance.root().isModuleRoot(), "Should have complete component to fill tree with defaults");
+ OSL_PRECOND(_aDefaultInstance.root().getDepth() == 1, "Should have complete component to fill tree with defaults");
OSL_PRECOND(_aDefaultInstance.root().getModuleName() == this->getModuleName(),"Data location does not match module");
OSL_PRECOND(m_base != NULL, "Data must already be loaded to insert defaults");
@@ -212,7 +196,7 @@ namespace configmgr
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
- ExtendedCacheLine::ExtendedCacheLine(Name const & _aModuleName)
+ ExtendedCacheLine::ExtendedCacheLine(rtl::OUString const & _aModuleName)
: CacheLine(_aModuleName)
, m_pPending()
{
@@ -220,8 +204,8 @@ namespace configmgr
// -----------------------------------------------------------------------------
- ExtendedCacheLine::ExtendedCacheLine(Name const & _aModuleName,
- data::TreeAddress _aSegment)
+ ExtendedCacheLine::ExtendedCacheLine(rtl::OUString const & _aModuleName,
+ sharable::TreeFragment * _aSegment)
: CacheLine(_aModuleName,_aSegment)
, m_pPending()
{
@@ -229,11 +213,11 @@ namespace configmgr
// -----------------------------------------------------------------------------
- ExtendedCacheLineRef ExtendedCacheLine::createAttached( Name const & _aModuleName,
- data::TreeAddress _aSegment
- ) CFG_UNO_THROW_RTE( )
+ rtl::Reference<ExtendedCacheLine> ExtendedCacheLine::createAttached( rtl::OUString const & _aModuleName,
+ sharable::TreeFragment * _aSegment
+ ) SAL_THROW((com::sun::star::uno::RuntimeException))
{
- if (_aModuleName.isEmpty())
+ if (_aModuleName.getLength() == 0)
{
OSL_ENSURE(false, "Cannot make a cache line without a name");
return NULL;
@@ -244,36 +228,36 @@ namespace configmgr
return NULL;
}
- ExtendedCacheLineRef xResult = new ExtendedCacheLine(_aModuleName,_aSegment);
+ rtl::Reference<ExtendedCacheLine> xResult = new ExtendedCacheLine(_aModuleName,_aSegment);
return xResult;
}
// -----------------------------------------------------------------------------
-ExtendedCacheLineRef ExtendedCacheLine::createNew( Name const & _aModuleName
- ) CFG_UNO_THROW_RTE( )
+ rtl::Reference<ExtendedCacheLine> ExtendedCacheLine::createNew( rtl::OUString const & _aModuleName
+ ) SAL_THROW((com::sun::star::uno::RuntimeException))
{
- if (_aModuleName.isEmpty())
+ if (_aModuleName.getLength() == 0)
{
OSL_ENSURE(false, "Cannot make a cache line without a name");
return NULL;
}
- ExtendedCacheLineRef xResult = new ExtendedCacheLine(_aModuleName);
+ rtl::Reference<ExtendedCacheLine> xResult = new ExtendedCacheLine(_aModuleName);
return xResult;
}
// -------------------------------------------------------------------------
- void ExtendedCacheLine::addPending(backend::ConstUpdateInstance const & _anUpdate) CFG_UNO_THROW_RTE( )
+ void ExtendedCacheLine::addPending(backend::ConstUpdateInstance const & _anUpdate) SAL_THROW((com::sun::star::uno::RuntimeException))
{
- Path aRootLocation = _anUpdate.root().location();
+ configuration::AbsolutePath aRootLocation = _anUpdate.root();
OSL_PRECOND(!aRootLocation.isRoot(),"Pending change cannot be located at root");
OSL_PRECOND(aRootLocation.getModuleName() == this->getModuleName(),"Pending change location does not match module");
OSL_PRECOND(_anUpdate.data() != NULL,"Adding NULL 'pending' change");
- OSL_PRECOND(_anUpdate.data()->getNodeName() == aRootLocation.getLocalName().getName().toString(),
+ OSL_PRECOND(_anUpdate.data()->getNodeName() == aRootLocation.getLocalName().getName(),
"Path to pending change does not match change name");
using std::auto_ptr;
@@ -282,20 +266,20 @@ ExtendedCacheLineRef ExtendedCacheLine::createNew( Name const & _aModuleName
auto_ptr<SubtreeChange> pRootChange;
SubtreeChange *pExistingEntry = NULL;
- Path::Iterator last = aRootLocation.end();
+ std::vector<configuration::Path::Component>::const_reverse_iterator last = aRootLocation.end();
OSL_ASSERT(last != aRootLocation.begin());
--last;
- for (Path::Iterator it = aRootLocation.begin();
+ for (std::vector<configuration::Path::Component>::const_reverse_iterator it = aRootLocation.begin();
it != last;
++it)
{
OSL_ASSERT( it != aRootLocation.end());
OSL_ASSERT( it+1 != aRootLocation.end());
// We need to create a new SubtreeChange
- Name const aChangeName = it->getName();
- Name const aElementTypeName = (it+1)->getTypeName();
+ rtl::OUString const aChangeName = it->getName();
+ rtl::OUString const aElementTypeName = (it+1)->getTypeName();
auto_ptr<SubtreeChange> pNewChange =
OTreeChangeFactory::createDummyChange(aChangeName, aElementTypeName);
@@ -313,14 +297,14 @@ ExtendedCacheLineRef ExtendedCacheLine::createNew( Name const & _aModuleName
pExistingEntry->addChange(base_ptr(pNewChange));
- Change* pChange = pExistingEntry->getChange(aChangeName.toString());
+ Change* pChange = pExistingEntry->getChange(aChangeName);
pExistingEntry = static_cast<SubtreeChange*>(pChange);
- OSL_ENSURE(pChange && pChange->ISA(SubtreeChange), "ERROR: Cannot recover change just added");
+ OSL_ENSURE(dynamic_cast< SubtreeChange * >(pChange) != 0, "ERROR: Cannot recover change just added");
}
}
- auto_ptr<SubtreeChange> pAddedChange( new SubtreeChange(*_anUpdate.data(), SubtreeChange::DeepChildCopy()) );
+ auto_ptr<SubtreeChange> pAddedChange( new SubtreeChange(*_anUpdate.data(), treeop::DeepChildCopy()) );
if (aRootLocation.getDepth() > 1)
{
@@ -352,11 +336,11 @@ ExtendedCacheLineRef ExtendedCacheLine::createNew( Name const & _aModuleName
}
catch (configuration::Exception& e)
{
- OUString sMessage(RTL_CONSTASCII_USTRINGPARAM("Update cache for module: Could not add pending changes at"));
+ rtl::OUString sMessage(RTL_CONSTASCII_USTRINGPARAM("Update cache for module: Could not add pending changes at"));
sMessage += aRootLocation.toString();
- sMessage += OUString(RTL_CONSTASCII_USTRINGPARAM(". Internal Exception:")) + e.message();
+ sMessage += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(". Internal Exception:")) + e.message();
throw uno::RuntimeException(sMessage,0);
}
diff --git a/configmgr/source/treecache/cacheline.hxx b/configmgr/source/treecache/cacheline.hxx
index 8baae158e7..5035dac3e9 100644
--- a/configmgr/source/treecache/cacheline.hxx
+++ b/configmgr/source/treecache/cacheline.hxx
@@ -37,48 +37,39 @@
#include "treefragment.hxx"
#include <osl/interlck.h>
#include <rtl/ref.hxx>
+#include <salhelper/simplereferenceobject.hxx>
namespace configmgr
{
-////////////////////////////////////////////////////////////////////////////////
- using ::rtl::OUString;
-
- namespace data {
- /* class NodeAddress; */ class NodeAccess;
- }
-////////////////////////////////////////////////////////////////////////////////
/** This object represents a cache line for a single configuration tree
*/
- class CacheLine : public configmgr::SimpleReferenceObject, Noncopyable
+ class CacheLine: public salhelper::SimpleReferenceObject
{
public:
- typedef configuration::Name Name;
- typedef configuration::AbsolutePath Path;
-
// create a new CacheLine for the given component name
static rtl::Reference<CacheLine>
- createNew( Name const & _aModuleName );
+ createNew( rtl::OUString const & _aModuleName );
// create a new CacheLine attached to the given memory location
static rtl::Reference<CacheLine>
- createAttached( Name const & _aModuleName, data::TreeAddress _aLocation );
+ createAttached( rtl::OUString const & _aModuleName, sharable::TreeFragment * _aLocation );
bool hasDefaults() const;
bool isEmpty() const { return m_base == NULL; }
- data::TreeAddress getTreeAddress() const { return m_base; }
- data::TreeAddress getPartialTree(Path const & _aTemplatePath ) const;
- data::NodeAddress getNode(Path const & _aPath) const;
+ sharable::TreeFragment * getTreeAddress() const { return m_base; }
+ sharable::TreeFragment * getPartialTree(configuration::AbsolutePath const & _aTemplatePath ) const;
+ sharable::Node * getNode(configuration::AbsolutePath const & _aPath) const;
- data::TreeAddress setComponentData( backend::ComponentData const & _aComponentInstance,
+ sharable::TreeFragment * setComponentData( backend::ComponentDataStruct const & _aComponentInstance,
bool _bWithDefaults
- ) CFG_UNO_THROW_RTE();
+ ) SAL_THROW((com::sun::star::uno::RuntimeException));
- data::TreeAddress insertDefaults( backend::NodeInstance const & _aDefaultInstance
- ) CFG_UNO_THROW_RTE();
+ sharable::TreeFragment * insertDefaults( backend::NodeInstance const & _aDefaultInstance
+ ) SAL_THROW((com::sun::star::uno::RuntimeException));
// get the module name for this component
- Name getModuleName() const;
+ rtl::OUString getModuleName() const;
/// add a client for this module's data
oslInterlockedCount clientReferences() const { return m_nDataRefs; }
@@ -90,24 +81,23 @@ namespace configmgr
protected:
// create a new CacheLine attached to the given memory location
explicit
- CacheLine( Name const & _aModuleName, data::TreeAddress _pLocation );
+ CacheLine( rtl::OUString const & _aModuleName, sharable::TreeFragment * _pLocation );
// create a new empty CacheLine for the given component name
explicit
- CacheLine( Name const & _aModuleName );
+ CacheLine( rtl::OUString const & _aModuleName );
- data::NodeAccess internalGetNode(Path const & _rPath) const;
+ sharable::Node * internalGetNode(configuration::AbsolutePath const & _rPath) const;
- data::TreeAddress base() const { return m_base; }
- void setBase(data::TreeAddress _base);
+ sharable::TreeFragment * base() const { return m_base; }
+ void setBase(sharable::TreeFragment * _base);
private:
- data::TreeAddress m_base;
- Name m_name;
+ sharable::TreeFragment * m_base;
+ rtl::OUString m_name;
oslInterlockedCount m_nDataRefs; /// the number of clients on this modules data
};
- typedef rtl::Reference<CacheLine> CacheLineRef;
////////////////////////////////////////////////////////////////////////////////
/** This object represents a cache line and associated data for a single configuration tree
@@ -117,33 +107,32 @@ namespace configmgr
public:
// create a new CacheLine for the given component name
static rtl::Reference<ExtendedCacheLine>
- createNew( Name const & _aModuleName );
+ createNew( rtl::OUString const & _aModuleName );
// create a new CacheLine attached to the given memory location
static rtl::Reference<ExtendedCacheLine>
- createAttached( Name const & _aModuleName,
- data::TreeAddress _aLocation );
+ createAttached( rtl::OUString const & _aModuleName,
+ sharable::TreeFragment * _aLocation );
// management of pending changes
bool hasPending() const {return m_pPending.get() != NULL;}
- void addPending(backend::ConstUpdateInstance const & _anUpdate) CFG_UNO_THROW_RTE();
+ void addPending(backend::ConstUpdateInstance const & _anUpdate) SAL_THROW((com::sun::star::uno::RuntimeException));
std::auto_ptr<SubtreeChange> releasePending() {return m_pPending;}
private:
// create a new empty CacheLine for the given component name
explicit
- ExtendedCacheLine( Name const & _aModuleName );
+ ExtendedCacheLine( rtl::OUString const & _aModuleName );
// create a new CacheLine attached to the given memory location
explicit
- ExtendedCacheLine( Name const & _aModuleName,
- data::TreeAddress _aLocation );
+ ExtendedCacheLine( rtl::OUString const & _aModuleName,
+ sharable::TreeFragment * _aLocation );
private:
std::auto_ptr<SubtreeChange> m_pPending;
};
- typedef rtl::Reference<ExtendedCacheLine> ExtendedCacheLineRef;
} // namespace configmgr
diff --git a/configmgr/source/treecache/cachemulticaster.cxx b/configmgr/source/treecache/cachemulticaster.cxx
index 9d33d2dbaa..d5c0e9a1ec 100644
--- a/configmgr/source/treecache/cachemulticaster.cxx
+++ b/configmgr/source/treecache/cachemulticaster.cxx
@@ -32,6 +32,7 @@
#include "precompiled_configmgr.hxx"
#include "cachemulticaster.hxx"
+#include "treemanager.hxx"
#ifndef INCLUDED_ALGORITHM
#include <algorithm>
@@ -51,50 +52,46 @@ namespace configmgr
namespace
{
// manually implemented helpers, as rtl::References don't work well with std binders
- typedef CacheChangeMulticaster::ListenerRef ListenerRef;
// ---------------------------------------------------------------------------
// replacing std::bind2nd( std::mem_fun(&aFunc), aArg )
- struct NotifyDisposing : std::unary_function<ListenerRef,void>
+ struct NotifyDisposing : std::unary_function<rtl::Reference<TreeManager>,void>
{
- typedef ICachedDataProvider Arg;
- Arg & m_arg;
+ CacheController & m_arg;
- NotifyDisposing(Arg * _pProvider) CFG_NOTHROW()
+ NotifyDisposing(CacheController * _pProvider) SAL_THROW(())
: m_arg(*_pProvider)
{}
- void operator()(ListenerRef const & _xListener) const CFG_NOTHROW()
+ void operator()(rtl::Reference<TreeManager> const & _xListener) const SAL_THROW(())
{ _xListener->disposing(m_arg); }
};
// ---------------------------------------------------------------------------
- // replacing std::bind2nd( std::mem_fun(&ICachedDataListener::componentCreated), _aComponentName )
- struct NotifyCreated : std::unary_function<ListenerRef,void>
+ // replacing std::bind2nd( std::mem_fun(&TreeManager::componentCreated), _aComponentName )
+ struct NotifyCreated : std::unary_function<rtl::Reference<TreeManager>,void>
{
- typedef ComponentRequest const Arg;
- Arg & m_arg;
+ ComponentRequest const & m_arg;
- NotifyCreated(Arg * _pComponent) CFG_NOTHROW()
+ NotifyCreated(ComponentRequest const * _pComponent) SAL_THROW(())
: m_arg(*_pComponent)
{}
- void operator()(ListenerRef const & _xListener) const CFG_NOTHROW()
+ void operator()(rtl::Reference<TreeManager> const & _xListener) const SAL_THROW(())
{ _xListener->componentCreated(m_arg); }
};
// ---------------------------------------------------------------------------
- // replacing std::bind2nd( std::mem_fun(&ICachedDataListener::componentChanged), _aComponentName )
- struct NotifyChanged : std::unary_function<ListenerRef,void>
+ // replacing std::bind2nd( std::mem_fun(&TreeManager::componentChanged), _aComponentName )
+ struct NotifyChanged : std::unary_function<rtl::Reference<TreeManager>,void>
{
- typedef UpdateRequest const Arg;
- Arg & m_arg;
+ UpdateRequest const & m_arg;
- NotifyChanged(Arg * _pUpdate) CFG_NOTHROW()
+ NotifyChanged(UpdateRequest const * _pUpdate) SAL_THROW(())
: m_arg(*_pUpdate)
{}
- void operator()(ListenerRef const & _xListener) const CFG_NOTHROW()
+ void operator()(rtl::Reference<TreeManager> const & _xListener) const SAL_THROW(())
{ _xListener->componentChanged(m_arg); }
};
// ---------------------------------------------------------------------------
@@ -114,43 +111,30 @@ CacheChangeMulticaster::~CacheChangeMulticaster()
}
// ---------------------------------------------------------------------------
-inline CacheChangeMulticaster::ListenerList CacheChangeMulticaster::copyListenerList()
+inline std::list< rtl::Reference<TreeManager> > CacheChangeMulticaster::copyListenerList()
{
osl::MutexGuard aListGuard(m_aMutex);
return m_aListeners;
}
// ---------------------------------------------------------------------------
-void CacheChangeMulticaster::dispose(ICachedDataProvider & _rProvider) CFG_NOTHROW()
+void CacheChangeMulticaster::notifyCreated(ComponentRequest const & _aComponent) SAL_THROW(())
{
- osl::ClearableMutexGuard aListGuard(m_aMutex);
-
- ListenerList aNotifyListeners;
- aNotifyListeners.swap(m_aListeners);
-
- aListGuard.clear();
-
- std::for_each( aNotifyListeners.begin(), aNotifyListeners.end(), NotifyDisposing(&_rProvider) );
-}
-// ---------------------------------------------------------------------------
-
-void CacheChangeMulticaster::notifyCreated(ComponentRequest const & _aComponent) CFG_NOTHROW()
-{
- ListenerList aNotifyListeners( this->copyListenerList() );
+ std::list< rtl::Reference<TreeManager> > aNotifyListeners( this->copyListenerList() );
std::for_each( aNotifyListeners.begin(), aNotifyListeners.end(), NotifyCreated(&_aComponent) );
}
// ---------------------------------------------------------------------------
-void CacheChangeMulticaster::notifyChanged(UpdateRequest const & _anUpdate) CFG_NOTHROW()
+void CacheChangeMulticaster::notifyChanged(UpdateRequest const & _anUpdate) SAL_THROW(())
{
- ListenerList aNotifyListeners( this->copyListenerList() );
+ std::list< rtl::Reference<TreeManager> > aNotifyListeners( this->copyListenerList() );
std::for_each( aNotifyListeners.begin(), aNotifyListeners.end(), NotifyChanged(&_anUpdate) );
}
// ---------------------------------------------------------------------------
-void CacheChangeMulticaster::addListener(ListenerRef _xListener) CFG_NOTHROW()
+void CacheChangeMulticaster::addListener(rtl::Reference<TreeManager> _xListener) SAL_THROW(())
{
osl::MutexGuard aListGuard(m_aMutex);
@@ -164,7 +148,7 @@ void CacheChangeMulticaster::addListener(ListenerRef _xListener) CFG_NOTHROW()
}
// ---------------------------------------------------------------------------
-void CacheChangeMulticaster::removeListener(ListenerRef _xListener) CFG_NOTHROW()
+void CacheChangeMulticaster::removeListener(rtl::Reference<TreeManager> _xListener) SAL_THROW(())
{
osl::MutexGuard aListGuard(m_aMutex);
m_aListeners.remove(_xListener);
diff --git a/configmgr/source/treecache/cachemulticaster.hxx b/configmgr/source/treecache/cachemulticaster.hxx
index 7500cd7cbc..6fcb7fc13b 100644
--- a/configmgr/source/treecache/cachemulticaster.hxx
+++ b/configmgr/source/treecache/cachemulticaster.hxx
@@ -28,64 +28,58 @@
*
************************************************************************/
-/* PLEASE DON'T DELETE ANY COMMENT LINES, ALSO IT'S UNNECESSARY. */
-
-
#ifndef CONFIGMGR_BACKEND_CACHEMULTICASTER_HXX
#define CONFIGMGR_BACKEND_CACHEMULTICASTER_HXX
-#include "cacheddataprovider.hxx"
-#include <osl/mutex.hxx>
+#include "sal/config.h"
-#ifndef INCLUDED_LIST
#include <list>
-#define INCLUDED_LIST
-#endif
+
+#include "osl/mutex.hxx"
+#include "rtl/ref.hxx"
+
+#include "utility.hxx"
namespace configmgr
{
-// ---------------------------------------------------------------------------
+ class TreeManager;
+
namespace backend
{
+ class ComponentRequest;
+ class UpdateRequest;
// ---------------------------------------------------------------------------
/** Interface providing a multicasting service for changes to the cache
- managed by a <type>ICachedDataProvider</type>
+ managed by a <type>CacheController</type>
*/
- class CacheChangeMulticaster : public ICachedDataNotifier
+ class CacheChangeMulticaster
{
public:
CacheChangeMulticaster();
virtual ~CacheChangeMulticaster();
- // ICachedDataNotifier implementation
- public:
- /// notify all registered listeners and close down this notifier
- virtual void dispose(ICachedDataProvider & _rProvider) CFG_NOTHROW();
-
/** notify a new component to all registered listeners.
<p> Must be called after the component has been created in the cache.</p>
*/
- virtual void notifyCreated(ComponentRequest const & _aComponentName) CFG_NOTHROW();
+ void notifyCreated(ComponentRequest const & _aComponentName) SAL_THROW(());
/** notify changed data to all registered listeners.
<p> Must be called after the change has been applied to the cache
and before any subsequent changes to the same component.</p>
*/
- virtual void notifyChanged(UpdateRequest const & _anUpdate) CFG_NOTHROW();
+ void notifyChanged(UpdateRequest const & _anUpdate) SAL_THROW(());
// notification support.
/// register a listener for observing changes to the cached data
- virtual void addListener(ListenerRef _xListener) CFG_NOTHROW();
+ void addListener(rtl::Reference<TreeManager> _xListener) SAL_THROW(());
/// unregister a listener previously registered
- virtual void removeListener(ListenerRef _xListener) CFG_NOTHROW();
+ void removeListener(rtl::Reference<TreeManager> _xListener) SAL_THROW(());
private:
- typedef std::list<ListenerRef> ListenerList;
-
- ListenerList copyListenerList();
+ std::list< rtl::Reference<TreeManager> > copyListenerList();
osl::Mutex m_aMutex;
- ListenerList m_aListeners;
+ std::list< rtl::Reference<TreeManager> > m_aListeners;
};
// ---------------------------------------------------------------------------
} // namespace backend
diff --git a/configmgr/source/treecache/cachewritescheduler.cxx b/configmgr/source/treecache/cachewritescheduler.cxx
index d3704fd63b..0303a771ab 100644
--- a/configmgr/source/treecache/cachewritescheduler.cxx
+++ b/configmgr/source/treecache/cachewritescheduler.cxx
@@ -123,13 +123,13 @@ void OCacheWriteScheduler::runWriter()
}
// -----------------------------------------------------------------------------
-void OCacheWriteScheduler::writeOneTreeFoundByOption(RequestOptions const& _aOptions) CFG_UNO_THROW_ALL( )
+void OCacheWriteScheduler::writeOneTreeFoundByOption(RequestOptions const& _aOptions) SAL_THROW((com::sun::star::uno::Exception))
{
CFG_TRACE_INFO("Writeing one cache tree for user '%s' with locale '%s'",
OUSTRING2ASCII(_aOptions.getEntity()),
OUSTRING2ASCII(_aOptions.getLocale()));
- backend::CacheController::CacheRef aCache;
+ rtl::Reference<CacheLoadingAccess> aCache;
aCache = m_rTreeManager.m_aCacheMap.get(_aOptions);
if (aCache.is())
@@ -196,7 +196,7 @@ void OCacheWriteScheduler::implStartBefore(TimeStamp const& _aTime)
}
// -----------------------------------------------------------------------------
-void OCacheWriteScheduler::scheduleWrite(backend::ComponentRequest _aComponent) CFG_UNO_THROW_ALL( )
+void OCacheWriteScheduler::scheduleWrite(backend::ComponentRequest _aComponent) SAL_THROW((com::sun::star::uno::Exception))
{
OSL_ENSURE(_aComponent.getOptions().hasLocale(), "ERROR: OTreeDisposeScheduler: cannot handle complete user scheduling");
diff --git a/configmgr/source/treecache/cachewritescheduler.hxx b/configmgr/source/treecache/cachewritescheduler.hxx
index 031ab30574..853802b38f 100644
--- a/configmgr/source/treecache/cachewritescheduler.hxx
+++ b/configmgr/source/treecache/cachewritescheduler.hxx
@@ -31,6 +31,7 @@
#ifndef CONFIGMGR_CACHEWRITESCHEDULER_HXX
#define CONFIGMGR_CACHEWRITESCHEDULER_HXX
+#include "datalock.hxx"
#include "requestoptions.hxx"
#include "timestamp.hxx"
#include "utility.hxx"
@@ -106,7 +107,7 @@ namespace configmgr
return aBaseTime + aDelay;
}
//-------- Control of execution ------------------------------------------
- void scheduleWrite(backend::ComponentRequest _aComponent) CFG_UNO_THROW_ALL( );
+ void scheduleWrite(backend::ComponentRequest _aComponent) SAL_THROW((com::sun::star::uno::Exception));
/// stop pending activities for one set of options (do not discard them)
bool clearTasks(RequestOptions const& _xOptions);
@@ -119,7 +120,7 @@ namespace configmgr
void runWriter();
void implStartBefore(TimeStamp const& _aTime);
- void writeOneTreeFoundByOption(RequestOptions const& _aOption) CFG_UNO_THROW_ALL( );
+ void writeOneTreeFoundByOption(RequestOptions const& _aOption) SAL_THROW((com::sun::star::uno::Exception));
};
} // namespace configmgr
diff --git a/configmgr/source/treecache/disposetimer.cxx b/configmgr/source/treecache/disposetimer.cxx
index 2d129bba3b..cabe6f39bc 100644
--- a/configmgr/source/treecache/disposetimer.cxx
+++ b/configmgr/source/treecache/disposetimer.cxx
@@ -31,8 +31,7 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_configmgr.hxx"
-#include <stdio.h>
-
+#include "datalock.hxx"
#include "disposetimer.hxx"
#include "cachecontroller.hxx"
#include "configexcept.hxx"
@@ -109,11 +108,11 @@ void OTreeDisposeScheduler::stopAndClearTasks()
}
// -------------------------------------------------------------------------
-OTreeDisposeScheduler::Task OTreeDisposeScheduler::getTask(TimeStamp const& _aActualTime, TimeStamp& _rNextTime)
+std::pair<bool,RequestOptions> OTreeDisposeScheduler::getTask(TimeStamp const& _aActualTime, TimeStamp& _rNextTime)
{
OSL_ASSERT( _rNextTime.isNever() ); // internal contract, we set this only in the positive case
- Task aTask( false, RequestOptions() );
+ std::pair<bool,RequestOptions> aTask( false, RequestOptions() );
if (!m_aAgenda.empty())
{
@@ -186,7 +185,7 @@ TimeStamp OTreeDisposeScheduler::runDisposer(TimeStamp const& _aActualTime)
OSL_ASSERT(UnoApiLock::isHeld());
- Task aTask = this->getTask( _aActualTime, aNextTime );
+ std::pair<bool,RequestOptions> aTask = this->getTask( _aActualTime, aNextTime );
if (aTask.first)
{
RequestOptions & rTaskOptions = aTask.second;
@@ -195,12 +194,12 @@ TimeStamp OTreeDisposeScheduler::runDisposer(TimeStamp const& _aActualTime)
OUSTRING2ASCII(rTaskOptions.getEntity()),
OUSTRING2ASCII(rTaskOptions.getLocale()));
- CacheManager::CacheRef aCache = m_rTreeManager.m_aCacheMap.get(rTaskOptions);
+ rtl::Reference<CacheLoadingAccess> aCache = m_rTreeManager.m_aCacheMap.get(rTaskOptions);
if (aCache.is())
{
CFG_TRACE_INFO_NI("- Found matching data container (TreeInfo) - collecting data");
- CacheLoadingAccess::DisposeList aDisposeList;
+ std::vector< rtl::Reference<CacheLine> > aDisposeList;
TimeStamp aNextTaskTime = aCache->collectDisposeList(aDisposeList, _aActualTime, m_aCleanupDelay);
@@ -223,26 +222,6 @@ TimeStamp OTreeDisposeScheduler::runDisposer(TimeStamp const& _aActualTime)
// currently it is not possible to release options which are
// because it is not save to delete the info if another thread is running in
// a read request
-
- /*
-
- CFG_TRACE_INFO_NI("- Disposing last data for this options set => Removing TreeInfo" );
-
- // get rid of it - see TreeManager::disposeOne
- std::auto_ptr<TreeInfo> pDisposeInfo(pInfo);
-
- m_rTreeManager.m_aTreeList.erase(xTaskOption);
- // got it out of reachability - now dispose/notify without lock
-
- aGuard.clear();
- m_rTreeManager.ConfigChangeBroadcaster::disposeBroadcastHelper(pInfo->pBroadcastHelper);
-
- OSL_ENSURE(pInfo->m_aNotificationList.empty(),
- "WARNING: Empty TreeInfo still has notifications registered - will be leaked");
-
- pInfo = NULL;
-
- */
}
else
CFG_TRACE_INFO_NI("- Currently no more cleanup tasks for this options set" );
diff --git a/configmgr/source/treecache/disposetimer.hxx b/configmgr/source/treecache/disposetimer.hxx
index 2be1b7b29e..2f3beece63 100644
--- a/configmgr/source/treecache/disposetimer.hxx
+++ b/configmgr/source/treecache/disposetimer.hxx
@@ -62,7 +62,6 @@ namespace configmgr
class OTreeDisposeScheduler
{
typedef std::multimap< TimeStamp, RequestOptions, ltTimeStamp > Agenda;
- typedef backend::CacheController CacheManager;
class Timer : public vos::OTimer
{
@@ -82,14 +81,14 @@ namespace configmgr
private:
Agenda m_aAgenda;
vos::ORef<Timer> m_xTimer;
- CacheManager& m_rTreeManager;
+ backend::CacheController& m_rTreeManager;
TimeInterval m_aCleanupDelay;
TimeInterval m_aCleanupInterval;
public:
//-------- Construction and destruction -----------------------------------
explicit
- OTreeDisposeScheduler(CacheManager& _rTreeManager, TimeInterval const& _aCleanupDelay)
+ OTreeDisposeScheduler(backend::CacheController& _rTreeManager, TimeInterval const& _aCleanupDelay)
: m_rTreeManager(_rTreeManager)
, m_aCleanupDelay(_aCleanupDelay)
, m_aCleanupInterval(_aCleanupDelay)
@@ -98,7 +97,7 @@ namespace configmgr
}
explicit
- OTreeDisposeScheduler(CacheManager& _rTreeManager, TimeInterval const& _aCleanupDelay, TimeInterval const& _aCleanupInterval)
+ OTreeDisposeScheduler(backend::CacheController& _rTreeManager, TimeInterval const& _aCleanupDelay, TimeInterval const& _aCleanupInterval)
: m_rTreeManager(_rTreeManager)
, m_aCleanupDelay(_aCleanupDelay)
, m_aCleanupInterval(_aCleanupInterval)
@@ -154,8 +153,7 @@ namespace configmgr
// vos::OTimer
void onTimerShot();
- typedef std::pair<bool,RequestOptions> Task;
- Task getTask(TimeStamp const& _aActualTime, TimeStamp& _aNextTime);
+ std::pair<bool,RequestOptions> getTask(TimeStamp const& _aActualTime, TimeStamp& _aNextTime);
/// ensure this will execute cleanup duties for _xOptions (no later than after getCleanupDelay() has elapsed)
// TimeStamp fillDisposeList(CacheLoadingAccess & _aCache, DisposeList& _rList, TimeStamp const& aLimitTime)
diff --git a/configmgr/source/treecache/invalidatetree.cxx b/configmgr/source/treecache/invalidatetree.cxx
index 6aebc7cb51..9310716171 100644
--- a/configmgr/source/treecache/invalidatetree.cxx
+++ b/configmgr/source/treecache/invalidatetree.cxx
@@ -37,7 +37,6 @@
#include "valuenode.hxx"
#include "updatehelper.hxx"
#include "treeactions.hxx"
-#include "treeaccessor.hxx"
#include "tracer.hxx"
#include <com/sun/star/uno/Any.hxx>
#include <com/sun/star/container/NoSuchElementException.hpp>
@@ -50,8 +49,6 @@
namespace configmgr
{
- using namespace com::sun::star::uno;
- using namespace configuration;
namespace container = com::sun::star::container;
// -----------------------------------------------------------------------------
// ------------------------------- invalidateTree -------------------------------
@@ -60,26 +57,26 @@ namespace configmgr
namespace backend
{
// -----------------------------------------------------------------------------
-std::auto_ptr<SubtreeChange> createDiffs(data::NodeAccess const& _aCachedNode,
+std::auto_ptr<SubtreeChange> createDiffs(sharable::Node * cachedNode,
ISubtree const * _pLoadedSubtree,
- AbsolutePath const& _aAbsoluteSubtreePath)
+ configuration::AbsolutePath const& _aAbsoluteSubtreePath)
{
- OSL_PRECOND(_aCachedNode.isValid(), "Need an existing node to create a diff");
+ OSL_PRECOND(cachedNode != 0, "Need an existing node to create a diff");
OSL_PRECOND(_pLoadedSubtree != 0, "Need a result node to create a diff");
// Create a TreeChangeList with the right name, parentname and ConfigurationProperties
- std::auto_ptr<SubtreeChange> aNewChange(new SubtreeChange(_aAbsoluteSubtreePath.getLocalName().getName().toString(),
+ std::auto_ptr<SubtreeChange> aNewChange(new SubtreeChange(_aAbsoluteSubtreePath.getLocalName().getName(),
node::Attributes()) );
- if (!createUpdateFromDifference(*aNewChange, _aCachedNode, *_pLoadedSubtree))
+ if (!createUpdateFromDifference(*aNewChange, cachedNode, *_pLoadedSubtree))
aNewChange.reset();
return aNewChange;
}
// -----------------------------------------------------------------------------
#if 0
-std::auto_ptr<ISubtree> TreeManager::loadNodeFromSession( AbsolutePath const& _aAbsoluteSubtreePath,
+std::auto_ptr<ISubtree> TreeManager::loadNodeFromSession( configuration::AbsolutePath const& _aAbsoluteSubtreePath,
const vos::ORef < OOptions >& _xOptions,
- sal_Int16 _nMinLevels) CFG_UNO_THROW_ALL()
+ sal_Int16 _nMinLevels) SAL_THROW((com::sun::star::uno::Exception))
{
TreeInfo* pInfo = this->requestTreeInfo(_xOptions,true /*create TreeInfo*/);
@@ -110,11 +107,11 @@ std::auto_ptr<ISubtree> TreeManager::loadNodeFromSession( AbsolutePath const& _a
#endif
// -----------------------------------------------------------------------------
-CacheLocation CacheController::refreshComponent(ComponentRequest const & _aRequest) CFG_UNO_THROW_ALL()
+sharable::TreeFragment * CacheController::refreshComponent(ComponentRequest const & _aRequest) SAL_THROW((com::sun::star::uno::Exception))
{
if (m_bDisposing) return NULL;
- CacheRef aCache = this->getCacheAlways(_aRequest.getOptions());
+ rtl::Reference<CacheLoadingAccess> aCache = this->getCacheAlways(_aRequest.getOptions());
if (!aCache.is()) return NULL;
@@ -122,31 +119,30 @@ CacheLocation CacheController::refreshComponent(ComponentRequest const & _aReque
ComponentRequest aForcedRequest(_aRequest);
aForcedRequest.forceReload();
- ComponentResult aLoadedInstance = this->getComponentData(aForcedRequest,false);
- AbsolutePath aRequestPath = AbsolutePath::makeModulePath(_aRequest.getComponentName(), AbsolutePath::NoValidate());
+ ResultHolder< ComponentInstance > aLoadedInstance = this->getComponentData(aForcedRequest,false);
+ configuration::AbsolutePath aRequestPath = configuration::AbsolutePath::makeModulePath(_aRequest.getComponentName());
NodeInstance aNodeInstance(aLoadedInstance.mutableInstance().mutableData(),aRequestPath) ;
- NodeResult aLoadedNodeInstance(aNodeInstance) ;
+ ResultHolder< NodeInstance > aLoadedNodeInstance(aNodeInstance) ;
- data::TreeAddress aResult = NULL;
+ sharable::TreeFragment * aResult = NULL;
if (aLoadedNodeInstance.is())
{
- Name aModuleName = aLoadedNodeInstance->root().getModuleName();
+ rtl::OUString aModuleName = aLoadedNodeInstance->root().getModuleName();
bool bAcquired = aCache->acquireModule(aModuleName);
- aResult = CacheLocation( aCache->getTreeAddress(aModuleName) );
+ aResult = (sharable::TreeFragment *)( aCache->getTreeAddress(aModuleName) );
if (bAcquired)
try
{
std::auto_ptr<SubtreeChange> aTreeChanges;
- data::NodeAddress aRootAddress;
+ sharable::Node * aRootAddress;
{
- data::TreeAccessor aTreeAccess(aResult);
- data::NodeAccess aRootNode = aTreeAccess.getRootNode();
+ sharable::Node * rootNode = aResult == 0 ? 0 : aResult->getRootNode();
- aTreeChanges = createDiffs(aRootNode, aLoadedNodeInstance->data().get(), aLoadedNodeInstance->root().location());
- aRootAddress = aRootNode;
+ aTreeChanges = createDiffs(rootNode, aLoadedNodeInstance->data().get(), aLoadedNodeInstance->root());
+ aRootAddress = rootNode;
}
if (aTreeChanges.get() != NULL)
@@ -155,7 +151,7 @@ CacheLocation CacheController::refreshComponent(ComponentRequest const & _aReque
applyUpdateWithAdjustmentToTree(*aTreeChanges, aRootAddress);
UpdateRequest anUpdateReq( aTreeChanges.get(),
- aLoadedNodeInstance->root().location(),
+ aLoadedNodeInstance->root(),
_aRequest.getOptions()
);
diff --git a/configmgr/source/treecache/treemanager.cxx b/configmgr/source/treecache/treemanager.cxx
index a1a4b43d9e..221939aba0 100644
--- a/configmgr/source/treecache/treemanager.cxx
+++ b/configmgr/source/treecache/treemanager.cxx
@@ -34,8 +34,8 @@
#include "treemanager.hxx"
#include "mergeddataprovider.hxx"
#include "cacheaccess.hxx"
-#include "nodeaccess.hxx"
-#include "treeaccessor.hxx"
+#include "cachecontroller.hxx"
+#include "cachemulticaster.hxx"
#include <com/sun/star/container/NoSuchElementException.hpp>
#include <com/sun/star/lang/DisposedException.hpp>
#include "tracer.hxx"
@@ -49,8 +49,6 @@ namespace configmgr
namespace lang= ::com::sun::star::lang;
namespace Path = configuration::Path;
- using configuration::Name;
- using configuration::AbsolutePath;
// =========================================================================
//#if OSL_DEBUG_LEVEL > 0
#if 0 // currently not used in debug build!
@@ -63,13 +61,13 @@ static void test_complete(memory::HeapManager & _rDummy)
// =========================================================================
static inline
-AbsolutePath extractModulePath(AbsolutePath const & _aPath)
+configuration::AbsolutePath extractModulePath(configuration::AbsolutePath const & _aPath)
{
if (_aPath.getDepth() <= 1) return _aPath;
- Name aModule = _aPath.getModuleName();
+ rtl::OUString aModule = _aPath.getModuleName();
- return AbsolutePath::makeModulePath( aModule, AbsolutePath::NoValidate() );
+ return configuration::AbsolutePath::makeModulePath(aModule);
}
// =========================================================================
@@ -86,7 +84,7 @@ void TreeManager::disposeAll()
for (CacheList::Map::iterator i = aReleaseList.begin(); i != aReleaseList.end(); ++i)
{
if (ConfigChangeBroadcastHelper * pHelper = i->second->releaseBroadcaster())
- ConfigChangeBroadcaster::disposeBroadcastHelper(pHelper);
+ disposeBroadcastHelper(pHelper);
i->second.clear();
}
}
@@ -98,7 +96,7 @@ void TreeManager::dispose()
RTL_LOGFILE_CONTEXT_AUTHOR(aLog, "configmgr::TreeManager", "jb99855", "configmgr: TreeManager::dispose().");
- BackendCacheRef xBackendCache = maybeGetBackendCache();
+ rtl::Reference< backend::CacheController > xBackendCache = maybeGetBackendCache();
if (xBackendCache.is()) xBackendCache->getNotifier().removeListener(this);
@@ -109,93 +107,9 @@ void TreeManager::dispose()
}
// -------------------------------------------------------------------------
-void TreeManager::disposeOne(RequestOptions const& _aOptions)
-{
- CFG_TRACE_INFO("TreeManager: Disposing data and TreeInfo for user '%s' with locale '%s'",
- OUSTRING2ASCII(_aOptions.getEntity()), OUSTRING2ASCII(_aOptions.getLocale()) );
-
- CacheRef aRemoved = m_aCacheList.remove(_aOptions);
-
- if (aRemoved.is())
- {
- // got it out of reachability - now dispose/notify without lock
- implDisposeOne(aRemoved, _aOptions);
- }
- else
- CFG_TRACE_INFO_NI("- No affected TreeInfo found" );
-}
-
-// -------------------------------------------------------------------------
-void TreeManager::disposeUser(RequestOptions const& _aUserOptions)
-{
- CFG_TRACE_INFO("TreeManager: Disposing data and TreeInfo(s) for user '%s'",
- OUSTRING2ASCII(_aUserOptions.getEntity()) );
-
- typedef std::vector< std::pair< RequestOptions, CacheRef > > DisposeList;
-
- DisposeList aDisposeList;
- // collect the ones to dispose
- {
- OUString sUser = _aUserOptions.getEntity();
- OSL_ASSERT(sUser.getLength());
-
- // This depends on the fact that Options are sorted (by struct ltOptions)
- // so that all options belonging to one user are together
- // (and that options with only a user set, sort first)
-
- CacheList::Map aCacheData;
- m_aCacheList.swap(aCacheData);
-
- // find the lower_bound of all options for the user
- CacheList::Map::iterator const aFirst = aCacheData.lower_bound(_aUserOptions);
-
- // find the upper_bound of all options for the user (using the lower one)
- CacheList::Map::iterator aLast = aFirst;
- while (aLast != aCacheData.end() && aLast->first.getEntity() == sUser)
- {
- CFG_TRACE_INFO_NI("- Found TreeInfo for locale '%s'", OUSTRING2ASCII(aLast->first.getLocale()) );
- OSL_ASSERT(aLast->second.is());
-
- if (aLast->second.is())
- aDisposeList.push_back( DisposeList::value_type(aLast->first,aLast->second) );
-
- ++aLast;
- }
-
- if (aFirst == aLast)
- CFG_TRACE_INFO_NI("- No affected TreeInfo found" );
-
- aCacheData.erase(aFirst, aLast);
-
- // replace the data into the map
- m_aCacheList.swap(aCacheData);
- }
-
- for (DisposeList::iterator i = aDisposeList.begin(); i != aDisposeList.end(); ++i)
- {
- if (i->second.is())
- implDisposeOne(i->second, i->first);
- }
-}
-
-// -------------------------------------------------------------------------
-void TreeManager::implDisposeOne(CacheRef const & _aDisposedCache, RequestOptions const & _aOptions)
-{
- (void) _aOptions; // avoid warning about unused parameter
- OSL_ASSERT(_aDisposedCache.is());
- CFG_TRACE_INFO("Now removing TreeInfo (user '%s' with locale '%s') and broadcaster",
- OUSTRING2ASCII(_aOptions.getEntity()), OUSTRING2ASCII(_aOptions.getLocale()) );
-
- // to do: release at the backend (?)
- if (ConfigChangeBroadcastHelper * pHelper = _aDisposedCache->releaseBroadcaster())
- ConfigChangeBroadcaster::disposeBroadcastHelper(pHelper);
-}
-
-// ConfigChangeBroadcaster
-// -------------------------------------------------------------------------
ConfigChangeBroadcastHelper* TreeManager::getBroadcastHelper(RequestOptions const& _aOptions, bool bCreate)
{
- CacheRef aCache = bCreate ? this->getCacheAlways(_aOptions)
+ rtl::Reference<CacheClientAccess> aCache = bCreate ? this->getCacheAlways(_aOptions)
: m_aCacheList.get(_aOptions);
return aCache.is() ? aCache->getBroadcaster() : NULL;
@@ -203,7 +117,7 @@ ConfigChangeBroadcastHelper* TreeManager::getBroadcastHelper(RequestOptions cons
// -------------------------------------------------------------------------
-TreeManager::TreeManager(BackendCacheRef const & _xBackend)
+TreeManager::TreeManager(rtl::Reference< backend::CacheController > const & _xBackend)
: m_xCacheController(_xBackend)
, m_aCacheList()
, m_aTemplates(new CacheData())
@@ -220,33 +134,33 @@ TreeManager::~TreeManager()
}
// -------------------------------------------------------------------------
-TreeManager::BackendCacheRef TreeManager::maybeGetBackendCache() CFG_NOTHROW( )
+rtl::Reference< backend::CacheController > TreeManager::maybeGetBackendCache() SAL_THROW(())
{
osl::MutexGuard aGuard(m_aCacheControllerMutex);
- BackendCacheRef xResult(m_xCacheController);
+ rtl::Reference< backend::CacheController > xResult(m_xCacheController);
return xResult;
}
// -------------------------------------------------------------------------
-TreeManager::BackendCacheRef TreeManager::getCacheLoader() CFG_UNO_THROW_RTE( )
+rtl::Reference< backend::CacheController > TreeManager::getCacheLoader() SAL_THROW((com::sun::star::uno::RuntimeException))
{
osl::MutexGuard aGuard(m_aCacheControllerMutex);
if (!m_xCacheController.is())
{
- OUString sMsg = OUString::createFromAscii("TreeManager: No backend available - tree manager was already disposed.");
+ rtl::OUString sMsg = rtl::OUString::createFromAscii("TreeManager: No backend available - tree manager was already disposed.");
throw com::sun::star::lang::DisposedException(sMsg,NULL);
}
- BackendCacheRef xResult(m_xCacheController);
+ rtl::Reference< backend::CacheController > xResult(m_xCacheController);
return xResult;
}
// -------------------------------------------------------------------------
-void TreeManager::disposeBackendCache() CFG_NOTHROW( )
+void TreeManager::disposeBackendCache() SAL_THROW(())
{
osl::ClearableMutexGuard aGuard(m_aCacheControllerMutex);
if (m_xCacheController.is())
{
- BackendCacheRef xBackendCache(m_xCacheController);
+ rtl::Reference< backend::CacheController > xBackendCache(m_xCacheController);
m_xCacheController.clear();
aGuard.clear();
xBackendCache->dispose();
@@ -255,12 +169,12 @@ void TreeManager::disposeBackendCache() CFG_NOTHROW( )
// -------------------------------------------------------------------------
-TreeManager::CacheRef TreeManager::getCacheAlways(RequestOptions const & _aOptions)
+rtl::Reference<CacheClientAccess> TreeManager::getCacheAlways(RequestOptions const & _aOptions)
{
- CacheRef aResult = m_aCacheList.get(_aOptions);
+ rtl::Reference<CacheClientAccess> aResult = m_aCacheList.get(_aOptions);
if (!aResult.is())
{
- CacheRef aNewCache( new Cache(ConfigChangeBroadcaster::newBroadcastHelper()) );
+ rtl::Reference<CacheClientAccess> aNewCache( new CacheClientAccess(new ConfigChangeBroadcastHelper()) );
aResult = m_aCacheList.insert(_aOptions,aNewCache);
}
return aResult;
@@ -268,13 +182,13 @@ TreeManager::CacheRef TreeManager::getCacheAlways(RequestOptions const & _aOptio
// -------------------------------------------------------------------------
-data::NodeAccess TreeManager::requestSubtree(AbsolutePath const& aSubtreePath,
+sharable::Node * TreeManager::requestSubtree(configuration::AbsolutePath const& aSubtreePath,
const RequestOptions& _aOptions)
- CFG_UNO_THROW_ALL()
+ SAL_THROW((com::sun::star::uno::Exception))
{
CFG_TRACE_INFO("TreeManager: request for subtree '%s'", OUSTRING2ASCII(aSubtreePath.toString()));
- CacheRef aCache = getCacheAlways(_aOptions);
+ rtl::Reference<CacheClientAccess> aCache = getCacheAlways(_aOptions);
OSL_ENSURE(aCache.is(),"TreeManager: Cannot create cache access for loading node");
if (!aCache->hasModule(aSubtreePath))
@@ -282,7 +196,7 @@ data::NodeAccess TreeManager::requestSubtree(AbsolutePath const& aSubtreePath,
CFG_TRACE_INFO_NI("TreeManager: cache miss. going to load the node");
backend::ComponentRequest aQuery( aSubtreePath.getModuleName(), _aOptions );
- backend::CacheLocation aLoadedLocation = getCacheLoader()->loadComponent(aQuery);
+ sharable::TreeFragment * aLoadedLocation = getCacheLoader()->loadComponent(aQuery);
if (aLoadedLocation == NULL)
{
CFG_TRACE_WARNING_NI("TreeManager: requested component not found");
@@ -303,26 +217,24 @@ data::NodeAccess TreeManager::requestSubtree(AbsolutePath const& aSubtreePath,
}
}
- data::NodeAddress aResultAddress = aCache->acquireNode(aSubtreePath);
-
- return data::NodeAccess(aResultAddress);
+ return aCache->acquireNode(aSubtreePath);
}
// -------------------------------------------------------------------------
-void TreeManager::fetchSubtree(AbsolutePath const& aSubtreePath, const RequestOptions& ) CFG_NOTHROW()
+void TreeManager::fetchSubtree(configuration::AbsolutePath const& aSubtreePath, const RequestOptions& ) SAL_THROW(())
{
(void) aSubtreePath; // avoid warning about unused parameter
CFG_TRACE_WARNING("TreeManager: Prefetching not implemented. (Request to prefetch component %s.", OUSTRING2ASCII(aSubtreePath.toString()));
}
// -------------------------------------------------------------------------
-sal_Bool TreeManager::fetchDefaultData( AbsolutePath const& aSubtreePath,
+sal_Bool TreeManager::fetchDefaultData( configuration::AbsolutePath const& aSubtreePath,
const RequestOptions& _aOptions
- ) CFG_UNO_THROW_ALL()
+ ) SAL_THROW((com::sun::star::uno::Exception))
{
CFG_TRACE_INFO("tree manager: checking the cache for defaults");
- CacheRef aCache = m_aCacheList.get(_aOptions);
+ rtl::Reference<CacheClientAccess> aCache = m_aCacheList.get(_aOptions);
if (!aCache.is())
{
@@ -336,11 +248,11 @@ sal_Bool TreeManager::fetchDefaultData( AbsolutePath const& aSubtreePath,
return true;
}
- AbsolutePath aRequestPath = extractModulePath(aSubtreePath);
+ configuration::AbsolutePath aRequestPath = extractModulePath(aSubtreePath);
backend::NodeRequest aRequest(aRequestPath,_aOptions);
- backend::NodeResult aDefaults = getCacheLoader()->getDirectDataProvider().getDefaultData( aRequest );
+ backend::ResultHolder< backend::NodeInstance > aDefaults = getCacheLoader()->getDefaultData( aRequest );
if (!aDefaults.is())
{
@@ -355,55 +267,53 @@ sal_Bool TreeManager::fetchDefaultData( AbsolutePath const& aSubtreePath,
}
// -------------------------------------------------------------------------
-std::auto_ptr<ISubtree> TreeManager::requestDefaultData(AbsolutePath const& aSubtreePath,
+std::auto_ptr<ISubtree> TreeManager::requestDefaultData(configuration::AbsolutePath const& aSubtreePath,
const RequestOptions& _aOptions
- ) CFG_UNO_THROW_ALL( )
+ ) SAL_THROW((com::sun::star::uno::Exception))
{
// to do: check cache for existing default data (?!)
CFG_TRACE_INFO_NI("TreeManager: loading default data directly");
backend::NodeRequest aRequest(aSubtreePath,_aOptions);
- backend::NodeResult aDefaults = getCacheLoader()->getDirectDataProvider().getDefaultData( aRequest );
+ backend::ResultHolder< backend::NodeInstance > aDefaults = getCacheLoader()->getDefaultData( aRequest );
return aDefaults.extractDataAndClear();
}
// -------------------------------------------------------------------------
-AbsolutePath TreeManager::encodeTemplateLocation(const Name& _rLogicalTemplateName, const Name &_rModule)
+configuration::AbsolutePath TreeManager::encodeTemplateLocation(const rtl::OUString& _rLogicalTemplateName, const rtl::OUString &_rModule)
{
- using namespace configuration::Path;
-
// static const
-// Component aTemplateRoot = wrapSimpleName(OUString::createFromAscii("org.openoffice.Templates"));
+// configuration::Path::Component aTemplateRoot = configuration::Path::wrapSimpleName(rtl::OUString::createFromAscii("org.openoffice.Templates"));
- Component aTemplateModule = wrapSimpleName(_rModule);
- Component aTemplateName = wrapSimpleName(_rLogicalTemplateName);
+ configuration::Path::Component aTemplateModule = configuration::Path::wrapSimpleName(_rModule);
+ configuration::Path::Component aTemplateName = configuration::Path::wrapSimpleName(_rLogicalTemplateName);
Path::Rep aResult(aTemplateName);
aResult.prepend(aTemplateModule);
// aResult.prepend(aTemplateRoot);
- return AbsolutePath(aResult);
+ return configuration::AbsolutePath(aResult);
}
// -------------------------------------------------------------------------
-data::TreeAccessor TreeManager::requestTemplate(Name const& _rName,
- Name const& _rModule) CFG_UNO_THROW_ALL( )
+sharable::TreeFragment * TreeManager::requestTemplate(rtl::OUString const& _rName,
+ rtl::OUString const& _rModule) SAL_THROW((com::sun::star::uno::Exception))
{
- OSL_ENSURE(!_rName.isEmpty(), "TreeManager::requestTemplate : invalid template name !");
+ OSL_ENSURE(_rName.getLength() != 0, "TreeManager::requestTemplate : invalid template name !");
- CFG_TRACE_INFO("TreeManager: going to get a template named %s", OUSTRING2ASCII(_rName.toString()));
+ CFG_TRACE_INFO("TreeManager: going to get a template named %s", OUSTRING2ASCII(_rName));
- AbsolutePath aTemplateLocation = encodeTemplateLocation(_rName, _rModule);
- Name aCacheModule = aTemplateLocation.getModuleName();
+ configuration::AbsolutePath aTemplateLocation = encodeTemplateLocation(_rName, _rModule);
+ rtl::OUString aCacheModule = aTemplateLocation.getModuleName();
if (!getTemplates().hasNode(aTemplateLocation))
{
CFG_TRACE_INFO_NI("TreeManager: cache miss. going to load the template");
backend::TemplateRequest aQuery( _rName, _rModule );
- backend::CacheLocation aLoadedLocation = getCacheLoader()->loadTemplate(aQuery);
+ sharable::TreeFragment * aLoadedLocation = getCacheLoader()->loadTemplate(aQuery);
if (aLoadedLocation == NULL)
{
CFG_TRACE_ERROR_NI("TreeManager: requested template module not found");
@@ -423,18 +333,18 @@ data::TreeAccessor TreeManager::requestTemplate(Name const& _rName,
CFG_TRACE_INFO_NI("TreeManager: template module found in cache");
}
- data::TreeAddress aTemplateAddr = getTemplates().getTemplateTree(aTemplateLocation);
+ sharable::TreeFragment * aTemplateAddr = getTemplates().getTemplateTree(aTemplateLocation);
if (aTemplateAddr == NULL)
{
CFG_TRACE_ERROR_NI("TreeManager: template not found in module");
throw com::sun::star::container::
NoSuchElementException( MAKEUSTRING("Unknown template. Type description could not be found in the given module."), NULL);
}
- return data::TreeAccessor(aTemplateAddr);
+ return aTemplateAddr;
}
// -------------------------------------------------------------------------
-void TreeManager::saveAndNotifyUpdate(TreeChangeList const& aChangeTree) CFG_UNO_THROW_ALL( )
+void TreeManager::saveAndNotifyUpdate(TreeChangeList const& aChangeTree) SAL_THROW((com::sun::star::uno::Exception))
{
{
CFG_TRACE_INFO("TreeManager: committing an Update to the cache controller");
@@ -453,27 +363,20 @@ void TreeManager::saveAndNotifyUpdate(TreeChangeList const& aChangeTree) CFG_UNO
}
}
-// -------------------------------------------------------------------------
-void TreeManager::fireChanges(TreeChangeList const& aChangeTree, sal_Bool _bError)
-{
- CFG_TRACE_INFO("TreeManager: broadcasting changes");
- ConfigChangeBroadcaster::fireChanges(aChangeTree, _bError);
-}
-
// -----------------------------------------------------------------------------
-void TreeManager::updateTree(TreeChangeList& _aChanges) CFG_UNO_THROW_ALL( )
+void TreeManager::updateTree(TreeChangeList& _aChanges) SAL_THROW((com::sun::star::uno::Exception))
{
CFG_TRACE_INFO("TreeManager: updating the cache from a changes list");
backend::UpdateInstance anUpdate(&_aChanges.root,_aChanges.getRootNodePath());
- CacheRef aCache = m_aCacheList.get(_aChanges.getOptions());
+ rtl::Reference<CacheClientAccess> aCache = m_aCacheList.get(_aChanges.getOptions());
if (!aCache.is())
{
CFG_TRACE_ERROR_NI("TreeManager: Cache access to update into does not exist !");
OSL_ENSURE(aCache.is(),"TreeManager: Cache access to update into does not exist ! Where does the update access come from ?");
- throw lang::DisposedException(OUString::createFromAscii("Tree to be updated was already disposed"), NULL);
+ throw lang::DisposedException(rtl::OUString::createFromAscii("Tree to be updated was already disposed"), NULL);
}
// merge the changes into the tree
@@ -485,11 +388,11 @@ void TreeManager::updateTree(TreeChangeList& _aChanges) CFG_UNO_THROW_ALL( )
// -----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
-void TreeManager::releaseSubtree( AbsolutePath const& aSubtreePath, const RequestOptions& _aOptions ) CFG_NOTHROW()
+void TreeManager::releaseSubtree( configuration::AbsolutePath const& aSubtreePath, const RequestOptions& _aOptions ) SAL_THROW(())
{
CFG_TRACE_INFO("TreeManager: releasing subtree '%s' for entity '%s' with locale '%s'", OUSTRING2ASCII(aSubtreePath.toString()), OUSTRING2ASCII(_aOptions.getEntity()), OUSTRING2ASCII(_aOptions.getLocale()) );
- CacheRef aCache = m_aCacheList.get(_aOptions);
+ rtl::Reference<CacheClientAccess> aCache = m_aCacheList.get(_aOptions);
OSL_ENSURE(aCache.is(),"TreeManager: No local data to release");
@@ -499,72 +402,83 @@ void TreeManager::releaseSubtree( AbsolutePath const& aSubtreePath, const Reques
if (aCache->releaseNode(aSubtreePath) == 0)
{
backend::ComponentRequest aComponentDesc(aSubtreePath.getModuleName(),_aOptions);
- BackendCacheRef xBackendCache = maybeGetBackendCache();
+ rtl::Reference< backend::CacheController > xBackendCache = maybeGetBackendCache();
if (xBackendCache.is()) xBackendCache->freeComponent(aComponentDesc);
}
}
}
// ----------------------------------------------------------------------------
-void TreeManager::refreshAll() CFG_UNO_THROW_ALL( )
+void TreeManager::refreshAll() SAL_THROW((com::sun::star::uno::Exception))
{
//Find what components are in cache and that have client references and reload
//such components.
- BackendCacheRef aCacheRef = maybeGetBackendCache();
+ rtl::Reference< backend::CacheController > aCacheRef = maybeGetBackendCache();
if (aCacheRef.is()) aCacheRef->refreshAllComponents();
}
// ----------------------------------------------------------------------------
-void TreeManager::flushAll()CFG_NOTHROW()
+void TreeManager::flushAll()SAL_THROW(())
{
- BackendCacheRef aCacheRef = maybeGetBackendCache();
+ rtl::Reference< backend::CacheController > aCacheRef = maybeGetBackendCache();
if (aCacheRef.is()) aCacheRef->flushPendingUpdates();
}
//-----------------------------------------------------------------------------
-void TreeManager::enableAsync(const sal_Bool& bEnableAsync) CFG_NOTHROW()
+void TreeManager::enableAsync(const sal_Bool& bEnableAsync) SAL_THROW(())
{
m_bEnableAsync = bEnableAsync;
}
-//-----------------------------------------------------------------------------
-void TreeManager::disposeData(const RequestOptions& _aOptions) CFG_NOTHROW()
-{
- CFG_TRACE_INFO("TreeManager: disposing data by options");
-
- if (_aOptions.getLocale().getLength() != 0)
- {
- OSL_ENSURE(_aOptions.getEntity().getLength() != 0, "TreeManager: Cannot dispose locale without user");
- CFG_TRACE_INFO_NI( "TreeManager: Disposing data for options: ENTITY='%s' and LOCALE = '%s'",
- OUSTRING2ASCII(_aOptions.getEntity()), OUSTRING2ASCII(_aOptions.getLocale()) );
+ /////////////////////////////////////////////////////////////////////////
+ void TreeManager::addListener(configuration::AbsolutePath const& aName, RequestOptions const & _aOptions, rtl::Reference<INodeListener> const& pHandler)
+ {
+ if (ConfigChangeBroadcastHelper* pHelper = getBroadcastHelper(_aOptions,true))
+ {
+ pHelper->addListener(aName, pHandler);
+ }
+ else
+ OSL_ASSERT(false);
+ }
- this->disposeOne( _aOptions );
+ void TreeManager::removeListener(RequestOptions const & _aOptions, rtl::Reference<INodeListener> const& pHandler)
+ {
+ if (ConfigChangeBroadcastHelper* pHelper = getBroadcastHelper(_aOptions,false))
+ {
+ pHelper->removeListener( pHandler);
+ }
}
- else if (_aOptions.getEntity().getLength() != 0)
- {
- CFG_TRACE_INFO_NI( "TreeManager: Disposing data for user: '%s'", OUSTRING2ASCII(_aOptions.getEntity()) );
- this->disposeUser(_aOptions );
+ /////////////////////////////////////////////////////////////////////////
+ void TreeManager::fireChanges(TreeChangeList const& rList_, sal_Bool bError_)
+ {
+ if (ConfigChangeBroadcastHelper* pHelper = getBroadcastHelper(rList_.getOptions(),false))
+ {
+ pHelper->broadcast(rList_, bError_, this);
+ }
}
- else
+
+ /////////////////////////////////////////////////////////////////////////
+ void TreeManager::disposeBroadcastHelper(ConfigChangeBroadcastHelper* pHelper)
{
- OSL_ENSURE(false, "TreeManager: Cannot dispose: neither user nor locale specified in options");
+ if (pHelper)
+ {
+ pHelper->dispose(this);
+ delete pHelper;
+ }
}
- CFG_TRACE_INFO_NI("TreeManager: disposing data done");
-}
-// INotifyListener
// ----------------------------------------------------------------------------
void TreeManager::nodeUpdated(TreeChangeList& _rChanges)
{
CFG_TRACE_INFO("TreeManager: nodeUpdated");
try
{
- CacheRef aCache = m_aCacheList.get(_rChanges.getOptions());
+ rtl::Reference<CacheClientAccess> aCache = m_aCacheList.get(_rChanges.getOptions());
if (aCache.is())
{
// first approve the changes and merge them with the current tree
- AbsolutePath aSubtreeName = _rChanges.getRootNodePath();
+ configuration::AbsolutePath aSubtreeName = _rChanges.getRootNodePath();
- data::NodeAddress aCacheTree = aCache->findInnerNode(aSubtreeName);
+ sharable::Node * aCacheTree = aCache->findInnerNode(aSubtreeName);
//OSL_ENSURE(aCacheTree != NULL, "TreeManager::nodeUpdated : node not found in cache!");
if (aCacheTree != NULL)
@@ -579,29 +493,26 @@ void TreeManager::nodeUpdated(TreeChangeList& _rChanges)
}
// ----------------------------------------------------------------------------
-// ----------------------------------------------------------------------------
-// ICachedDataListener
-// ----------------------------------------------------------------------------
-void TreeManager::disposing(backend::ICachedDataProvider & /*_rProvider*/) CFG_NOTHROW()
+void TreeManager::disposing(backend::CacheController & /*_rProvider*/) SAL_THROW(())
{
CFG_TRACE_INFO("TreeManager: provider is being disposed");
this->dispose();
}
// ----------------------------------------------------------------------------
-void TreeManager::componentCreated(backend::ComponentRequest const & ) CFG_NOTHROW()
+void TreeManager::componentCreated(backend::ComponentRequest const & ) SAL_THROW(())
{
CFG_TRACE_INFO("TreeManager: component was created");
}
// ----------------------------------------------------------------------------
-void TreeManager::componentChanged(backend::UpdateRequest const & _anUpdate) CFG_NOTHROW()
+void TreeManager::componentChanged(backend::UpdateRequest const & _anUpdate) SAL_THROW(())
{
TreeChangeList aChanges(_anUpdate.getOptions(),
- _anUpdate.getUpdateRoot().location(),
+ _anUpdate.getUpdateRoot(),
*_anUpdate.getUpdateData(),
- SubtreeChange::DeepChildCopy() );
+ treeop::DeepChildCopy() );
this->nodeUpdated(aChanges);
}
diff --git a/configmgr/source/treemgr/collectchanges.cxx b/configmgr/source/treemgr/collectchanges.cxx
index f9e378cf14..be8d1d5396 100644
--- a/configmgr/source/treemgr/collectchanges.cxx
+++ b/configmgr/source/treemgr/collectchanges.cxx
@@ -97,9 +97,9 @@ bool convertNodeChange(NodeChangeData& aData_, RemoveNode const& /*aChange_*/)
//-----------------------------------------------------------------------------
CollectChanges::CollectChanges( NodeChangesInformation& rTargetList_,
- TreeImpl& rStartTree_, NodeOffset nStartNode_,
- TemplateHolder aElementTemplate_,
- TreeDepth nMaxDepth)
+ Tree& rStartTree_, unsigned int nStartNode_,
+ rtl::Reference<Template> aElementTemplate_,
+ unsigned int nMaxDepth)
: m_rTargetList(rTargetList_)
, m_aAccessor()
, m_aContextTypeName()
@@ -112,7 +112,7 @@ CollectChanges::CollectChanges( NodeChangesInformation& rTargetList_,
}
//-----------------------------------------------------------------------------
-CollectChanges::CollectChanges( CollectChanges const& rBase, Path::Component const& rChildName, Name const& aSubTypeName_)
+CollectChanges::CollectChanges( CollectChanges const& rBase, Path::Component const& rChildName, rtl::OUString const& aSubTypeName_)
: m_rTargetList(rBase.m_rTargetList)
, m_aAccessor(rBase.m_aAccessor.compose(rChildName))
, m_aContextTypeName(aSubTypeName_)
@@ -127,9 +127,9 @@ CollectChanges::CollectChanges( CollectChanges const& rBase, Path::Component con
inline
Path::Component CollectChanges::implGetNodeName(Change const& aChange_) const
{
- Name aSimpleNodeName = makeName( aChange_.getNodeName(), Name::NoValidate() );
+ rtl::OUString aSimpleNodeName( aChange_.getNodeName() );
- if (m_aContextTypeName.isEmpty())
+ if (m_aContextTypeName.getLength() == 0)
{
OSL_ENSURE(isSimpleName(aSimpleNodeName),"Unexpected: Found non-simple name without a type");
return Path::wrapSafeName(aSimpleNodeName);
@@ -179,7 +179,7 @@ void CollectChanges::collectFrom(SubtreeChange const& aChanges_)
{
if (m_nDepthLeft > 0)
{
- Name aSubTypeName = makeName( aChanges_.getElementTemplateName(), Name::NoValidate() );
+ rtl::OUString aSubTypeName( aChanges_.getElementTemplateName() );
CollectChanges aSubcollector( *this, implGetNodeName(aChanges_), aSubTypeName );
diff --git a/configmgr/source/treemgr/collectchanges.hxx b/configmgr/source/treemgr/collectchanges.hxx
index b743b83c4b..c8a924e3e2 100644
--- a/configmgr/source/treemgr/collectchanges.hxx
+++ b/configmgr/source/treemgr/collectchanges.hxx
@@ -37,8 +37,8 @@
// pathes for accessors
#include "configpath.hxx"
-// need TreeDepth and c_TreeDepthAll
-#include "treeimpl.hxx"
+// need c_TreeDepthAll
+#include "tree.hxx"
namespace configmgr
{
@@ -66,17 +66,17 @@ namespace configmgr
{
NodeChangesInformation& m_rTargetList;
RelativePath m_aAccessor;
- Name m_aContextTypeName;
- TreeImpl* m_pBaseTree;
- NodeOffset m_nBaseNode;
- TreeDepth m_nDepthLeft;
+ rtl::OUString m_aContextTypeName;
+ Tree* m_pBaseTree;
+ unsigned int m_nBaseNode;
+ unsigned int m_nDepthLeft;
public:
/// Constructs a Visitor object, sets the output target list and context
CollectChanges( NodeChangesInformation& rTargetList_,
- TreeImpl& rStartTree_, NodeOffset nStartNode_,
- TemplateHolder aElementTemplate_,
- TreeDepth nMaxDepth = c_TreeDepthAll);
+ Tree& rStartTree_, unsigned int nStartNode_,
+ rtl::Reference<Template> aElementTemplate_,
+ unsigned int nMaxDepth = c_TreeDepthAll);
/// Adds a (translated) ValueChange to the target list
void collectFrom(ValueChange const& aChange_);
@@ -104,7 +104,7 @@ namespace configmgr
protected:
/// Constructs a Visitor object for a child of another one's context
- CollectChanges( CollectChanges const& rBase, Path::Component const& rChildName, Name const& aSubTypeName );
+ CollectChanges( CollectChanges const& rBase, Path::Component const& rChildName, rtl::OUString const& aSubTypeName );
private:
// ChangeTreeAction implementations
diff --git a/configmgr/source/treemgr/configdefaultprovider.cxx b/configmgr/source/treemgr/configdefaultprovider.cxx
index 892dcd877c..c36d5ded16 100644
--- a/configmgr/source/treemgr/configdefaultprovider.cxx
+++ b/configmgr/source/treemgr/configdefaultprovider.cxx
@@ -35,7 +35,7 @@
#include "defaultproviderproxy.hxx"
#include "noderef.hxx"
#include "valuenode.hxx"
-#include "treeimpl.hxx"
+#include "tree.hxx"
#include "options.hxx"
namespace configmgr
@@ -54,18 +54,18 @@ DefaultProvider DefaultProvider::createEmpty()
}
//-----------------------------------------------------------------------------
-DefaultProvider DefaultProvider::create(Tree const& _aRootTree, RequestOptions const& _aOptions,
- rtl::Reference< IConfigDefaultProvider > const & _xDefaultProvider,
+DefaultProvider DefaultProvider::create(rtl::Reference< Tree > const& _aRootTree, RequestOptions const& _aOptions,
+ rtl::Reference< TreeManager > const & _xDefaultProvider,
IDefaultableTreeManager* _pDefaultableTree)
{
- OSL_PRECOND( !_aRootTree.isEmpty(), "ERROR: Cannot create DefaultProvider for NULL tree");
+ OSL_PRECOND( !isEmpty(_aRootTree.get()), "ERROR: Cannot create DefaultProvider for NULL tree");
rtl::Reference< DefaultProviderProxy > xNewProxy;
- if (!_aRootTree.isEmpty())
+ if (!isEmpty(_aRootTree.get()))
{
xNewProxy = new DefaultProviderProxy(_xDefaultProvider,_pDefaultableTree,
- _aRootTree.getRootPath(), _aOptions );
+ _aRootTree->getRootPath(), _aOptions );
}
return DefaultProvider( xNewProxy );
@@ -98,31 +98,29 @@ DefaultProvider::DefaultProvider(rtl::Reference< DefaultProviderProxy > const& _
/// tries to load a default instance of the specified node
std::auto_ptr<ISubtree> DefaultProvider::getDefaultTree(
- Tree const& _aTree, NodeRef const& _aNode
- ) const CFG_UNO_THROW_ALL()
+ rtl::Reference< Tree > const& _aTree, NodeRef const& _aNode
+ ) const SAL_THROW((com::sun::star::uno::Exception))
{
std::auto_ptr<ISubtree> aRet;
- node::Attributes aAttributes = _aTree.getAttributes(_aNode);
+ node::Attributes aAttributes = _aTree->getAttributes(_aNode);
// if (aAttributes.bDefaulted)
// clone the ISubtree (no interface for that) :-(
if (m_aProxy.is() && aAttributes.existsInDefault())
- aRet = m_aProxy->getDefaultTree(_aTree.getAbsolutePath(_aNode));
+ aRet = m_aProxy->getDefaultTree(_aTree->getAbsolutePath(_aNode));
return aRet;
}
//-----------------------------------------------------------------------------
/// tries to load default data into the specified tree
-static bool shouldFetchDefaultData(TreeRef const& _aTreeRef, bool & _rbHasDefaults)
+static bool shouldFetchDefaultData(rtl::Reference< Tree > const& _aTreeRef, bool & _rbHasDefaults)
{
bool bShouldFetch = false;
- Tree aTempTree(_aTreeRef);
-
- node::Attributes aAttributes = aTempTree.getAttributes(aTempTree.getRootNode());
+ node::Attributes aAttributes = _aTreeRef->getAttributes(_aTreeRef->getRootNode());
if (aAttributes.isDefault())
_rbHasDefaults = true;
@@ -139,7 +137,7 @@ static bool shouldFetchDefaultData(TreeRef const& _aTreeRef, bool & _rbHasDefaul
//-----------------------------------------------------------------------------
/// tries to load default data into the specified tree
-bool DefaultProvider::fetchDefaultData(TreeRef const& _aTreeRef) const CFG_UNO_THROW_ALL()
+bool DefaultProvider::fetchDefaultData(rtl::Reference< Tree > const& _aTreeRef) const SAL_THROW((com::sun::star::uno::Exception))
{
bool bHasDefaults = false;
diff --git a/configmgr/source/treemgr/configexcept.cxx b/configmgr/source/treemgr/configexcept.cxx
index b0de8fafae..4c4df0eb61 100644
--- a/configmgr/source/treemgr/configexcept.cxx
+++ b/configmgr/source/treemgr/configexcept.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: configexcept.cxx,v $
- * $Revision: 1.7.4.1 $
+ * $Revision: 1.7.10.3 $
*
* This file is part of OpenOffice.org.
*
@@ -52,7 +52,7 @@ namespace configmgr
}
//---------------------------------------------------------------------
- OUString Exception::message() const
+ rtl::OUString Exception::message() const
{
return rtl::OStringToOUString( m_sAsciiMessage, RTL_TEXTENCODING_ASCII_US );
@@ -64,20 +64,20 @@ namespace configmgr
}
//---------------------------------------------------------------------
- static const char c_sInvalidNamePre[] = "CONFIGURATION: Invalid Path or Name: ";
- static const char c_sInvalidName[] = "CONFIGURATION: <Invalid Path or Name>";
+ static const char c_sInvalidNamePre[] = "CONFIGURATION: Invalid path or name: ";
+ static const char c_sInvalidName[] = "CONFIGURATION: <Invalid path or name>";
//-----------------------------------------------------------------------------
//---------------------------------------------------------------------
- InvalidName::InvalidName(OUString const& sName, char const* sAsciiDescription)
+ InvalidName::InvalidName(rtl::OUString const& sName, char const* sAsciiDescription)
: Exception( rtl::OString(RTL_CONSTASCII_STRINGPARAM(c_sInvalidName)) += sAsciiDescription )
- , m_sName( sName.concat(OUString::createFromAscii(sAsciiDescription)) )
+ , m_sName( sName.concat(rtl::OUString::createFromAscii(sAsciiDescription)) )
{
}
//---------------------------------------------------------------------
- OUString InvalidName::message() const
+ rtl::OUString InvalidName::message() const
{
return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(c_sInvalidNamePre)).concat( m_sName );
}
@@ -95,19 +95,19 @@ namespace configmgr
static const char c_sTypeMismatch[] = "CONFIGURATION: Data Types do not match: ";
//---------------------------------------------------------------------
- OUString TypeMismatch::describe(OUString const& sFoundType, OUString const& sExpectedType)
+ rtl::OUString TypeMismatch::describe(rtl::OUString const& sFoundType, rtl::OUString const& sExpectedType)
{
- OUString sRet = OUString(RTL_CONSTASCII_USTRINGPARAM("Found Type: '"));
+ rtl::OUString sRet = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Found Type: '"));
sRet += sFoundType;
if (sExpectedType.getLength() != 0)
{
- sRet += OUString(RTL_CONSTASCII_USTRINGPARAM("' - Expected Type: '"));
+ sRet += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("' - Expected Type: '"));
sRet += sExpectedType;
- sRet += OUString(RTL_CONSTASCII_USTRINGPARAM("'"));
+ sRet += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("'"));
}
else
{
- sRet += OUString(RTL_CONSTASCII_USTRINGPARAM("' is not valid in this context"));
+ sRet += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("' is not valid in this context"));
}
return sRet;
}
@@ -115,20 +115,20 @@ namespace configmgr
//---------------------------------------------------------------------
- TypeMismatch::TypeMismatch(OUString const& sType1, OUString const& sType2)
+ TypeMismatch::TypeMismatch(rtl::OUString const& sType1, rtl::OUString const& sType2)
: Exception( rtl::OString(RTL_CONSTASCII_STRINGPARAM(c_sTypeMismatch)) )
, m_sTypes( describe(sType1,sType2) )
{
}
//---------------------------------------------------------------------
- TypeMismatch::TypeMismatch(OUString const& sType1, OUString const& sType2, char const* sAsciiDescription)
+ TypeMismatch::TypeMismatch(rtl::OUString const& sType1, rtl::OUString const& sType2, char const* sAsciiDescription)
: Exception( rtl::OString(RTL_CONSTASCII_STRINGPARAM(c_sTypeMismatch)) += sAsciiDescription)
- , m_sTypes( describe(sType1,sType2).concat(OUString::createFromAscii(sAsciiDescription)) )
+ , m_sTypes( describe(sType1,sType2).concat(rtl::OUString::createFromAscii(sAsciiDescription)) )
{
}
//---------------------------------------------------------------------
- OUString TypeMismatch::message() const
+ rtl::OUString TypeMismatch::message() const
{
return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(c_sTypeMismatch)).concat( m_sTypes );
}
@@ -157,9 +157,9 @@ namespace configmgr
}
//---------------------------------------------------------------------
- OUString ExceptionMapper::message() const
+ rtl::OUString ExceptionMapper::message() const
{
- return OUString(RTL_CONSTASCII_USTRINGPARAM("FAILURE in CONFIGMGR: ")).concat( m_sMessage );
+ return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FAILURE in CONFIGMGR: ")).concat( m_sMessage );
}
//---------------------------------------------------------------------
diff --git a/configmgr/source/treemgr/configgroup.cxx b/configmgr/source/treemgr/configgroup.cxx
index ebe189b144..eb0fd3a1cc 100644
--- a/configmgr/source/treemgr/configgroup.cxx
+++ b/configmgr/source/treemgr/configgroup.cxx
@@ -37,7 +37,7 @@
#include "anynoderef.hxx"
#include "nodechange.hxx"
#include "nodechangeimpl.hxx"
-#include "treeimpl.hxx"
+#include "tree.hxx"
#include "groupnodeimpl.hxx"
#include "valuenodeimpl.hxx"
#include "typeconverter.hxx"
@@ -53,29 +53,26 @@ namespace configmgr
// class GroupUpdateHelper
//-----------------------------------------------------------------------------
-GroupUpdateHelper::GroupUpdateHelper(Tree const& aParentTree, NodeRef const& aGroupNode)
+GroupUpdateHelper::GroupUpdateHelper(rtl::Reference< Tree > const& aParentTree, NodeRef const& aGroupNode)
: m_aTree(aParentTree)
, m_aNode(aGroupNode)
{
implValidateTree(m_aTree);
implValidateNode(m_aTree,m_aNode);
- if (! m_aTree.getView().isGroupNode(m_aNode) )
+ if (! view::ViewTreeAccess(m_aTree.get()).isGroupNode(m_aNode) )
throw Exception("INTERNAL ERROR: Group Member Update: node is not a group");
}
//-----------------------------------------------------------------------------
-void GroupUpdateHelper::implValidateTree(Tree const& aTree) const
+void GroupUpdateHelper::implValidateTree(rtl::Reference< Tree > const& aTree) const
{
- if (aTree.isEmpty())
+ if (isEmpty(aTree.get()))
throw Exception("INTERNAL ERROR: Group Member Update: Unexpected NULL tree");
- typedef rtl::Reference<TreeImpl> TreeHolder;
-
// check for proper nesting
- TreeHolder const aParentTree = TreeImplHelper::impl(m_aTree);
- for(TreeHolder aTestTree = TreeImplHelper::impl(aTree);
- aTestTree != aParentTree; // search this as ancestor tree
+ for(rtl::Reference<Tree> aTestTree = aTree;
+ aTestTree != m_aTree; // search this as ancestor tree
aTestTree = aTestTree->getContextTree() )
{
if (!aTestTree.is()) // no more trees to look for
@@ -84,25 +81,25 @@ void GroupUpdateHelper::implValidateTree(Tree const& aTree) const
}
//-----------------------------------------------------------------------------
-void GroupUpdateHelper::implValidateNode(Tree const& aTree, NodeRef const& aNode) const
+void GroupUpdateHelper::implValidateNode(rtl::Reference< Tree > const& aTree, NodeRef const& aNode) const
{
if (!aNode.isValid())
throw Exception("INTERNAL ERROR: Group Member Update: Unexpected NULL node");
- if (!aTree.isValidNode(aNode))
+ if (!aTree->isValidNode(aNode.getOffset()))
throw Exception("INTERNAL ERROR: Group Member Update: node does not match tree");
}
//-----------------------------------------------------------------------------
-void GroupUpdateHelper::implValidateNode(Tree const& aTree, ValueRef const& aNode) const
+void GroupUpdateHelper::implValidateNode(rtl::Reference< Tree > const& aTree, ValueRef const& aNode) const
{
if (!aNode.isValid())
throw Exception("INTERNAL ERROR: Group Member Update: Unexpected NULL node");
- if (!aTree.isValidNode(aNode))
+ if (!aTree->isValidValueNode(aNode))
throw Exception("INTERNAL ERROR: Group Member Update: changed node does not match tree");
- if (aTree.getAttributes(aNode).isReadonly())
+ if (aTree->getAttributes(aNode).isReadonly())
throw ConstraintViolation( "Group Member Update: Node is read-only !" );
}
@@ -123,14 +120,14 @@ void GroupUpdateHelper::validateNode(NodeRef const& aNode) const
/** a helper that gets the UNO <type scope='com::sun::star::uno'>Type</type>
for a UNO <type scope='com::sun::star::uno'>Any</type>.
*/
-static inline UnoType getUnoAnyType()
+static inline com::sun::star::uno::Type getUnoAnyType()
{
- UnoAny const * const selectAny = 0;
+ com::sun::star::uno::Any const * const selectAny = 0;
return ::getCppuType(selectAny);
}
//-----------------------------------------------------------------------------
-bool isPossibleValueType(UnoType const& aValueType)
+bool isPossibleValueType(com::sun::star::uno::Type const& aValueType)
{
switch(aValueType.getTypeClass())
{
@@ -171,7 +168,7 @@ bool isPossibleValueType(UnoType const& aValueType)
}
//-----------------------------------------------------------------------------
-bool convertCompatibleValue(UnoTypeConverter const& xTypeConverter, uno::Any& rConverted, UnoAny const& rNewValue, UnoType const& rTargetType)
+bool convertCompatibleValue(com::sun::star::uno::Reference<com::sun::star::script::XTypeConverter> const& xTypeConverter, uno::Any& rConverted, com::sun::star::uno::Any const& rNewValue, com::sun::star::uno::Type const& rTargetType)
{
OSL_ASSERT( isPossibleValueType(rTargetType) );
@@ -214,31 +211,31 @@ bool convertCompatibleValue(UnoTypeConverter const& xTypeConverter, uno::Any& rC
// class GroupUpdater
//-----------------------------------------------------------------------------
-GroupUpdater::GroupUpdater(Tree const& aParentTree, NodeRef const& aGroupNode, UnoTypeConverter const& xConverter)
+GroupUpdater::GroupUpdater(rtl::Reference< Tree > const& aParentTree, NodeRef const& aGroupNode, com::sun::star::uno::Reference<com::sun::star::script::XTypeConverter> const& xConverter)
: m_aHelper(aParentTree,aGroupNode)
, m_xTypeConverter(xConverter)
{
}
//-----------------------------------------------------------------------------
-UnoAny GroupUpdater::implValidateValue(Tree const& aTree, ValueRef const& aNode, UnoAny const& aValue) const
+com::sun::star::uno::Any GroupUpdater::implValidateValue(rtl::Reference< Tree > const& aTree, ValueRef const& aNode, com::sun::star::uno::Any const& aValue) const
{
- UnoType aValueType = aValue.getValueType();
- UnoType aTargetType = aTree.getUnoType(aNode);
+ com::sun::star::uno::Type aValueType = aValue.getValueType();
+ com::sun::star::uno::Type aTargetType = aTree->getUnoType(aNode);
OSL_ENSURE( aTargetType.getTypeClass() == uno::TypeClass_ANY || isPossibleValueType(aTargetType),
"Invalid value type found on existing property" );
OSL_ASSERT( aValueType.getTypeClass() != uno::TypeClass_ANY);
- UnoAny aRet;
+ com::sun::star::uno::Any aRet;
if (!aValue.hasValue())
{
- if (!aTree.getAttributes(aNode).isNullable())
+ if (!aTree->getAttributes(aNode).isNullable())
{
rtl::OString sError("Group Member Update: Node (");
- sError += OUSTRING2ASCII(aTree.getName(aNode).toString());
+ sError += OUSTRING2ASCII(aNode.m_sNodeName);
sError += ") is not nullable !";
throw ConstraintViolation( sError );
}
@@ -272,19 +269,19 @@ UnoAny GroupUpdater::implValidateValue(Tree const& aTree, ValueRef const& aNode,
}
//-----------------------------------------------------------------------------
-NodeChange GroupUpdater::validateSetValue(ValueRef const& aValueNode, UnoAny const& newValue )
+NodeChange GroupUpdater::validateSetValue(ValueRef const& aValueNode, com::sun::star::uno::Any const& newValue )
{
m_aHelper.validateNode(aValueNode);
- UnoAny aNewValue = implValidateValue(m_aHelper.tree(), aValueNode, newValue);
+ com::sun::star::uno::Any aNewValue = implValidateValue(m_aHelper.tree(), aValueNode, newValue);
// now build the specific change
std::auto_ptr<ValueChangeImpl> pChange( new ValueReplaceImpl(aNewValue) );
- NodeRef aParent = m_aHelper.tree().getParent(aValueNode);
+ NodeRef aParent = m_aHelper.tree()->getParent(aValueNode);
pChange->setTarget(
- m_aHelper.tree().getView().toGroupNode(aParent),
- m_aHelper.tree().getName(aValueNode)
+ view::ViewTreeAccess(m_aHelper.tree().get()).toGroupNode(aParent),
+ aValueNode.m_sNodeName
);
return NodeChange(pChange.release());
@@ -307,10 +304,10 @@ namespace
NodeDefaulter(GroupDefaulter& _rUpdater) : updater(_rUpdater), result() {}
/// do the operation on <var>aNode</var>. needs to be implemented by concrete visitor classes
- Result handle(Tree const& aTree, NodeRef const& aNode);
+ Result handle(rtl::Reference< Tree > const& aTree, NodeRef const& aNode);
/// do the operation on <var>aValue</var>. needs to be implemented by concrete visitor classes
- Result handle(Tree const& aTree, ValueRef const& aValue);
+ Result handle(rtl::Reference< Tree > const& aTree, ValueRef const& aValue);
inline void addResult(NodeChange const& aChange)
{
@@ -319,13 +316,13 @@ namespace
}
};
- NodeVisitor::Result NodeDefaulter::handle(Tree const& , NodeRef const& aNode)
+ NodeVisitor::Result NodeDefaulter::handle(rtl::Reference< Tree > const& , NodeRef const& aNode)
{
addResult( updater.validateSetToDefaultState(aNode) );
return CONTINUE;
}
- NodeVisitor::Result NodeDefaulter::handle(Tree const& , ValueRef const& aValue)
+ NodeVisitor::Result NodeDefaulter::handle(rtl::Reference< Tree > const& , ValueRef const& aValue)
{
addResult( updater.validateSetToDefaultValue(aValue) );
return CONTINUE;
@@ -337,21 +334,19 @@ namespace
// class GroupDefaulter
//-----------------------------------------------------------------------------
-GroupDefaulter::GroupDefaulter(Tree const& _aParentTree, NodeRef const& _aGroupNode, DefaultProvider const& _aProvider)
+GroupDefaulter::GroupDefaulter(rtl::Reference< Tree > const& _aParentTree, NodeRef const& _aGroupNode, DefaultProvider const& _aProvider)
: m_aHelper(_aParentTree,_aGroupNode)
, m_aDefaultProvider(_aProvider)
, m_bHasDoneSet(false)
{
}
//-----------------------------------------------------------------------------
-bool GroupDefaulter::isDataAvailable(TreeRef const& _aParentTree, NodeRef const& _aGroupNode)
+bool GroupDefaulter::isDataAvailable(rtl::Reference< Tree > const& _aParentTree, NodeRef const& _aGroupNode)
{
- Tree aTempTree(_aParentTree);
-
- return aTempTree.areValueDefaultsAvailable(_aGroupNode);
+ return _aParentTree->areValueDefaultsAvailable(_aGroupNode);
}
//-----------------------------------------------------------------------------
-bool GroupDefaulter::ensureDataAvailable(TreeRef const& _aParentTree, NodeRef const& _aGroupNode, DefaultProvider const& _aDataSource)
+bool GroupDefaulter::ensureDataAvailable(rtl::Reference< Tree > const& _aParentTree, NodeRef const& _aGroupNode, DefaultProvider const& _aDataSource)
{
return isDataAvailable(_aParentTree, _aGroupNode) ||
_aDataSource.fetchDefaultData( _aParentTree );
@@ -360,7 +355,7 @@ bool GroupDefaulter::ensureDataAvailable(TreeRef const& _aParentTree, NodeRef co
bool GroupDefaulter::isDataAvailable()
{
- return m_aHelper.tree().areValueDefaultsAvailable(m_aHelper.node());
+ return m_aHelper.tree()->areValueDefaultsAvailable(m_aHelper.node());
}
//-----------------------------------------------------------------------------
@@ -368,19 +363,16 @@ NodeChange GroupDefaulter::validateSetToDefaultValue(ValueRef const& aValueNode)
{
m_aHelper.validateNode(aValueNode);
- //if (!TreeImplHelper::member_node(aValueNode).canGetDefaultValue())
- // m_aTree.ensureDefaults();
-
- if (!m_aHelper.tree().hasNodeDefault(aValueNode))
+ if (!m_aHelper.tree()->hasNodeDefault(aValueNode))
throw Exception("INTERNAL ERROR: Group Member Update: Node has no default value" );
// now build the specific change
std::auto_ptr<ValueChangeImpl> pChange( new ValueResetImpl() );
- NodeRef aParent = m_aHelper.tree().getParent(aValueNode);
+ NodeRef aParent = m_aHelper.tree()->getParent(aValueNode);
pChange->setTarget(
- m_aHelper.tree().getView().toGroupNode(aParent),
- m_aHelper.tree().getName(aValueNode)
+ view::ViewTreeAccess(m_aHelper.tree().get()).toGroupNode(aParent),
+ aValueNode.m_sNodeName
);
return NodeChange(pChange.release());
@@ -394,7 +386,7 @@ NodeChange GroupDefaulter::validateSetToDefaultState(NodeRef const& aNode)
NodeChange aResult;
// only works for set nodes - groups are left alone
- if ( m_aHelper.tree().getView().isSetNode(aNode) )
+ if ( view::ViewTreeAccess(m_aHelper.tree().get()).isSetNode(aNode) )
{
aResult = SetDefaulter( m_aHelper.tree(), aNode, m_aDefaultProvider ).validateSetToDefaultState();
}
@@ -409,7 +401,7 @@ NodeChanges GroupDefaulter::validateSetAllToDefault()
{
NodeDefaulter aDefaulter(*this);
- m_aHelper.tree().dispatchToChildren(m_aHelper.node(),aDefaulter);
+ m_aHelper.tree()->dispatchToChildren(m_aHelper.node(),aDefaulter);
return aDefaulter.result;
}
diff --git a/configmgr/source/treemgr/configpath.cxx b/configmgr/source/treemgr/configpath.cxx
index 1df4ec2381..6a10b72b03 100644
--- a/configmgr/source/treemgr/configpath.cxx
+++ b/configmgr/source/treemgr/configpath.cxx
@@ -80,7 +80,7 @@ namespace
}
//-----------------------------------------------------------------------------
-bool isSimpleName(OUString const& sName) SAL_THROW(())
+bool isSimpleName(rtl::OUString const& sName) SAL_THROW(())
{
sal_Unicode const* const pStr = sName.getStr();
sal_Unicode const* const pEnd = pStr + sName.getLength();
@@ -97,57 +97,22 @@ bool isSimpleName(OUString const& sName) SAL_THROW(())
return true;
}
//-----------------------------------------------------------------------------
-// class configuration::Name
-//-----------------------------------------------------------------------------
-
-// tag struct to ensure construction is routed through our helpers
-struct Path::PackageOnly {};
-
-//-----------------------------------------------------------------------------
-
-// Performance: Could optimize memory usage by using a string pool
-inline
-Name::Name(OUString const& aString, Path::PackageOnly) SAL_THROW(())
-: m_sRep(aString)
-{
-
-}
-//-----------------------------------------------------------------------------
-
-Name makeName(OUString const& sName, Name::NoValidate) SAL_THROW(())
-{
- return Name( sName, Path::PackageOnly() );
-}
-//-----------------------------------------------------------------------------
-
-Name makeNodeName(OUString const& sName, Name::NoValidate) SAL_THROW(())
-{
- OSL_ENSURE( isSimpleName(sName), "Creating a Name that is invalid as member node name");
- return Name( sName, Path::PackageOnly() );
-}
-//-----------------------------------------------------------------------------
-
-Name makeElementName(OUString const& sName, Name::NoValidate) SAL_THROW(())
-{
- return Name( sName, Path::PackageOnly() );
-}
-//-----------------------------------------------------------------------------
-Name validateNodeName(OUString const& sName)
+rtl::OUString validateNodeName(rtl::OUString const& sName)
{
if (!isSimpleName(sName))
throw InvalidName(sName, "is not a valid name for a configuration node");
- return Name( sName, Path::PackageOnly() );
+ return sName;
}
//-----------------------------------------------------------------------------
-Name validateElementName(OUString const& sName)
+rtl::OUString validateElementName(rtl::OUString const& sName)
{
if (sName.getLength() == 0)
throw InvalidName(sName, "is not a valid name for a configuration item (empty names are not permitted)");
- return Name( sName, Path::PackageOnly() );
+ return sName;
}
//-----------------------------------------------------------------------------
@@ -173,9 +138,9 @@ namespace // path helpers I
static
inline
- OUString makeWildcardType() SAL_THROW(())
+ rtl::OUString makeWildcardType() SAL_THROW(())
{
- return OUString(&c_cAnytype,1);
+ return rtl::OUString(&c_cAnytype,1);
}
//-----------------------------------------------------------------------------
@@ -200,7 +165,7 @@ namespace // path helpers I
//-----------------------------------------------------------------------------
static
inline
- sal_Unicode lastChar(OUString const& _sString) SAL_THROW(())
+ sal_Unicode lastChar(rtl::OUString const& _sString) SAL_THROW(())
{
sal_Int32 const nLen = _sString.getLength();
@@ -210,8 +175,8 @@ namespace // path helpers I
}
//-----------------------------------------------------------------------------
- Name implMakeCompositeName(OUString const& _sBaseName, OUString const& _sPredicate) SAL_THROW((InvalidName));
- void implSplitCompositeName(Name const& _aCompositeName, OUString& _rBaseName, OUString& _rPredicate) SAL_THROW(());
+ rtl::OUString implMakeCompositeName(rtl::OUString const& _sBaseName, rtl::OUString const& _sPredicate) SAL_THROW((InvalidName));
+ void implSplitCompositeName(rtl::OUString const& _aCompositeName, rtl::OUString& _rBaseName, rtl::OUString& _rPredicate) SAL_THROW(());
//-----------------------------------------------------------------------------
}
//-----------------------------------------------------------------------------
@@ -224,81 +189,59 @@ namespace Path
//-----------------------------------------------------------------------------
inline // though public, this method is not available outside this translation unit
-Component::Component(OUString const& _sName, Path::PackageOnly _tag) SAL_THROW(())
-: m_aName(_sName, _tag)
-{
-}
-//-----------------------------------------------------------------------------
-
-inline // though public, this method is not available outside this translation unit
-Component::Component(Name const& _aName, Path::PackageOnly) SAL_THROW(())
-: m_aName(_aName)
+Component::Component(rtl::OUString const& _sName) SAL_THROW(())
+: m_aName(_sName)
{
}
//-----------------------------------------------------------------------------
bool Component::isSimpleName() const SAL_THROW(())
{
- return !m_aName.isEmpty() && lastChar(m_aName.toString()) != c_rBracket;
+ return m_aName.getLength() != 0 && lastChar(m_aName) != c_rBracket;
}
//-----------------------------------------------------------------------------
-Name Component::getName() const SAL_THROW(())
+rtl::OUString Component::getName() const SAL_THROW(())
{
if (isSimpleName()) return m_aName;
- OUString sName, sType;
+ rtl::OUString sName, sType;
implSplitCompositeName(m_aName,sType,sName);
- return Name(sName,PackageOnly());
+ return sName;
}
//-----------------------------------------------------------------------------
-Name Component::getTypeName() const SAL_THROW(())
+rtl::OUString Component::getTypeName() const SAL_THROW(())
{
- if (isSimpleName()) return Name();
+ if (isSimpleName()) return rtl::OUString();
- OUString sName, sType;
+ rtl::OUString sName, sType;
implSplitCompositeName(m_aName,sType,sName);
- return Name(sType,PackageOnly());
+ return sType;
}
//-----------------------------------------------------------------------------
Component makeEmptyComponent() SAL_THROW(())
{
- return Component( OUString(), PackageOnly() );
+ return Component( rtl::OUString() );
}
//-----------------------------------------------------------------------------
-Component wrapSimpleName(OUString const& _sName)
+Component wrapSimpleName(rtl::OUString const& _sName)
{
- OSL_ENSURE( isSimpleName(_sName), "Simple Name expected creating path component");
+ OSL_ENSURE( isSimpleName(_sName), "Simple name expected creating path component");
if (!isSimpleName(_sName))
throw InvalidName(_sName, "is not a simple name. Cannot convert to path component");
- return Component( _sName, PackageOnly() );
-}
-//-----------------------------------------------------------------------------
-
-Component wrapSimpleName(Name const& _aName)
-{
- return wrapSimpleName( _aName.toString() );
-}
-//-----------------------------------------------------------------------------
-
-Component makeCompositeName(Name const& _aElementName, Name const& _aTypeName)
-{
- OUString const & sElementName = _aElementName.toString();
- OUString const & sTypeName = _aTypeName.toString();
-
- return Component( implMakeCompositeName(sTypeName,sElementName), PackageOnly() );
+ return Component( _sName );
}
//-----------------------------------------------------------------------------
-Component makeCompositeName(OUString const& _sElementName, OUString const& _sTypeName)
+Component makeCompositeName(rtl::OUString const& _sElementName, rtl::OUString const& _sTypeName)
{
- return Component( implMakeCompositeName(_sTypeName,_sElementName), PackageOnly() );
+ return Component( implMakeCompositeName(_sTypeName,_sElementName) );
}
//-----------------------------------------------------------------------------
@@ -316,13 +259,13 @@ bool matches(Component const& lhs,Component const& rhs) SAL_THROW(())
if (lhs.isSimpleName() || rhs.isSimpleName())
return true;
- Name aTypeLHS = lhs.getTypeName();
- Name aTypeRHS = rhs.getTypeName();
+ rtl::OUString aTypeLHS = lhs.getTypeName();
+ rtl::OUString aTypeRHS = rhs.getTypeName();
// this would need an extra test without our preflight check
OSL_ASSERT(aTypeLHS != aTypeRHS); // would have been dicovered by first check
- if ( isWildcardType(aTypeLHS.toString()) || isWildcardType(aTypeRHS.toString()) )
+ if ( isWildcardType(aTypeLHS) || isWildcardType(aTypeRHS) )
return true;
return false;
@@ -368,10 +311,10 @@ void Rep::prepend(Rep const& _aOther) SAL_THROW(())
}
//-----------------------------------------------------------------------------
-OUString Rep::toString(bool _bAbsolute) const SAL_THROW(())
+rtl::OUString Rep::toString(bool _bAbsolute) const SAL_THROW(())
{
- Iterator cur = begin();
- Iterator const stop = end();
+ std::vector<Component>::const_reverse_iterator cur = begin();
+ std::vector<Component>::const_reverse_iterator const stop = end();
rtl::OUStringBuffer sRet;
@@ -389,7 +332,7 @@ size_t Rep::hashCode() const SAL_THROW(())
{
const unsigned long mangle_factor = 11; // 1011 (2)
unsigned long nHash = 0;
- for (Iterator it = begin(), stop = end(); it != stop; ++it)
+ for (std::vector<Component>::const_reverse_iterator it = begin(), stop = end(); it != stop; ++it)
{
nHash = mangle_factor*nHash + Path::hashCode(*it);
}
@@ -417,7 +360,7 @@ bool matches(Rep const& lhs, Rep const& rhs) SAL_THROW(())
}
//-----------------------------------------------------------------------------
-bool isAbsolutePath(OUString const& _sPath) SAL_THROW(())
+bool isAbsolutePath(rtl::OUString const& _sPath) SAL_THROW(())
{
return detectAbsolutePath(_sPath);
}
@@ -434,7 +377,7 @@ Rep stripMatchingPrefix(Rep const& _aPath,Rep const& _aPrefix) // SAL_THROW((In
{
Rep aResult(_aPath);
- for (Iterator it = _aPrefix.begin(); it != _aPrefix.end(); ++it)
+ for (std::vector<Component>::const_reverse_iterator it = _aPrefix.begin(); it != _aPrefix.end(); ++it)
{
if (aResult.isEmpty() || !matches(*it,aResult.getFirstName()))
throw InvalidName(aResult.getFirstName().toPathString(), "does not match the expected location.");
@@ -469,9 +412,6 @@ namespace
/// distinguishes which kind of path is held in a path object
enum PathType { eRELATIVE = 1, eABSOLUTE = 2 };
- // path parsing iterator type
- typedef sal_Unicode const * StrPos;
-
//-----------------------------------------------------------------------------
// missing or mis leading in SAL/rtl: pStr1[nLength] must NOT be evaluated
static
@@ -500,7 +440,7 @@ namespace
@return
the char being escaped or zero, if the range is no known escape
*/
- sal_Unicode implParseEscape(StrPos pBegin, StrPos pEnd) SAL_THROW(())
+ sal_Unicode implParseEscape(sal_Unicode const * pBegin, sal_Unicode const * pEnd) SAL_THROW(())
{
OSL_PRECOND( pBegin < pEnd, "Nonempty string range expected" );
OSL_PRECOND( pBegin[0] == c_amp, "String range is not a possible escape: missing start marker" );
@@ -549,7 +489,7 @@ namespace
@return
a pointer to the last character before pEnd that is not a name delimiter
*/
- StrPos implFindNameStart(StrPos pBegin, StrPos pEnd) SAL_THROW(())
+ sal_Unicode const * implFindNameStart(sal_Unicode const * pBegin, sal_Unicode const * pEnd) SAL_THROW(())
{
OSL_PRECOND(pBegin <= pEnd, "Invalid string range");
@@ -568,7 +508,7 @@ namespace
<li><var>pEnd</var>, if no bracketed string was found</li>
<li>NULL, if there was a closing bracket, but the beginning could not be discovered</li></ul>
*/
- StrPos implFindPredicateStart(StrPos pBegin, StrPos pEnd) SAL_THROW(())
+ sal_Unicode const * implFindPredicateStart(sal_Unicode const * pBegin, sal_Unicode const * pEnd) SAL_THROW(())
{
OSL_PRECOND(pBegin < pEnd, "Nonempty string range required");
@@ -619,7 +559,7 @@ namespace
/// find the position of the given char in the range given.
inline
- sal_Int32 indexOfCharInRange(StrPos pBegin, StrPos pEnd, sal_Unicode ch) SAL_THROW(())
+ sal_Int32 indexOfCharInRange(sal_Unicode const * pBegin, sal_Unicode const * pEnd, sal_Unicode ch) SAL_THROW(())
{
return rtl_ustr_indexOfChar_WithLength(pBegin, pEnd-pBegin, ch);
}
@@ -643,11 +583,11 @@ namespace
@throw
InvalidName, if the predicate data is not valid
*/
- OUString implMakeNormalizedPredicate(StrPos pBeginContent, StrPos pEndContent, sal_Unicode const* pRequiredEscapes) SAL_THROW((InvalidName))
+ rtl::OUString implMakeNormalizedPredicate(sal_Unicode const * pBeginContent, sal_Unicode const * pEndContent, sal_Unicode const* pRequiredEscapes) SAL_THROW((InvalidName))
{
OSL_PRECOND(pBeginContent <= pEndContent, "Invalid string range");
if (pBeginContent == pEndContent)
- return OUString();
+ return rtl::OUString();
rtl::OUStringBuffer aNormalized(pEndContent-pBeginContent + 4); // reserve approximate size initially
@@ -655,7 +595,7 @@ namespace
aNormalized.append(c_lBracket).append(c_normal_quot);
// content: copy over each char and handle escaping
- for(StrPos pCur = pBeginContent; pCur != pEndContent; ++pCur)
+ for(sal_Unicode const * pCur = pBeginContent; pCur != pEndContent; ++pCur)
{
sal_Unicode ch = *pCur;
@@ -665,7 +605,7 @@ namespace
if (ch == c_amp)
{
// find an escape end marker (after pCur). Result is pCur, if the end marker is not there
- StrPos pEndEscape = pCur + 1 + indexOfCharInRange(pCur+1,pEndContent,c_end_escape);
+ sal_Unicode const * pEndEscape = pCur + 1 + indexOfCharInRange(pCur+1,pEndContent,c_end_escape);
sal_Unicode ch2 = pCur != pEndEscape ? implParseEscape(pCur,pEndEscape+1) : 0;
if (ch2 != 0) // found and read a valid escape sequence
@@ -678,7 +618,7 @@ namespace
{
OSL_ENSURE(false, "Character '&' must be escaped in this context");
#if 0
- throw InvalidName(OUString(pBeginContent,pEndContent-pBeginContent),
+ throw InvalidName(rtl::OUString(pBeginContent,pEndContent-pBeginContent),
"is not a valid element name string. "
"Character '&' must be escaped in this context");
#endif
@@ -686,7 +626,7 @@ namespace
}
else if ( containsChar(pRequiredEscapes, ch) )
{
- throw InvalidName(OUString(pBeginContent,pEndContent-pBeginContent),
+ throw InvalidName(rtl::OUString(pBeginContent,pEndContent-pBeginContent),
"is not a valid element name string. "
"Some characters must be escaped in this context");
}
@@ -711,22 +651,22 @@ namespace
@return
the denormalized predicate content
*/
- OUString implReadPredicate(StrPos pBegin, StrPos pEnd) SAL_THROW(())
+ rtl::OUString implReadPredicate(sal_Unicode const * pBegin, sal_Unicode const * pEnd) SAL_THROW(())
{
OSL_PRECOND(pBegin <= pEnd, "Invalid string range");
rtl::OUStringBuffer aContent(pEnd-pBegin); // reserve approximate size initially
- StrPos pReadPos = pBegin;
+ sal_Unicode const * pReadPos = pBegin;
// content: copy data, handling escapes
- for(StrPos pCur = pReadPos; pCur != pEnd; ++pCur)
+ for(sal_Unicode const * pCur = pReadPos; pCur != pEnd; ++pCur)
{
if (*pCur != c_amp) continue; // no escape here
// handle an escape
// find an escape end marker (after pCur). Result is pCur, if the end marker is not there
- StrPos pEndEscape = pCur + 1 + indexOfCharInRange(pCur+1,pEnd,c_end_escape);
+ sal_Unicode const * pEndEscape = pCur + 1 + indexOfCharInRange(pCur+1,pEnd,c_end_escape);
OSL_ENSURE(pEndEscape != pCur, "Found dangling ampersand in normalized data");
@@ -761,7 +701,7 @@ namespace
@throw
InvalidName, if the predicate is not valid
*/
- OUString implNormalizePredicate(StrPos pBegin, StrPos pEnd) SAL_THROW((InvalidName))
+ rtl::OUString implNormalizePredicate(sal_Unicode const * pBegin, sal_Unicode const * pEnd) SAL_THROW((InvalidName))
{
sal_Unicode sStopCharBuf[2];
sal_Unicode const * pStopChars;
@@ -780,7 +720,7 @@ namespace
OSL_PRECOND(pEnd[-1] == chUsedQuot, "Non-matching quotes in bracketed quoted string");
if (pEnd-pBegin <= 1 || pEnd[-1] != chUsedQuot)
- throw InvalidName( OUString(pBegin, pEnd-pBegin), "is not a valid element predicate: quotes do not match");
+ throw InvalidName( rtl::OUString(pBegin, pEnd-pBegin), "is not a valid element predicate: quotes do not match");
++pBegin; --pEnd; // skip quotes
@@ -801,21 +741,21 @@ namespace
}
if (pBegin == pEnd)
- throw InvalidName(OUString(pBegin-1,2),"Empty element name in predicate");
+ throw InvalidName(rtl::OUString(pBegin-1,2),"Empty element name in predicate");
return implMakeNormalizedPredicate(pBegin, pEnd, pStopChars);
}
//-----------------------------------------------------------------------------
/// parse a path into a sequence of components
- Path::Rep implParsePath(OUString const& _aPathString, PathType eType) SAL_THROW((InvalidName))
+ Path::Rep implParsePath(rtl::OUString const& _aPathString, PathType eType) SAL_THROW((InvalidName))
{
Path::Rep aResult;
dprint (stderr, "implParsePath '%s' ",
rtl::OUStringToOString(_aPathString, RTL_TEXTENCODING_UTF8).getStr());
- StrPos pBegin = _aPathString.getStr();
- StrPos pEnd = pBegin + _aPathString.getLength();
+ sal_Unicode const * pBegin = _aPathString.getStr();
+ sal_Unicode const * pEnd = pBegin + _aPathString.getLength();
if (eType == eABSOLUTE)
{
@@ -844,13 +784,13 @@ namespace
while (pEnd != pBegin)
{
// check for predicate
- StrPos pQuoteStart = implFindPredicateStart(pBegin, pEnd);
+ sal_Unicode const * pQuoteStart = implFindPredicateStart(pBegin, pEnd);
if (pQuoteStart == NULL)
throw InvalidName(_aPathString, "is not a valid path. Invalid name or predicate syntax");
- StrPos pNameStart = implFindNameStart(pBegin, pQuoteStart);
+ sal_Unicode const * pNameStart = implFindNameStart(pBegin, pQuoteStart);
- OUString aElementName(pNameStart, pQuoteStart-pNameStart);
+ rtl::OUString aElementName(pNameStart, pQuoteStart-pNameStart);
if (!isSimpleName(aElementName))
{
@@ -867,13 +807,13 @@ namespace
if (pQuoteStart != pEnd)
{
dprint (stderr, "add 'normalize predicate'", "");
- OUString aPred = implNormalizePredicate(pQuoteStart,pEnd);
+ rtl::OUString aPred = implNormalizePredicate(pQuoteStart,pEnd);
aElementName += aPred;
dprint (stderr, " [result pred '%s']",
rtl::OUStringToOString(aPred, RTL_TEXTENCODING_UTF8).getStr());
}
- aResult.prepend( Path::Component(aElementName, Path::PackageOnly()) );
+ aResult.prepend( Path::Component(aElementName) );
pEnd = pNameStart;
if (pNameStart != pBegin) --pEnd;
@@ -884,9 +824,9 @@ namespace
//-----------------------------------------------------------------------------
/// build a composite path component from a base name (type) and a (somewhat optional) predicate
- Name implMakeCompositeName(OUString const& _sBaseName, OUString const& _sPredicate) SAL_THROW((InvalidName))
+ rtl::OUString implMakeCompositeName(rtl::OUString const& _sBaseName, rtl::OUString const& _sPredicate) SAL_THROW((InvalidName))
{
- OUString sComposite(_sBaseName);
+ rtl::OUString sComposite(_sBaseName);
if (isEmptyString(_sBaseName))
sComposite = makeWildcardType();
@@ -897,8 +837,8 @@ namespace
dprint (stderr, "implMakeNormalizePred '%s' ",
rtl::OUStringToOString(_sPredicate, RTL_TEXTENCODING_UTF8).getStr());
- StrPos pPredStart = _sPredicate.getStr();
- StrPos pPredEnd = pPredStart + _sPredicate.getLength();
+ sal_Unicode const * pPredStart = _sPredicate.getStr();
+ sal_Unicode const * pPredEnd = pPredStart + _sPredicate.getLength();
if (pPredStart != pPredEnd)
sComposite += implMakeNormalizedPredicate(pPredStart, pPredEnd, NULL);
@@ -906,24 +846,23 @@ namespace
dprint (stderr, " [result pred '%s']\n",
rtl::OUStringToOString(sComposite, RTL_TEXTENCODING_UTF8).getStr());
- return Name( sComposite, Path::PackageOnly() );
+ return sComposite;
}
//-----------------------------------------------------------------------------
/// split a composite path component into a base name (type) and a predicate (if present)
- void implSplitCompositeName(Name const& _aCompositeName, OUString& _rBaseName, OUString& _rPredicate) SAL_THROW(())
+ void implSplitCompositeName(rtl::OUString const& _aCompositeName, rtl::OUString& _rBaseName, rtl::OUString& _rPredicate) SAL_THROW(())
{
- OUString sComposite = _aCompositeName.toString();
- sal_Int32 nPos = sComposite.indexOf(c_lBracket);
+ sal_Int32 nPos = _aCompositeName.indexOf(c_lBracket);
if (nPos >= 0)
{
OSL_ENSURE( nPos > 0, "Invalid name: Only predicate, no base type");
- _rBaseName = sComposite.copy(0,nPos);
+ _rBaseName = _aCompositeName.copy(0,nPos);
- StrPos pBeginPred = sComposite.getStr() + nPos;
- StrPos pEndPred = sComposite.getStr() + sComposite.getLength();
+ sal_Unicode const * pBeginPred = _aCompositeName.getStr() + nPos;
+ sal_Unicode const * pEndPred = _aCompositeName.getStr() + _aCompositeName.getLength();
OSL_ASSERT(pBeginPred[0] == c_lBracket);
OSL_ENSURE(pBeginPred[1] == c_normal_quot, "Missing or unexpected quote mark");
@@ -935,9 +874,9 @@ namespace
}
else
{
- OSL_ENSURE( sComposite.indexOf(c_rBracket) < 0, "Invalid name: Predicate brackets not opened");
- _rBaseName = sComposite;
- _rPredicate = OUString();
+ OSL_ENSURE( _aCompositeName.indexOf(c_rBracket) < 0, "Invalid name: Predicate brackets not opened");
+ _rBaseName = _aCompositeName;
+ _rPredicate = rtl::OUString();
}
}
//-----------------------------------------------------------------------------
@@ -954,7 +893,7 @@ void RelativePath::init() SAL_THROW(())
}
//-----------------------------------------------------------------------------
-RelativePath RelativePath::parse(OUString const& aString)
+RelativePath RelativePath::parse(rtl::OUString const& aString)
{
return RelativePath( implParsePath(aString, eRELATIVE) );
}
@@ -974,7 +913,7 @@ RelativePath RelativePath::compose(RelativePath const& aPath) const SAL_THROW(()
return RelativePath( aResult );
}
//-----------------------------------------------------------------------------
-OUString RelativePath::toString() const SAL_THROW(())
+rtl::OUString RelativePath::toString() const SAL_THROW(())
{
return m_aRep.toString(false);
}
@@ -989,7 +928,7 @@ void AbsolutePath::init() SAL_THROW(())
}
//-----------------------------------------------------------------------------
-AbsolutePath AbsolutePath::parse(OUString const& aString)
+AbsolutePath AbsolutePath::parse(rtl::OUString const& aString)
{
return AbsolutePath( implParsePath(aString, eABSOLUTE) );
}
@@ -1008,23 +947,17 @@ AbsolutePath AbsolutePath::detachedRoot() SAL_THROW(())
}
//-----------------------------------------------------------------------------
-static inline Path::Component implMakeSafeModuleName(OUString const& _sModuleName) SAL_THROW(())
+static inline Path::Component implMakeSafeModuleName(rtl::OUString const& _sModuleName) SAL_THROW(())
{
OSL_ENSURE( isSimpleName(_sModuleName), "A module name must be a simple name");
// if (isSimpleName(_sModuleName)) sModuleName = escape_name( _sModuleName );
- return Path::Component(_sModuleName, Path::PackageOnly());
-}
-//-----------------------------------------------------------------------------
-
-AbsolutePath AbsolutePath::makeModulePath(Name const& _aModuleName, NoValidate) SAL_THROW(())
-{
- return AbsolutePath( Path::Rep( implMakeSafeModuleName(_aModuleName.toString()) ) );
+ return Path::Component(_sModuleName);
}
//-----------------------------------------------------------------------------
-AbsolutePath AbsolutePath::makeModulePath(OUString const& _sModuleName, NoValidate) SAL_THROW(())
+AbsolutePath AbsolutePath::makeModulePath(rtl::OUString const& _sModuleName) SAL_THROW(())
{
return AbsolutePath( Path::Rep( implMakeSafeModuleName(_sModuleName) ) );
}
@@ -1058,7 +991,7 @@ bool AbsolutePath::isDetached() const SAL_THROW(())
#endif
//-----------------------------------------------------------------------------
-OUString AbsolutePath::toString() const SAL_THROW(())
+rtl::OUString AbsolutePath::toString() const SAL_THROW(())
{
return m_aRep.toString(true);
}
diff --git a/configmgr/source/treemgr/configset.cxx b/configmgr/source/treemgr/configset.cxx
index b1d9e47bd4..941136728d 100644
--- a/configmgr/source/treemgr/configset.cxx
+++ b/configmgr/source/treemgr/configset.cxx
@@ -34,7 +34,8 @@
#include "configset.hxx"
#include "nodechange.hxx"
#include "nodechangeimpl.hxx"
-#include "treeimpl.hxx"
+#include "tree.hxx"
+#include "treefragment.hxx"
#include "template.hxx"
#include "templateimpl.hxx"
#include "configgroup.hxx"
@@ -48,234 +49,6 @@ namespace configmgr
namespace configuration
{
//-----------------------------------------------------------------------------
-typedef SetInsertImpl SetInsertTreeImpl;
-typedef SetRemoveImpl SetRemoveTreeImpl;
-typedef SetReplaceImpl SetReplaceTreeImpl;
-typedef SetInsertImpl SetInsertValueImpl;
-typedef SetRemoveImpl SetRemoveValueImpl;
-typedef SetReplaceImpl SetReplaceValueImpl;
-//-----------------------------------------------------------------------------
-// class ElementRef
-//-----------------------------------------------------------------------------
-
-ElementRef::ElementRef(ElementTreeImpl* pTree)
-: m_aTreeHolder(pTree)
-{
-}
-//-----------------------------------------------------------------------------
-
-ElementRef::ElementRef(ElementRef const& aOther)
-: m_aTreeHolder(aOther.m_aTreeHolder)
-{
-}
-//-----------------------------------------------------------------------------
-
-ElementRef& ElementRef::operator=(ElementRef const& aOther)
-{
- m_aTreeHolder = aOther.m_aTreeHolder;
- return *this;
-}
-//-----------------------------------------------------------------------------
-
-ElementRef::~ElementRef()
-{
-}
-//-----------------------------------------------------------------------------
-
-bool ElementRef::isValid() const
-{
- return !!m_aTreeHolder.is();
-}
-
-//-----------------------------------------------------------------------------
-
-ElementTree ElementRef::getElementTree() const
-{
- return ElementTree(m_aTreeHolder);
-}
-//-----------------------------------------------------------------------------
-
-Path::Component ElementRef::getFullName() const
-{
- if (!isValid()) return Path::makeEmptyComponent();
-
- return m_aTreeHolder->getExtendedRootName();
-}
-//-----------------------------------------------------------------------------
-
-TemplateHolder ElementRef::getTemplate() const
-{
- if (!isValid()) return TemplateHolder();
-
- return m_aTreeHolder->getTemplate();
-}
-//-----------------------------------------------------------------------------
-
-TreeRef ElementRef::getTreeRef() const
-{
- return TreeRef(m_aTreeHolder.get());
-}
-//-----------------------------------------------------------------------------
-
-ElementRef ElementRef::extract(TreeRef const& aTree)
-{
- TreeImpl* pTree = TreeImplHelper::impl(aTree);
- ElementTreeImpl* pImpl = pTree ? pTree->asElementTree() : 0;
- return ElementRef(pImpl);
-}
-
-//-----------------------------------------------------------------------------
-// class ElementTree
-//-----------------------------------------------------------------------------
-
-ElementTree::ElementTree()
-: m_aTreeHolder()
-{
-}
-//-----------------------------------------------------------------------------
-
-ElementTree::ElementTree(ElementTreeImpl* pTree)
-: m_aTreeHolder(pTree)
-{
-}
-//-----------------------------------------------------------------------------
-
-ElementTree::ElementTree(ElementTreeHolder const& pTree)
-: m_aTreeHolder(pTree)
-{
-}
-//-----------------------------------------------------------------------------
-
-ElementTree::ElementTree(ElementTree const& aOther)
-: m_aTreeHolder(aOther.m_aTreeHolder)
-{
-}
-//-----------------------------------------------------------------------------
-
-ElementTree& ElementTree::operator=(ElementTree const& aOther)
-{
- m_aTreeHolder = aOther.m_aTreeHolder;
- return *this;
-}
-//-----------------------------------------------------------------------------
-
-ElementTree::~ElementTree()
-{
-}
-//-----------------------------------------------------------------------------
-
-bool ElementTree::isValid() const
-{
- return !!m_aTreeHolder.is();
-}
-//-----------------------------------------------------------------------------
-
-ElementTreeHolder ElementTree::get() const
-{
- return m_aTreeHolder;
-}
-//-----------------------------------------------------------------------------
-
-ElementTreeImpl* ElementTree::getImpl() const
-{
- return m_aTreeHolder.get();
-}
-//-----------------------------------------------------------------------------
-
-ElementTreeImpl* ElementTree::operator->() const
-{
- return m_aTreeHolder.operator->();
-}
-//-----------------------------------------------------------------------------
-
-ElementTreeImpl& ElementTree::operator*() const
-{
- return m_aTreeHolder.operator*();
-}
-//-----------------------------------------------------------------------------
-
-Tree ElementTree::getTree() const
-{
- return Tree(m_aTreeHolder.get());
-}
-//-----------------------------------------------------------------------------
-
-ElementTree ElementTree::extract(Tree const& aTree)
-{
- return ElementRef::extract(aTree.getRef()).getElementTree();
-}
-
-//-----------------------------------------------------------------------------
-// class TemplateInfo
-//-----------------------------------------------------------------------------
-
-TemplateInfo::TemplateInfo(TemplateHolder const& aTemplate)
-: m_aTemplate(aTemplate)
-{
- OSL_ENSURE(m_aTemplate.is(), "ERROR: Configuration: Creating TemplateInfo without template information");
- if (!m_aTemplate.is())
- throw configuration::Exception("Missing template information");
-}
-//-----------------------------------------------------------------------------
-
-TemplateHolder TemplateInfo::getTemplate() const
-{
- return m_aTemplate;
-}
-//-----------------------------------------------------------------------------
-
-UnoType TemplateInfo::getType() const
-{
- return m_aTemplate->getInstanceType();
-}
-
-//-----------------------------------------------------------------------------
-
-OUString TemplateInfo::getTemplatePathString() const
-{
- return m_aTemplate->getPathString();
-}
-//-----------------------------------------------------------------------------
-
-//-----------------------------------------------------------------------------
-// class SetElementInfo
-//-----------------------------------------------------------------------------
-
-SetElementInfo::SetElementInfo(TemplateHolder const& aTemplate)
-: m_aTemplateInfo(aTemplate)
-{
-}
-//-----------------------------------------------------------------------------
-
-TemplateHolder SetElementInfo::getTemplate() const
-{
- return m_aTemplateInfo.getTemplate();
-}
-//-----------------------------------------------------------------------------
-
-TemplateInfo SetElementInfo::getTemplateInfo() const
-{
- return m_aTemplateInfo;
-}
-//-----------------------------------------------------------------------------
-
-TemplateHolder SetElementInfo::extractElementInfo(Tree const& aTree, NodeRef const& aNode)
-{
- OSL_ENSURE(!aTree.isEmpty(), "ERROR: Getting Element Info requires a valid tree");
- OSL_ENSURE(aNode.isValid(), "ERROR: Getting Element Info requires a valid node");
- OSL_ENSURE(aTree.isValidNode(aNode), "ERROR: Tree/Node mismatch");
- if (aNode.isValid() )
- {
- view::ViewTreeAccess aView = aTree.getView();
-
- OSL_ENSURE (aView.isSetNode(aNode), "WARNING: Getting Element Info requires a SET node");
- if (aView.isSetNode(aNode))
- return aView.getElementTemplate(aView.toSetNode(aNode));
- }
- return TemplateHolder();
-}
-
-//-----------------------------------------------------------------------------
// class SetElementFactory
//-----------------------------------------------------------------------------
@@ -304,54 +77,38 @@ SetElementFactory::~SetElementFactory()
}
//-----------------------------------------------------------------------------
-ElementTree SetElementFactory::instantiateTemplate(TemplateHolder const& aTemplate)
+rtl::Reference< ElementTree > SetElementFactory::instantiateTemplate(rtl::Reference<Template> const& aTemplate)
{
OSL_ENSURE(m_aProvider.m_aImpl.is(), "ERROR: Template Instance Factory has no template provider - cannot instantiate element");
OSL_ENSURE(aTemplate.is(), "ERROR: Template is NULL - cannot instantiate element");
- if (!m_aProvider.m_aImpl.is()) return ElementTree::emptyElement();
-
- if (!aTemplate.is()) return ElementTree::emptyElement();
-
- data::TreeSegment aInstanceTree( m_aProvider.m_aImpl->instantiate(aTemplate) );
+ rtl::Reference< data::TreeSegment > aInstanceTree( m_aProvider.m_aImpl->instantiate(aTemplate) );
OSL_ENSURE(aInstanceTree.is(), "ERROR: Cannot create Element Instance: Provider could not instantiate template");
-
- if (!aInstanceTree.is()) return ElementTree::emptyElement();
//set removable state
- aInstanceTree.markRemovable();
+ aInstanceTree->fragment->header.state |= data::State::flag_removable;
- ElementTree aRet( new ElementTreeImpl( aInstanceTree, aTemplate, m_aProvider ) );
-
- return aRet;
+ return new ElementTree( aInstanceTree, aTemplate, m_aProvider );
}
//-----------------------------------------------------------------------------
-ElementTree SetElementFactory::instantiateOnDefault(data::TreeSegment const& _aElementData, TemplateHolder const& aDummyTemplate)
+rtl::Reference< ElementTree > SetElementFactory::instantiateOnDefault(rtl::Reference< data::TreeSegment > const& _aElementData, rtl::Reference<Template> const& aDummyTemplate)
{
// OSL_ENSURE(m_aProvider.m_aImpl(), "ERROR: Template Instance Factory has no template provider - cannot instantiate element");
OSL_ENSURE(_aElementData.is(), "ERROR: Tree is NULL - cannot instantiate element");
OSL_ENSURE(aDummyTemplate.is(), "ERROR: Template is NULL - cannot instantiate element");
- if (!_aElementData.is()) return ElementTree::emptyElement();
-
- ElementTree aRet( new ElementTreeImpl( _aElementData, aDummyTemplate, m_aProvider ) );
- // ElementTreeImpl* pNewTree = new ElementTreeImpl( NodeType::getDeferredChangeFactory(),*aTree, c_TreeDepthAll, aDummyTemplate, m_aProvider );
- // pNewTree->takeNodeFrom(aTree);
-
- // return ElementTree( pNewTree );
-
- return aRet;
+ return new ElementTree( _aElementData, aDummyTemplate, m_aProvider );
}
//-----------------------------------------------------------------------------
-TemplateProvider SetElementFactory::findTemplateProvider(Tree const& aTree, NodeRef const& aNode)
+TemplateProvider SetElementFactory::findTemplateProvider(rtl::Reference< Tree > const& aTree, NodeRef const& aNode)
{
- OSL_ENSURE(!aTree.isEmpty(), "ERROR: Getting Element Factory requires a valid tree");
+ OSL_ENSURE(!isEmpty(aTree.get()), "ERROR: Getting Element Factory requires a valid tree");
OSL_ENSURE(aNode.isValid(), "ERROR: Getting Element Factory requires a valid node");
- OSL_ENSURE(aTree.isValidNode(aNode), "ERROR: Tree/Node mismatch");
+ OSL_ENSURE(aTree->isValidNode(aNode.getOffset()), "ERROR: Tree/Node mismatch");
if (aNode.isValid() )
{
- view::ViewTreeAccess aView = aTree.getView();
+ view::ViewTreeAccess aView(aTree.get());
OSL_ENSURE (aView.isSetNode(aNode), "WARNING: Getting Element Factory requires a SET node");
if (aView.isSetNode(aNode))
@@ -381,14 +138,14 @@ static node::Attributes getNewElementAttributes(bool bInserting)
// Value Element Factory methods
//-----------------------------------------------------------------------------
-ElementTreeHolder ValueSetUpdater::makeValueElement(Name const& aName, UnoAny const& aValue, bool bInserting)
+rtl::Reference<ElementTree> ValueSetUpdater::makeValueElement(rtl::OUString const& aName, com::sun::star::uno::Any const& aValue, bool bInserting)
{
const node::Attributes aNewValueAttributes = getNewElementAttributes(bInserting); // TODO: get real value
- UnoType aType = m_aTemplate->getInstanceType();
+ com::sun::star::uno::Type aType = m_aTemplate->getInstanceType();
- OUString aTypeName = m_aTemplate->getName().toString();
+ rtl::OUString aTypeName = m_aTemplate->getName();
std::auto_ptr<INode> pNode;
if (aValue.hasValue())
@@ -396,13 +153,13 @@ ElementTreeHolder ValueSetUpdater::makeValueElement(Name const& aName, UnoAny co
else
pNode.reset( new ValueNode(aTypeName, aType, aNewValueAttributes) );
- data::TreeSegment aValueTree = data::TreeSegment::createNew(aName.toString(), pNode);
+ rtl::Reference< data::TreeSegment > aValueTree = data::TreeSegment::create(aName, pNode);
- return new ElementTreeImpl(aValueTree, m_aTemplate, TemplateProvider() );
+ return new ElementTree(aValueTree, m_aTemplate, TemplateProvider() );
}
//-----------------------------------------------------------------------------
-ElementTreeHolder ValueSetUpdater::makeValueElement(Name const& aName, ElementNodeRef const& , UnoAny const& aValue, bool bInserting)
+rtl::Reference<ElementTree> ValueSetUpdater::makeValueElement(rtl::OUString const& aName, rtl::Reference< Tree > const& , com::sun::star::uno::Any const& aValue, bool bInserting)
{
// for now ignoring the node.
// TODO: merge attributes etc. from that node's value
@@ -411,27 +168,27 @@ ElementTreeHolder ValueSetUpdater::makeValueElement(Name const& aName, ElementNo
//-----------------------------------------------------------------------------
-TreeSetUpdater::TreeSetUpdater(Tree const& aParentTree, NodeRef const& aSetNode, SetElementInfo const& aInfo)
+TreeSetUpdater::TreeSetUpdater(rtl::Reference< Tree > const& aParentTree, NodeRef const& aSetNode, rtl::Reference< Template > const& aTemplate)
: m_aParentTree(aParentTree)
, m_aSetNode(aSetNode)
-, m_aTemplate(aInfo.getTemplate())
+, m_aTemplate(aTemplate)
{
implValidateSet();
}
//-----------------------------------------------------------------------------
-ValueSetUpdater::ValueSetUpdater(Tree const& aParentTree, NodeRef const& aSetNode,
- SetElementInfo const& aInfo, UnoTypeConverter const& xConverter)
+ValueSetUpdater::ValueSetUpdater(rtl::Reference< Tree > const& aParentTree, NodeRef const& aSetNode,
+ rtl::Reference< Template > const& aTemplate, com::sun::star::uno::Reference<com::sun::star::script::XTypeConverter> const& xConverter)
: m_aParentTree(aParentTree)
, m_aSetNode(aSetNode)
-, m_aTemplate(aInfo.getTemplate())
+, m_aTemplate(aTemplate)
, m_xTypeConverter(xConverter)
{
implValidateSet();
}
//-----------------------------------------------------------------------------
-SetDefaulter::SetDefaulter(Tree const& aParentTree, NodeRef const& aSetNode,
+SetDefaulter::SetDefaulter(rtl::Reference< Tree > const& aParentTree, NodeRef const& aSetNode,
DefaultProvider const& aDefaultProvider)
: m_aParentTree(aParentTree)
, m_aSetNode(aSetNode)
@@ -442,21 +199,21 @@ SetDefaulter::SetDefaulter(Tree const& aParentTree, NodeRef const& aSetNode,
//-----------------------------------------------------------------------------
/// validates that a actual set and an updater's construction parameters match
-static void doValidateSet(Tree const& aParentTree, NodeRef const& aSetNode)
+static void doValidateSet(rtl::Reference< Tree > const& aParentTree, NodeRef const& aSetNode)
{
- if (aParentTree.isEmpty())
+ if (isEmpty(aParentTree.get()))
throw Exception("INTERNAL ERROR: Set Update: Unexpected NULL tree");
if (!aSetNode.isValid())
throw Exception("INTERNAL ERROR: Set Update: Unexpected NULL node");
- if (!aParentTree.isValidNode(aSetNode))
+ if (!aParentTree->isValidNode(aSetNode.getOffset()))
throw Exception("INTERNAL ERROR: Set Update: node does not match tree");
- if (! aParentTree.getView().isSetNode(aSetNode))
+ if (! view::ViewTreeAccess(aParentTree.get()).isSetNode(aSetNode))
throw Exception("INTERNAL ERROR: Set Update: node is not a set");
- if (aParentTree.getAttributes(aSetNode).isReadonly())
+ if (aParentTree->getAttributes(aSetNode).isReadonly())
throw ConstraintViolation( "Set Update: Set is read-only !" );
}
//-----------------------------------------------------------------------------
@@ -472,7 +229,7 @@ void TreeSetUpdater::implValidateSet()
if (m_aTemplate->isInstanceValue())
throw Exception("INTERNAL ERROR: Tree set update invoked on a value-set");
- view::ViewTreeAccess aParentView = m_aParentTree.getView();
+ view::ViewTreeAccess aParentView(m_aParentTree.get());
if ( aParentView.getElementTemplate(aParentView.toSetNode(m_aSetNode)) != m_aTemplate)
throw Exception("INTERNAL ERROR: Set Update: template mismatch");
@@ -484,7 +241,7 @@ void ValueSetUpdater::implValidateSet()
{
doValidateSet(m_aParentTree,m_aSetNode);
- UnoType aThisType = m_aTemplate->getInstanceType();
+ com::sun::star::uno::Type aThisType = m_aTemplate->getInstanceType();
switch ( aThisType.getTypeClass())
{
@@ -497,7 +254,7 @@ void ValueSetUpdater::implValidateSet()
default: break;
}
- view::ViewTreeAccess aParentView = m_aParentTree.getView();
+ view::ViewTreeAccess aParentView(m_aParentTree.get());
if ( aParentView.getElementTemplate(aParentView.toSetNode(m_aSetNode))->getInstanceType() != aThisType)
throw Exception("INTERNAL ERROR: Set Update: element type mismatch");
@@ -514,48 +271,36 @@ void SetDefaulter::implValidateSet()
}
//-----------------------------------------------------------------------------
-static void doValidateElement(ElementRef const& aElement, bool bReqRemovable)
+static void doValidateElement(rtl::Reference< ElementTree > const& aElement, bool bReqRemovable)
{
- if (!aElement.isValid())
+ if (!aElement.is())
throw Exception("INTERNAL ERROR: Set Update: Unexpected NULL element");
-// DISABLED: replaceable/removable != writable
-// if (!aElement.getAttributes().writable)
-// throw ConstraintViolation( "Set Update: Existing element is read-only !" );
-
if ( bReqRemovable)
{
- Tree aElementTree = aElement.getElementTree().getTree();
+ rtl::Reference< Tree > aElementTree = aElement.get();
- if(!aElementTree.getAttributes(aElementTree.getRootNode()).isRemovable())
+ if(!aElementTree->getAttributes(aElementTree->getRootNode()).isRemovable())
throw ConstraintViolation( "New Set Update: Existing element cannot be removed (or replaced) !" );
}
}
//-----------------------------------------------------------------------------
/// validates that the given element is valid in this context and returns its name
-Path::Component TreeSetUpdater::implValidateElement(ElementRef const& aElement, bool bReqRemovable)
+Path::Component TreeSetUpdater::implValidateElement(rtl::Reference< ElementTree > const& aElement, bool bReqRemovable)
{
doValidateElement(aElement,bReqRemovable);
-
-#if 0 // maybe reeanable for OSL_DEBUG_LEVEL>1 ?
- ElementTreeImpl* pElement = TreeImplHelper::elementImpl(aTree)->isTemplateInstance();
- OSL_ENSURE( pElement, "INTERNAL ERROR: Set Element has wrong type of tree");
- OSL_ENSURE( !pElement || pElement->isTemplateInstance(), "INTERNAL ERROR: Set Element without associated template found");
- OSL_ENSURE( !pElement || pElement->isInstanceOf(m_aTemplate), "INTERNAL ERROR: Set Update: existing element does not match template");
-#endif
-
- return aElement.getFullName();
+ return aElement->getExtendedRootName();
}
//-----------------------------------------------------------------------------
/// validates that the given element is valid and can be replaced in this context and returns its name
-Path::Component ValueSetUpdater::implValidateElement(ElementRef const& aElement, bool mReqRemovable)
+Path::Component ValueSetUpdater::implValidateElement(rtl::Reference< ElementTree > const& aElement, bool mReqRemovable)
{
doValidateElement(aElement,mReqRemovable);
#if OSL_DEBUG_LEVEL > 0
- UnoType aNodeType = ElementHelper::getUnoType(aElement.getElementTree());
+ com::sun::star::uno::Type aNodeType = ElementHelper::getUnoType(aElement);
OSL_ENSURE(aNodeType.getTypeClass() != uno::TypeClass_VOID, "INTERNAL ERROR: Set Element without associated type found");
OSL_ENSURE(aNodeType.getTypeClass() != uno::TypeClass_INTERFACE,"INTERNAL ERROR: Set Element with complex type found");
@@ -565,40 +310,40 @@ Path::Component ValueSetUpdater::implValidateElement(ElementRef const& aElement,
"INTERNAL ERROR: Set Update: existing element does not match template type");
#endif
- return aElement.getFullName();
+ return aElement->getExtendedRootName();
}
//-----------------------------------------------------------------------------
-static void checkEligibleChild(ElementTree const& aElementTree, Tree const& aParentTree)
+static void checkEligibleChild(rtl::Reference< ElementTree > const& aElementTree, rtl::Reference< Tree > const& aParentTree)
{
- ElementTreeImpl const * const pElement = aElementTree.getImpl(); OSL_ASSERT(pElement);
+ ElementTree const * const pElement = aElementTree.get(); OSL_ASSERT(pElement);
if (pElement->getContextTree() != NULL)
throw ConstraintViolation( "Set Update: cannot insert an element that already has a parent." );
- TreeImpl const* pAncestor = TreeImplHelper::impl(aParentTree);
+ Tree const* pAncestor = aParentTree.get();
while (pAncestor != NULL)
{
if (pElement == pAncestor)
throw ConstraintViolation( "Set Update: Circular insertion - trying to insert an element into self or descendant" );
pAncestor = pAncestor->getContextTree();
- OSL_ENSURE(pAncestor != TreeImplHelper::impl(aParentTree), "ERROR: Circular tree found");
+ OSL_ENSURE(pAncestor != aParentTree.get(), "ERROR: Circular tree found");
}
}
//-----------------------------------------------------------------------------
-void TreeSetUpdater::implValidateTree(ElementTree const& aElementTree)
+void TreeSetUpdater::implValidateTree(rtl::Reference< ElementTree > const& aElementTree)
{
- if (!aElementTree.isValid())
+ if (!aElementTree.is())
throw ConstraintViolation( "Set Update: cannot replace element of complex set with NULL node. Remove the element instead !" );
checkEligibleChild(aElementTree,m_aParentTree);
if (! aElementTree->isTemplateInstance())
{
- throw TypeMismatch(OUString(RTL_CONSTASCII_USTRINGPARAM("<Unnamed> (Template missing)")),
- m_aTemplate->getName().toString(), " - new element without template in Set Update");
+ throw TypeMismatch(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("<Unnamed> (Template missing)")),
+ m_aTemplate->getName(), " - new element without template in Set Update");
}
if (!aElementTree->isInstanceOf(m_aTemplate))
@@ -609,17 +354,17 @@ void TreeSetUpdater::implValidateTree(ElementTree const& aElementTree)
}
//-----------------------------------------------------------------------------
-UnoAny ValueSetUpdater::implValidateValue(UnoAny const& aValue)
+com::sun::star::uno::Any ValueSetUpdater::implValidateValue(com::sun::star::uno::Any const& aValue)
{
- UnoType const aThisType = m_aTemplate->getInstanceType();
+ com::sun::star::uno::Type const aThisType = m_aTemplate->getInstanceType();
OSL_ENSURE( aThisType.getTypeClass() == uno::TypeClass_ANY || isPossibleValueType(aThisType),
"Invalid element type for value set" );
- UnoAny aRet;
+ com::sun::star::uno::Any aRet;
if (aValue.hasValue())
{
- UnoType const aValType = aValue.getValueType();
+ com::sun::star::uno::Type const aValType = aValue.getValueType();
if (aValType.getTypeClass() == uno::TypeClass_INTERFACE)
throw TypeMismatch(aValType.getTypeName(), aThisType.getTypeName(), " - cannot replace value by complex tree in Set update");
@@ -655,9 +400,9 @@ UnoAny ValueSetUpdater::implValidateValue(UnoAny const& aValue)
}
//-----------------------------------------------------------------------------
-UnoAny ValueSetUpdater::implValidateValue(ElementNodeRef const& aElementTree, UnoAny const& aValue)
+com::sun::star::uno::Any ValueSetUpdater::implValidateValue(rtl::Reference< Tree > const& aElementTree, com::sun::star::uno::Any const& aValue)
{
- node::Attributes aAttributes = aElementTree.getAttributes(aElementTree.getRootNode());
+ node::Attributes aAttributes = aElementTree->getAttributes(aElementTree->getRootNode());
// Here we assume writable == removable/replaceable
if (aAttributes.isReadonly())
throw ConstraintViolation( "Set Update: Existing element is read-only !" );
@@ -672,9 +417,9 @@ UnoAny ValueSetUpdater::implValidateValue(ElementNodeRef const& aElementTree, Un
}
//-----------------------------------------------------------------------------
-NodeChange TreeSetUpdater::validateInsertElement (Name const& aName, ElementTree const& aNewElement)
+NodeChange TreeSetUpdater::validateInsertElement (rtl::OUString const& aName, rtl::Reference< ElementTree > const& aNewElement)
{
- view::ViewTreeAccess aParentView = m_aParentTree.getView();
+ view::ViewTreeAccess aParentView(m_aParentTree.get());
SetEntry anEntry = aParentView.findElement(aParentView.toSetNode(m_aSetNode),aName);
if (anEntry.isValid())
@@ -682,7 +427,7 @@ NodeChange TreeSetUpdater::validateInsertElement (Name const& aName, ElementTree
implValidateTree(aNewElement);
- std::auto_ptr<SetElementChangeImpl> pChange( new SetInsertTreeImpl(aNewElement->makeExtendedName(aName), aNewElement.get()) );
+ std::auto_ptr<SetElementChangeImpl> pChange( new SetInsertImpl(aNewElement->makeExtendedName(aName), aNewElement) );
pChange->setTarget(aParentView.makeNode(m_aSetNode));
@@ -690,19 +435,19 @@ NodeChange TreeSetUpdater::validateInsertElement (Name const& aName, ElementTree
}
//-----------------------------------------------------------------------------
-NodeChange ValueSetUpdater::validateInsertElement (Name const& aName, UnoAny const& aNewValue)
+NodeChange ValueSetUpdater::validateInsertElement (rtl::OUString const& aName, com::sun::star::uno::Any const& aNewValue)
{
- view::ViewTreeAccess aParentView = m_aParentTree.getView();
+ view::ViewTreeAccess aParentView(m_aParentTree.get());
SetEntry anEntry = aParentView.findElement(aParentView.toSetNode(m_aSetNode),aName);
if (anEntry.isValid())
throw Exception("INTERNAL ERROR: Set Update: Element to be inserted already exists");
- UnoAny aValidValue = implValidateValue(aNewValue);
+ com::sun::star::uno::Any aValidValue = implValidateValue(aNewValue);
- ElementTreeHolder aNewElement = makeValueElement(aName, aValidValue,true);
+ rtl::Reference<ElementTree> aNewElement = makeValueElement(aName, aValidValue,true);
- std::auto_ptr<SetElementChangeImpl> pChange( new SetInsertValueImpl(aNewElement->makeExtendedName(aName), aNewElement) );
+ std::auto_ptr<SetElementChangeImpl> pChange( new SetInsertImpl(aNewElement->makeExtendedName(aName), aNewElement) );
pChange->setTarget(aParentView.makeNode(m_aSetNode));
@@ -710,32 +455,32 @@ NodeChange ValueSetUpdater::validateInsertElement (Name const& aName, UnoAny con
}
//-----------------------------------------------------------------------------
-NodeChange TreeSetUpdater::validateReplaceElement(ElementRef const& aElement, ElementTree const& aNewElement)
+NodeChange TreeSetUpdater::validateReplaceElement(rtl::Reference< ElementTree > const& aElement, rtl::Reference< ElementTree > const& aNewElement)
{
Path::Component aName = implValidateElement(aElement,true);
implValidateTree(aNewElement);
- std::auto_ptr<SetElementChangeImpl> pChange( new SetReplaceTreeImpl(aName, aNewElement.get()) );
+ std::auto_ptr<SetElementChangeImpl> pChange( new SetReplaceImpl(aName, aNewElement) );
- pChange->setTarget(m_aParentTree.getView().makeNode(m_aSetNode));
+ pChange->setTarget(view::ViewTreeAccess(m_aParentTree.get()).makeNode(m_aSetNode));
return NodeChange(pChange.release());
}
//-----------------------------------------------------------------------------
-NodeChange ValueSetUpdater::validateReplaceElement(ElementRef const& aElement, UnoAny const& aNewValue)
+NodeChange ValueSetUpdater::validateReplaceElement(rtl::Reference< ElementTree > const& aElement, com::sun::star::uno::Any const& aNewValue)
{
Path::Component aName = implValidateElement(aElement,false);
- ElementNodeRef aElementNode = extractElementNode(aElement);
+ rtl::Reference< Tree > aElementNode = extractElementNode(aElement);
- UnoAny aValidValue = implValidateValue(aElementNode, aNewValue);
+ com::sun::star::uno::Any aValidValue = implValidateValue(aElementNode, aNewValue);
- ElementNodeRef aElementTree = aElement.getElementTree().getTree();
+ rtl::Reference< Tree > aElementTree = aElement.get();
- ElementTreeHolder aNewElement;
- if(aElementTree.getAttributes(aElementTree.getRootNode()).isRemovable())
+ rtl::Reference<ElementTree> aNewElement;
+ if(aElementTree->getAttributes(aElementTree->getRootNode()).isRemovable())
{
aNewElement = makeValueElement(aName.getName(), aElementNode, aValidValue,true);
}
@@ -744,34 +489,34 @@ NodeChange ValueSetUpdater::validateReplaceElement(ElementRef const& aElement, U
aNewElement = makeValueElement(aName.getName(), aElementNode, aValidValue,false);
}
- std::auto_ptr<SetElementChangeImpl> pChange( new SetReplaceValueImpl(aName, aNewElement) );
+ std::auto_ptr<SetElementChangeImpl> pChange( new SetReplaceImpl(aName, aNewElement) );
- pChange->setTarget(m_aParentTree.getView().makeNode(m_aSetNode));
+ pChange->setTarget(view::ViewTreeAccess(m_aParentTree.get()).makeNode(m_aSetNode));
return NodeChange(pChange.release());
}
//-----------------------------------------------------------------------------
-NodeChange TreeSetUpdater::validateRemoveElement (ElementRef const& aElement)
+NodeChange TreeSetUpdater::validateRemoveElement (rtl::Reference< ElementTree > const& aElement)
{
Path::Component aName = implValidateElement(aElement,true);
- std::auto_ptr<SetElementChangeImpl> pChange( new SetRemoveTreeImpl(aName) );
+ std::auto_ptr<SetElementChangeImpl> pChange( new SetRemoveImpl(aName) );
- pChange->setTarget(m_aParentTree.getView().makeNode(m_aSetNode));
+ pChange->setTarget(view::ViewTreeAccess(m_aParentTree.get()).makeNode(m_aSetNode));
return NodeChange(pChange.release());
}
//-----------------------------------------------------------------------------
-NodeChange ValueSetUpdater::validateRemoveElement (ElementRef const& aElement)
+NodeChange ValueSetUpdater::validateRemoveElement (rtl::Reference< ElementTree > const& aElement)
{
Path::Component aName = implValidateElement(aElement,true);
- std::auto_ptr<SetElementChangeImpl> pChange( new SetRemoveValueImpl(aName) );
+ std::auto_ptr<SetElementChangeImpl> pChange( new SetRemoveImpl(aName) );
- pChange->setTarget(m_aParentTree.getView().makeNode(m_aSetNode));
+ pChange->setTarget(view::ViewTreeAccess(m_aParentTree.get()).makeNode(m_aSetNode));
return NodeChange(pChange.release());
}
@@ -791,30 +536,29 @@ NodeChange SetDefaulter::validateSetToDefaultState()
configmgr::configuration::SetElementFactory aTmp(aProvider);
pChange.reset( new SetResetImpl(aTmp, aDefault) );
- pChange->setTarget(m_aParentTree.getView().makeNode(m_aSetNode));
+ pChange->setTarget(view::ViewTreeAccess(m_aParentTree.get()).makeNode(m_aSetNode));
}
return NodeChange(pChange.release());
}
//-----------------------------------------------------------------------------
-ValueSetUpdater::ElementNodeRef ValueSetUpdater::extractElementNode (ElementRef const& aElement)
+rtl::Reference< Tree > ValueSetUpdater::extractElementNode (rtl::Reference< ElementTree > const& aElement)
{
- return aElement.getElementTree().getTree();
+ return aElement.get();
}
//-----------------------------------------------------------------------------
#if OSL_DEBUG_LEVEL > 0
-UnoType ElementHelper::getUnoType(ElementTree const& aElement)
+com::sun::star::uno::Type ElementHelper::getUnoType(rtl::Reference< ElementTree > const& aElement)
{
- OSL_PRECOND( aElement.isValid(), "ERROR: Configuration: ElementRef operation requires valid node" );
- if (!aElement.isValid()) return getVoidCppuType();
+ OSL_PRECOND( aElement.is(), "ERROR: Configuration: ElementTree operation requires valid node" );
- Tree aElementTree = aElement.getTree();
+ rtl::Reference< Tree > aElementTree(aElement.get());
- NodeRef aNode = aElementTree.getRootNode();
+ NodeRef aNode = aElementTree->getRootNode();
OSL_ASSERT( aNode.isValid() );
- view::ViewTreeAccess aElementView = aElementTree.getView();
+ view::ViewTreeAccess aElementView(aElementTree.get());
if ( aElementView.isValueNode(aNode) )
{
diff --git a/configmgr/source/treemgr/defaultproviderproxy.cxx b/configmgr/source/treemgr/defaultproviderproxy.cxx
index a2ea2f3f6d..89a0fdf00d 100644
--- a/configmgr/source/treemgr/defaultproviderproxy.cxx
+++ b/configmgr/source/treemgr/defaultproviderproxy.cxx
@@ -33,7 +33,7 @@
#include "defaultproviderproxy.hxx"
#include "defaultprovider.hxx"
-#include "treeprovider.hxx"
+#include "treemanager.hxx"
#include "valuenode.hxx"
#include "options.hxx"
@@ -45,7 +45,7 @@ namespace configmgr
//-----------------------------------------------------------------------------
DefaultProviderProxy::DefaultProviderProxy(
- rtl::Reference< IConfigDefaultProvider > const & _xDefaultTreeProvider,
+ rtl::Reference< TreeManager > const & _xDefaultTreeProvider,
IDefaultableTreeManager * _pDefaultTreeManager,
AbsolutePath const& _aBaseLocation,
RequestOptions const& _aOptions
@@ -66,7 +66,7 @@ DefaultProviderProxy::~DefaultProviderProxy()
/// tries to load a default instance of the specified node (which must be within the request range owned)
std::auto_ptr<ISubtree> DefaultProviderProxy::getDefaultTree(
AbsolutePath const& _aLocation
- ) const CFG_UNO_THROW_ALL()
+ ) const SAL_THROW((com::sun::star::uno::Exception))
{
OSL_ENSURE( Path::hasPrefix(_aLocation,m_aBaseLocation),
"ERROR: DefaultProviderProxy called for out-of-scope location" );
@@ -81,7 +81,7 @@ std::auto_ptr<ISubtree> DefaultProviderProxy::getDefaultTree(
//-----------------------------------------------------------------------------
/// tries to load default data into the specified tree
-bool DefaultProviderProxy::fetchDefaultData() CFG_UNO_THROW_ALL()
+bool DefaultProviderProxy::fetchDefaultData() SAL_THROW((com::sun::star::uno::Exception))
{
OSL_PRECOND(m_pDefaultTreeManager, "No tree to fetch defaults into");
if (!m_pDefaultTreeManager) return false;
diff --git a/configmgr/source/treemgr/defaultproviderproxy.hxx b/configmgr/source/treemgr/defaultproviderproxy.hxx
index f5754acf72..7d1867015d 100644
--- a/configmgr/source/treemgr/defaultproviderproxy.hxx
+++ b/configmgr/source/treemgr/defaultproviderproxy.hxx
@@ -35,6 +35,7 @@
#include "utility.hxx"
#include "requestoptions.hxx"
#include <rtl/ref.hxx>
+#include <salhelper/simplereferenceobject.hxx>
#ifndef INCLUDED_MEMORY
#include <memory>
@@ -45,9 +46,9 @@ namespace configmgr
{
//-----------------------------------------------------------------------------
class ISubtree;
- class IConfigDefaultProvider;
class IDefaultableTreeManager;
class OOptions;
+ class TreeManager;
//-----------------------------------------------------------------------------
namespace configuration
{
@@ -55,19 +56,19 @@ namespace configmgr
/// provides access to the defaults for a given request
class DefaultProviderProxy
- : public configmgr::SimpleReferenceObject
+ : public salhelper::SimpleReferenceObject
{
// the data defining a request
AbsolutePath m_aBaseLocation;
RequestOptions m_aOptions;
// the object(s) that provide the defaults
- rtl::Reference< IConfigDefaultProvider > m_xDefaultTreeProvider;
+ rtl::Reference< TreeManager > m_xDefaultTreeProvider;
IDefaultableTreeManager * m_pDefaultTreeManager;
public:
explicit
DefaultProviderProxy(
- rtl::Reference< IConfigDefaultProvider > const & _xDefaultTreeProvider,
+ rtl::Reference< TreeManager > const & _xDefaultTreeProvider,
IDefaultableTreeManager * _pDefaultTreeManager,
AbsolutePath const& _aBaseLocation,
RequestOptions const& _aOptions
@@ -76,10 +77,10 @@ namespace configmgr
~DefaultProviderProxy();
/// tries to load a default instance of the specified node (which must be within the request range owned)
- std::auto_ptr<ISubtree> getDefaultTree(AbsolutePath const& _aLocation) const CFG_UNO_THROW_ALL();
+ std::auto_ptr<ISubtree> getDefaultTree(AbsolutePath const& _aLocation) const SAL_THROW((com::sun::star::uno::Exception));
/// tries to load default data into the owned tree - call only outside of any locks
- bool fetchDefaultData() CFG_UNO_THROW_ALL();
+ bool fetchDefaultData() SAL_THROW((com::sun::star::uno::Exception));
};
//-----------------------------------------------------------------------------
}
diff --git a/configmgr/source/treemgr/deferredview.cxx b/configmgr/source/treemgr/deferredview.cxx
index d31bb4611d..5e82a08f36 100644
--- a/configmgr/source/treemgr/deferredview.cxx
+++ b/configmgr/source/treemgr/deferredview.cxx
@@ -40,31 +40,27 @@ namespace configmgr
namespace view
{
//-----------------------------------------------------------------------------
-using configuration::DeferredGroupNodeImpl;
-using configuration::DeferredSetNodeImpl;
-
-//-----------------------------------------------------------------------------
-static inline DeferredGroupNodeImpl* deferredGroupNode(Node const& _aNode)
+static inline configuration::DeferredGroupNodeImpl* deferredGroupNode(Node const& _aNode)
{
- return static_cast<DeferredGroupNodeImpl*>(_aNode.get_impl());
+ return static_cast<configuration::DeferredGroupNodeImpl*>(_aNode.get_impl());
}
//-----------------------------------------------------------------------------
-static inline DeferredGroupNodeImpl* deferredGroupNode(GroupNode const& _aNode)
+static inline configuration::DeferredGroupNodeImpl* deferredGroupNode(GroupNode const& _aNode)
{
- return static_cast<DeferredGroupNodeImpl*>(_aNode.get_impl());
+ return static_cast<configuration::DeferredGroupNodeImpl*>(_aNode.get_impl());
}
//-----------------------------------------------------------------------------
-static inline DeferredSetNodeImpl* deferredSetNode(Node const& _aNode)
+static inline configuration::DeferredSetNodeImpl* deferredSetNode(Node const& _aNode)
{
- return static_cast<DeferredSetNodeImpl*>(_aNode.get_impl());
+ return static_cast<configuration::DeferredSetNodeImpl*>(_aNode.get_impl());
}
//-----------------------------------------------------------------------------
-static inline DeferredSetNodeImpl* deferredSetNode(SetNode const& _aNode)
+static inline configuration::DeferredSetNodeImpl* deferredSetNode(SetNode const& _aNode)
{
- return static_cast<DeferredSetNodeImpl*>(_aNode.get_impl());
+ return static_cast<configuration::DeferredSetNodeImpl*>(_aNode.get_impl());
}
//-----------------------------------------------------------------------------
@@ -72,7 +68,7 @@ static inline void deferredValueNode(Node const& _aNode)
{
{ (void)_aNode; }
OSL_ENSURE( _aNode.isValueNode(),"Unknown Node type in deferred view");
- OSL_ENSURE(_aNode.get_offset() == _aNode.tree().get_impl()->root_(), "TreeImpl: Unexpected node type - non-root value element");
+ OSL_ENSURE(_aNode.get_offset() == configuration::Tree::ROOT, "Tree: Unexpected node type - non-root value element");
}
//-----------------------------------------------------------------------------
@@ -80,7 +76,7 @@ static void deferredValueNodeChanged(Node const& _aNode)
{
{ (void)_aNode; }
OSL_ENSURE( _aNode.isValueNode(),"Unknown Node type in deferred view");
- OSL_ENSURE(_aNode.get_offset() == _aNode.tree().get_impl()->root_(), "TreeImpl: Unexpected node type - non-root value element");
+ OSL_ENSURE(_aNode.get_offset() == configuration::Tree::ROOT, "Tree: Unexpected node type - non-root value element");
OSL_ENSURE(!_aNode.isValueNode(),"Value node changes not supported in deferred view");
throw configuration::Exception("Internal Error: Invalid operation applied to element");
}
@@ -132,7 +128,7 @@ void DeferredViewStrategy::implCollectChangesIn(Node const& _aNode, configuratio
{
GroupNode aGroup(_aNode);
- deferredGroupNode(aGroup)->collectValueChanges( _rChanges, _aNode.tree().get_impl(), _aNode.get_offset());
+ deferredGroupNode(aGroup)->collectValueChanges( _rChanges, _aNode.tree(), _aNode.get_offset());
for( Node aChild = aGroup.getFirstChild();
aChild.is();
@@ -148,47 +144,46 @@ void DeferredViewStrategy::implCollectChangesIn(Node const& _aNode, configuratio
}
//-----------------------------------------------------------------------------
-std::auto_ptr<SubtreeChange> DeferredViewStrategy::doPreCommitChanges(Tree const& _aTree, configuration::ElementList& _rRemovedElements)
+std::auto_ptr<SubtreeChange> DeferredViewStrategy::doPreCommitChanges(configuration::Tree * tree, std::vector< rtl::Reference<configuration::ElementTree> >& _rRemovedElements)
{
std::auto_ptr<SubtreeChange> pRet;
- if (hasChanges(_aTree))
+ if (hasChanges(tree))
{
- pRet = implPreCommitChanges(getRootNode(_aTree),_rRemovedElements);
+ pRet = implPreCommitChanges(getRootNode(tree),_rRemovedElements);
if (pRet.get() != NULL)
{
- pRet->setNodeName(getSimpleRootName(_aTree).toString());
+ pRet->setNodeName(getSimpleRootName(tree));
}
}
return pRet;
}
//-----------------------------------------------------------------------------
-void DeferredViewStrategy::doFailedCommit(Tree const& _aTree, SubtreeChange& rChanges)
+void DeferredViewStrategy::doFailedCommit(configuration::Tree * tree, SubtreeChange& rChanges)
{
- implFailedCommit(getRootNode(_aTree),rChanges);
+ implFailedCommit(getRootNode(tree),rChanges);
}
//-----------------------------------------------------------------------------
-void DeferredViewStrategy::doFinishCommit(Tree const& _aTree, SubtreeChange& rChanges)
+void DeferredViewStrategy::doFinishCommit(configuration::Tree * tree, SubtreeChange& rChanges)
{
- implFinishCommit(getRootNode(_aTree),rChanges);
+ implFinishCommit(getRootNode(tree),rChanges);
}
//-----------------------------------------------------------------------------
-void DeferredViewStrategy::doRevertCommit(Tree const& _aTree, SubtreeChange& rChanges)
+void DeferredViewStrategy::doRevertCommit(configuration::Tree * tree, SubtreeChange& rChanges)
{
- implRevertCommit(getRootNode(_aTree),rChanges);
+ implRevertCommit(getRootNode(tree),rChanges);
}
//-----------------------------------------------------------------------------
-configuration::ValueChangeImpl* DeferredViewStrategy::doAdjustToValueChange(GroupNode const& _aGroupNode, Name const& _aName, ValueChange const& rExternalChange)
+configuration::ValueChangeImpl* DeferredViewStrategy::doAdjustToValueChange(GroupNode const& _aGroupNode, rtl::OUString const& _aName, ValueChange const& rExternalChange)
{
- using configuration::ValueChangeImpl;
- DeferredGroupNodeImpl::MemberChange aChange = deferredGroupNode(_aGroupNode)->findValueChange(_aName);
+ rtl::Reference<configuration::ValueMemberNode::DeferredImpl> aChange = deferredGroupNode(_aGroupNode)->findValueChange(_aName);
if (aChange.is())
{
- if (ValueChangeImpl* pValueChange = aChange->adjustToChange(rExternalChange))
+ if (configuration::ValueChangeImpl* pValueChange = aChange->adjustToChange(rExternalChange))
{
OSL_ENSURE(aChange->isChange(), "Got an adjusted change from a non-changing value");
@@ -213,25 +208,25 @@ node::Attributes DeferredViewStrategy::doAdjustAttributes(node::Attributes const
}
//-----------------------------------------------------------------------------
-configuration::ValueMemberNode DeferredViewStrategy::doGetValueMember(GroupNode const& _aNode, Name const& _aName, bool _bForUpdate) const
+configuration::ValueMemberNode DeferredViewStrategy::doGetValueMember(GroupNode const& _aNode, rtl::OUString const& _aName, bool _bForUpdate) const
{
return deferredGroupNode(_aNode)->makeValueMember(_aName,_bForUpdate);
}
//-----------------------------------------------------------------------------
-void DeferredViewStrategy::doInsertElement(SetNode const& _aNode, Name const& aName, configuration::SetEntry const& _aNewEntry)
+void DeferredViewStrategy::doInsertElement(SetNode const& _aNode, rtl::OUString const& aName, configuration::SetEntry const& _aNewEntry)
{
// move to this memory segment
// should be direct (as any free-floating one)
//implMakeElement(aNewEntry)
- SetNodeElement aNewElement = implMakeElement(_aNode, _aNewEntry );
+ configuration::ElementTreeData aNewElement = implMakeElement(_aNode, _aNewEntry );
deferredSetNode(_aNode)->insertNewElement(aName, aNewElement);
}
//-----------------------------------------------------------------------------
-void DeferredViewStrategy::doRemoveElement(SetNode const& _aNode, Name const& aName)
+void DeferredViewStrategy::doRemoveElement(SetNode const& _aNode, rtl::OUString const& aName)
{
deferredSetNode(_aNode)->removeOldElement(aName);
}
@@ -247,7 +242,7 @@ NodeFactory& DeferredViewStrategy::doGetNodeFactory()
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
-ViewStrategyRef createDeferredChangeStrategy()
+rtl::Reference<ViewStrategy> createDeferredChangeStrategy()
{
return new DeferredViewStrategy();
}
@@ -255,7 +250,7 @@ ViewStrategyRef createDeferredChangeStrategy()
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
-std::auto_ptr<SubtreeChange> DeferredViewStrategy::implPreCommitChanges(Node const& _aNode, configuration::ElementList& _rRemovedElements)
+std::auto_ptr<SubtreeChange> DeferredViewStrategy::implPreCommitChanges(Node const& _aNode, std::vector< rtl::Reference<configuration::ElementTree> >& _rRemovedElements)
{
std::auto_ptr<SubtreeChange> aRet;
@@ -284,7 +279,7 @@ std::auto_ptr<SubtreeChange> DeferredViewStrategy::implPreCommitChanges(Node con
void DeferredViewStrategy::implFinishCommit(Node const& _aNode, SubtreeChange& rSubtreeChange)
{
- OSL_PRECOND( getSimpleNodeName(_aNode).toString() == rSubtreeChange.getNodeName(), "ERROR: Change name does not match node");
+ OSL_PRECOND( getSimpleNodeName(_aNode) == rSubtreeChange.getNodeName(), "ERROR: Change name does not match node");
if (_aNode.isSetNode())
{
@@ -302,14 +297,14 @@ void DeferredViewStrategy::implFinishCommit(Node const& _aNode, SubtreeChange& r
else
{
deferredValueNode(_aNode);
- OSL_ENSURE(false, "TreeImpl: Cannot finish commit: Unexpected node type");
+ OSL_ENSURE(false, "Tree: Cannot finish commit: Unexpected node type");
}
}
//-----------------------------------------------------------------------------
void DeferredViewStrategy::implRevertCommit(Node const& _aNode, SubtreeChange& rSubtreeChange)
{
- OSL_PRECOND( getSimpleNodeName(_aNode).toString() == rSubtreeChange.getNodeName(), "ERROR: Change name does not match node");
+ OSL_PRECOND( getSimpleNodeName(_aNode) == rSubtreeChange.getNodeName(), "ERROR: Change name does not match node");
if (_aNode.isSetNode())
{
@@ -327,14 +322,14 @@ void DeferredViewStrategy::implRevertCommit(Node const& _aNode, SubtreeChange& r
else
{
deferredValueNode(_aNode);
- OSL_ENSURE(false, "TreeImpl: Cannot revert commit: Unexpected node type");
+ OSL_ENSURE(false, "Tree: Cannot revert commit: Unexpected node type");
}
}
//-----------------------------------------------------------------------------
void DeferredViewStrategy::implFailedCommit(Node const& _aNode, SubtreeChange& rSubtreeChange)
{
- OSL_PRECOND( getSimpleNodeName(_aNode).toString() == rSubtreeChange.getNodeName(), "ERROR: Change name does not match node");
+ OSL_PRECOND( getSimpleNodeName(_aNode) == rSubtreeChange.getNodeName(), "ERROR: Change name does not match node");
if (_aNode.isSetNode())
{
@@ -352,12 +347,12 @@ void DeferredViewStrategy::implFailedCommit(Node const& _aNode, SubtreeChange& r
else
{
deferredValueNode(_aNode);
- OSL_ENSURE(false, "TreeImpl: Cannot handle commit failure: Unexpected node type");
+ OSL_ENSURE(false, "Tree: Cannot handle commit failure: Unexpected node type");
}
}
//-----------------------------------------------------------------------------
-void DeferredViewStrategy::implPreCommitSubChanges(GroupNode const & _aGroup, configuration::ElementList& _rRemovedElements, SubtreeChange& _rParentChange)
+void DeferredViewStrategy::implPreCommitSubChanges(GroupNode const & _aGroup, std::vector< rtl::Reference<configuration::ElementTree> >& _rRemovedElements, SubtreeChange& _rParentChange)
{
for( Node aChild = _aGroup.getFirstChild(); aChild.is(); aChild = _aGroup.getNextChild(aChild) )
{
@@ -379,17 +374,17 @@ void DeferredViewStrategy::implFinishSubCommitted(GroupNode const & _aGroup, Sub
it != stop;
++it)
{
- if ( it->ISA(SubtreeChange) )
+ if (dynamic_cast< SubtreeChange * >(&*it) != 0)
{
- Node aChild = _aGroup.findChild( configuration::makeNodeName(it->getNodeName(), Name::NoValidate()) );
+ Node aChild = _aGroup.findChild( it->getNodeName() );
OSL_ENSURE( aChild.is(), "Changed sub-node not found in tree");
this->implFinishCommit(aChild, static_cast<SubtreeChange&>(*it));
}
else
{
- OSL_ENSURE(it->ISA(ValueChange), "Unexpected change type for ínner node; change is ignored");
- OSL_ENSURE(! _aGroup.findChild( configuration::makeNodeName(it->getNodeName(), Name::NoValidate())).is() ,
+ OSL_ENSURE(dynamic_cast< ValueChange * >(&*it) != 0, "Unexpected change type for inner node; change is ignored");
+ OSL_ENSURE(! _aGroup.findChild(it->getNodeName()).is() ,
"Found sub(tree) node where a value was changed");
}
}
@@ -404,17 +399,17 @@ void DeferredViewStrategy::implRevertSubCommitted(GroupNode const & _aGroup, Sub
it != stop;
++it)
{
- if ( it->ISA(SubtreeChange) )
+ if (dynamic_cast< SubtreeChange * >(&*it) != 0)
{
- Node aChild = _aGroup.findChild( configuration::makeNodeName(it->getNodeName(), Name::NoValidate()) );
+ Node aChild = _aGroup.findChild( it->getNodeName() );
OSL_ENSURE( aChild.is(), "Changed sub-node not found in tree");
this->implRevertCommit(aChild, static_cast<SubtreeChange&>(*it));
}
else
{
- OSL_ENSURE(it->ISA(ValueChange), "Unexpected change type for ínner node; change is ignored");
- OSL_ENSURE(! _aGroup.findChild( configuration::makeNodeName(it->getNodeName(), Name::NoValidate())).is() ,
+ OSL_ENSURE(dynamic_cast< ValueChange * >(&*it) != 0, "Unexpected change type for inner node; change is ignored");
+ OSL_ENSURE(! _aGroup.findChild(it->getNodeName()).is() ,
"Found sub(tree) node where a value was changed");
}
}
@@ -429,17 +424,17 @@ void DeferredViewStrategy::implFailedSubCommitted(GroupNode const & _aGroup, Sub
it != stop;
++it)
{
- if ( it->ISA(SubtreeChange) )
+ if (dynamic_cast< SubtreeChange * >(&*it) != 0)
{
- Node aChild = _aGroup.findChild( configuration::makeNodeName(it->getNodeName(), Name::NoValidate()) );
+ Node aChild = _aGroup.findChild( it->getNodeName() );
OSL_ENSURE( aChild.is(), "Changed sub-node not found in tree");
this->implFailedCommit(aChild, static_cast<SubtreeChange&>(*it));
}
else
{
- OSL_ENSURE(it->ISA(ValueChange), "Unexpected change type for ínner node; change is ignored");
- OSL_ENSURE(! _aGroup.findChild( configuration::makeNodeName(it->getNodeName(), Name::NoValidate())).is() ,
+ OSL_ENSURE(dynamic_cast< ValueChange * >(&*it) != 0, "Unexpected change type for inner node; change is ignored");
+ OSL_ENSURE(! _aGroup.findChild(it->getNodeName()).is() ,
"Found sub(tree) node where a value was changed");
}
}
diff --git a/configmgr/source/treemgr/deferredview.hxx b/configmgr/source/treemgr/deferredview.hxx
index b329579ade..4aa90f8513 100644
--- a/configmgr/source/treemgr/deferredview.hxx
+++ b/configmgr/source/treemgr/deferredview.hxx
@@ -59,35 +59,35 @@ namespace configmgr
virtual void doCollectChanges(Node const& _aNode, configuration::NodeChanges& rChanges) const;
// commit protocol
- virtual std::auto_ptr<SubtreeChange> doPreCommitChanges(Tree const& _aTree, configuration::ElementList& _rRemovedElements);
- virtual void doFailedCommit(Tree const& _aTree, SubtreeChange& rChanges);
- virtual void doFinishCommit(Tree const& _aTree, SubtreeChange& rChanges);
- virtual void doRevertCommit(Tree const& _aTree, SubtreeChange& rChanges);
+ virtual std::auto_ptr<SubtreeChange> doPreCommitChanges(configuration::Tree * tree, std::vector< rtl::Reference<configuration::ElementTree> >& _rRemovedElements);
+ virtual void doFailedCommit(configuration::Tree * tree, SubtreeChange& rChanges);
+ virtual void doFinishCommit(configuration::Tree * tree, SubtreeChange& rChanges);
+ virtual void doRevertCommit(configuration::Tree * tree, SubtreeChange& rChanges);
// notification protocol
- virtual configuration::ValueChangeImpl* doAdjustToValueChange(GroupNode const& _aGroupNode, Name const& aName, ValueChange const& rExternalChange);
+ virtual configuration::ValueChangeImpl* doAdjustToValueChange(GroupNode const& _aGroupNode, rtl::OUString const& aName, ValueChange const& rExternalChange);
// virtual void doAdjustToElementChanges(configuration::NodeChangesInformation& rLocalChanges, SetNode const& _aNode, SubtreeChange const& rExternalChanges, TreeDepth nDepth);
// common attributes
virtual node::Attributes doAdjustAttributes(node::Attributes const& _aAttributes) const;
// group member access
- virtual configuration::ValueMemberNode doGetValueMember(GroupNode const& _aNode, Name const& _aName, bool _bForUpdate) const;
+ virtual configuration::ValueMemberNode doGetValueMember(GroupNode const& _aNode, rtl::OUString const& _aName, bool _bForUpdate) const;
// set element access
- virtual void doInsertElement(SetNode const& _aNode, Name const& aName, configuration::SetEntry const& aNewEntry);
- virtual void doRemoveElement(SetNode const& _aNode, Name const& aName);
+ virtual void doInsertElement(SetNode const& _aNode, rtl::OUString const& aName, configuration::SetEntry const& aNewEntry);
+ virtual void doRemoveElement(SetNode const& _aNode, rtl::OUString const& aName);
virtual NodeFactory& doGetNodeFactory();
private:
- void implCollectChangesIn(Node const& _aNode, NodeChanges& rChanges) const;
+ void implCollectChangesIn(Node const& _aNode, configuration::NodeChanges& rChanges) const;
// commit protocol
- std::auto_ptr<SubtreeChange> implPreCommitChanges(Node const& _aNode, configuration::ElementList& _rRemovedElements);
+ std::auto_ptr<SubtreeChange> implPreCommitChanges(Node const& _aNode, std::vector< rtl::Reference<configuration::ElementTree> >& _rRemovedElements);
void implFailedCommit(Node const& _aNode, SubtreeChange& rChanges);
void implFinishCommit(Node const& _aNode, SubtreeChange& rChanges);
void implRevertCommit(Node const& _aNode, SubtreeChange& rChanges);
- void implPreCommitSubChanges(GroupNode const & _aGroup, configuration::ElementList& _rRemovedElements, SubtreeChange& _rParentChange);
+ void implPreCommitSubChanges(GroupNode const & _aGroup, std::vector< rtl::Reference<configuration::ElementTree> >& _rRemovedElements, SubtreeChange& _rParentChange);
void implFailedSubCommitted(GroupNode const & _aGroup, SubtreeChange& rChanges);
void implFinishSubCommitted(GroupNode const & _aGroup, SubtreeChange& rChanges);
void implRevertSubCommitted(GroupNode const & _aGroup, SubtreeChange& rChanges);
diff --git a/configmgr/source/treemgr/directview.cxx b/configmgr/source/treemgr/directview.cxx
index 02a2a02a29..16737a23a1 100644
--- a/configmgr/source/treemgr/directview.cxx
+++ b/configmgr/source/treemgr/directview.cxx
@@ -34,7 +34,6 @@
#include "directview.hxx"
#include "viewfactory.hxx"
#include "setnodeimpl.hxx"
-#include "setnodeaccess.hxx"
namespace configmgr
{
@@ -44,13 +43,13 @@ namespace configmgr
void DirectViewStrategy::implMarkNondefault(SetNode const& _aSetNode)
{
- data::SetNodeAccess aSetAccess = _aSetNode.getAccess();
+ sharable::SetNode * set = _aSetNode.getAccess();
- OSL_ASSERT(aSetAccess.isValid());
+ OSL_ASSERT(set != 0);
sharable::SetNode* pNode = NULL;
if (m_aTreeSegment.is())
- pNode = aSetAccess;
+ pNode = set;
OSL_ASSERT(pNode);
@@ -81,18 +80,18 @@ node::Attributes DirectViewStrategy::doAdjustAttributes(node::Attributes const&
}
//-----------------------------------------------------------------------------
-configuration::ValueMemberNode DirectViewStrategy::doGetValueMember(GroupNode const& _aNode, Name const& _aName, bool _bForUpdate) const
+configuration::ValueMemberNode DirectViewStrategy::doGetValueMember(GroupNode const& _aNode, rtl::OUString const& _aName, bool _bForUpdate) const
{
return ViewStrategy::doGetValueMember(_aNode,_aName,_bForUpdate);
}
//-----------------------------------------------------------------------------
-void DirectViewStrategy::doInsertElement(SetNode const& _aNode, Name const& _aName, SetNodeEntry const& _aNewEntry)
+void DirectViewStrategy::doInsertElement(SetNode const& _aNode, rtl::OUString const& _aName, configuration::SetEntry const& _aNewEntry)
{
// move to this memory segment
// should already be direct (as any free-floating one)
//implMakeElement(aNewEntry)
- SetNodeElement aNewElement = implMakeElement(_aNode, _aNewEntry );
+ configuration::ElementTreeData aNewElement = implMakeElement(_aNode, _aNewEntry );
// _aNewEntry.tree()->rebuild(this, _aNode.accessor());
_aNode.get_impl()->insertElement(_aName, aNewElement);
@@ -103,9 +102,9 @@ void DirectViewStrategy::doInsertElement(SetNode const& _aNode, Name const& _aNa
}
//-----------------------------------------------------------------------------
-void DirectViewStrategy::doRemoveElement(SetNode const& _aNode, Name const& _aName)
+void DirectViewStrategy::doRemoveElement(SetNode const& _aNode, rtl::OUString const& _aName)
{
- SetNodeElement aOldElement = _aNode.get_impl()->removeElement(_aName);
+ configuration::ElementTreeData aOldElement = _aNode.get_impl()->removeElement(_aName);
aOldElement->detachFrom( _aNode.getAccess(), _aName);
@@ -121,7 +120,7 @@ NodeFactory& DirectViewStrategy::doGetNodeFactory()
}
//-----------------------------------------------------------------------------
-ViewStrategyRef createDirectAccessStrategy(data::TreeSegment const & _aTreeSegment)
+rtl::Reference<ViewStrategy> createDirectAccessStrategy(rtl::Reference< data::TreeSegment > const & _aTreeSegment)
{
return new DirectViewStrategy(_aTreeSegment);
}
diff --git a/configmgr/source/treemgr/directview.hxx b/configmgr/source/treemgr/directview.hxx
index 4a14dde93e..473f09730e 100644
--- a/configmgr/source/treemgr/directview.hxx
+++ b/configmgr/source/treemgr/directview.hxx
@@ -44,10 +44,10 @@ namespace configmgr
class DirectViewStrategy : public ViewStrategy
{
- data::TreeSegment m_aTreeSegment;
+ rtl::Reference< data::TreeSegment > m_aTreeSegment;
public:
explicit
- DirectViewStrategy(data::TreeSegment const & _aTreeSegment)
+ DirectViewStrategy(rtl::Reference< data::TreeSegment > const & _aTreeSegment)
: m_aTreeSegment(_aTreeSegment)
{}
@@ -60,11 +60,11 @@ namespace configmgr
virtual node::Attributes doAdjustAttributes(node::Attributes const& _aAttributes) const;
// group member access
- virtual ValueMemberNode doGetValueMember(GroupNode const& _aNode, Name const& _aName, bool _bForUpdate) const;
+ virtual configuration::ValueMemberNode doGetValueMember(GroupNode const& _aNode, rtl::OUString const& _aName, bool _bForUpdate) const;
// set element access
- virtual void doInsertElement(SetNode const& _aNode, Name const& aName, SetNodeEntry const& aNewEntry);
- virtual void doRemoveElement(SetNode const& _aNode, Name const& aName);
+ virtual void doInsertElement(SetNode const& _aNode, rtl::OUString const& aName, configuration::SetEntry const& aNewEntry);
+ virtual void doRemoveElement(SetNode const& _aNode, rtl::OUString const& aName);
virtual NodeFactory& doGetNodeFactory();
diff --git a/configmgr/source/treemgr/groupnodeimpl.hxx b/configmgr/source/treemgr/groupnodeimpl.hxx
index 90b7578945..cf9d9ac6d8 100644
--- a/configmgr/source/treemgr/groupnodeimpl.hxx
+++ b/configmgr/source/treemgr/groupnodeimpl.hxx
@@ -44,22 +44,10 @@ namespace configmgr
//-----------------------------------------------------------------------------
class SubtreeChange;
class ValueChange;
-//-----------------------------------------------------------------------------
-
- namespace data
- {
- class GroupNodeAccess;
- class ValueNodeAccess;
- }
-//-----------------------------------------------------------------------------
namespace configuration
{
//-----------------------------------------------------------------------------
- typedef com::sun::star::uno::Any UnoAny;
- typedef com::sun::star::uno::Type UnoType;
-
- class Name;
class ValueChangeImpl;
//-----------------------------------------------------------------------------
// a visitor
@@ -80,15 +68,15 @@ namespace configmgr
{
mutable sharable::Node *m_pCache;
public:
- explicit GroupNodeImpl(data::GroupNodeAddress _pNodeRef);
+ explicit GroupNodeImpl(sharable::GroupNode * _pNodeRef);
- data::GroupNodeAccess getDataAccess() const;
+ sharable::GroupNode * getDataAccess() const;
bool areValueDefaultsAvailable() const;
- data::ValueNodeAccess getOriginalValueNode(Name const& aName) const;
+ sharable::ValueNode * getOriginalValueNode(rtl::OUString const& aName) const;
- ValueMemberNode makeValueMember(data::ValueNodeAccess const& _aValueNode);
+ ValueMemberNode makeValueMember(sharable::ValueNode * node);
};
//-----------------------------------------------------------------------------
diff --git a/configmgr/source/treemgr/nodechange.cxx b/configmgr/source/treemgr/nodechange.cxx
index 23ca80592d..139838976f 100644
--- a/configmgr/source/treemgr/nodechange.cxx
+++ b/configmgr/source/treemgr/nodechange.cxx
@@ -36,7 +36,7 @@
#include "nodechangeinfo.hxx"
#include "noderef.hxx"
-#include "treeimpl.hxx"
+#include "tree.hxx"
#include <algorithm>
#include <osl/diagnose.h>
@@ -117,9 +117,9 @@ sal_uInt32 NodeChange::getChangeInfos(NodeChangesInformation& _rInfos) const
sal_uInt32 nCount = 0;
if (m_pImpl)
{
- NodeChangeImpl::ChangeCount nChanges = m_pImpl->getChangeDataCount();
+ sal_uInt32 nChanges = m_pImpl->getChangeDataCount();
- for (NodeChangeImpl::ChangeCount ix = 0; ix < nChanges; ++ix)
+ for (sal_uInt32 ix = 0; ix < nChanges; ++ix)
{
NodeChangeInformation aSingleInfo;
aSingleInfo.change.type = NodeChangeData::eNoChange;
@@ -144,34 +144,34 @@ bool NodeChange::getChangeLocation(NodeChangeLocation& rLoc) const
}
//-----------------------------------------------------------------------------
-Tree NodeChange::getBaseTree() const
+rtl::Reference< Tree > NodeChange::getBaseTree() const
{
- return Tree(m_pImpl->getTargetTree().get());
+ return m_pImpl->getTargetTree().get();
}
//-----------------------------------------------------------------------------
// retrieve the tree where the change is actually taking place
NodeRef NodeChange::getBaseNode() const
{
- TreeHolder aTree = m_pImpl->getTargetTree();
- NodeOffset nOffset = m_pImpl->getTargetNode();
+ rtl::Reference<Tree> aTree = m_pImpl->getTargetTree();
+ unsigned int nOffset = m_pImpl->getTargetNode();
OSL_ASSERT(aTree.is() && aTree->isValidNode(nOffset));
if (aTree.is() && nOffset)
- return TreeImplHelper::makeNode(*aTree,nOffset);
+ return aTree->getNode(nOffset);
return NodeRef();
}
//-----------------------------------------------------------------------------
// retrieve the tree where the change is actually taking place
-Tree NodeChange::getAffectedTree() const
+rtl::Reference< Tree > NodeChange::getAffectedTree() const
{
if (this->maybeChange())
- return Tree(m_pImpl->getTargetTree().get());
+ return m_pImpl->getTargetTree().get();
else
- return Tree(NULL);
+ return NULL;
}
//-----------------------------------------------------------------------------
@@ -180,13 +180,13 @@ NodeRef NodeChange::getAffectedNode() const
{
if (this->maybeChange())
{
- TreeHolder aTree = m_pImpl->getTargetTree();
- NodeOffset nOffset = m_pImpl->getTargetNode();
+ rtl::Reference<Tree> aTree = m_pImpl->getTargetTree();
+ unsigned int nOffset = m_pImpl->getTargetNode();
OSL_ASSERT(aTree.is() && aTree->isValidNode(nOffset));
if (aTree.is() && nOffset)
- return TreeImplHelper::makeNode(*aTree,nOffset );
+ return aTree->getNode(nOffset);
}
return NodeRef();
}
@@ -194,8 +194,8 @@ NodeRef NodeChange::getAffectedNode() const
NodeID NodeChange::getAffectedNodeID() const
{
- TreeHolder aTree = m_pImpl->getTargetTree();
- NodeOffset nOffset = m_pImpl->getTargetNode();
+ rtl::Reference<Tree> aTree = m_pImpl->getTargetTree();
+ unsigned int nOffset = m_pImpl->getTargetNode();
OSL_ASSERT(aTree.is() ? aTree->isValidNode(nOffset) : 0==nOffset);
@@ -264,7 +264,7 @@ NodeChanges& NodeChanges::compact()
void NodeChanges::implTest() const
{
- for(Iterator it = begin(), stop = end(); it != stop; ++it)
+ for(std::vector<NodeChange>::const_iterator it = begin(), stop = end(); it != stop; ++it)
{
it ->test();
}
@@ -272,18 +272,12 @@ void NodeChanges::implTest() const
//-----------------------------------------------------------------------------
void NodeChanges::implApply() const
{
- for(Iterator it = begin(), stop = end(); it != stop; ++it)
+ for(std::vector<NodeChange>::const_iterator it = begin(), stop = end(); it != stop; ++it)
{
it ->apply();
}
}
//-----------------------------------------------------------------------------
-/// gets the nearest common ancestor node of all changes this tree
-//Node getBaseNode() const;
-
-/// gets the tree the base node belongs to, if available
-//Tree getBaseTree() const;
-
/** insert a change into this collection
*/
void NodeChanges::add(NodeChange const& aChange)
@@ -313,7 +307,7 @@ sal_uInt32 NodeChanges::getChangesInfos(NodeChangesInformation& _rInfos) const
_rInfos.reserve(_rInfos.size() + this->getCount());
sal_Int32 nResult = 0;
- for (Iterator it = begin(); it != end(); ++it)
+ for (std::vector<NodeChange>::const_iterator it = begin(); it != end(); ++it)
{
nResult += it->getChangeInfos(_rInfos);
}
diff --git a/configmgr/source/treemgr/nodechangeimpl.cxx b/configmgr/source/treemgr/nodechangeimpl.cxx
index 096411d631..aa049fa600 100644
--- a/configmgr/source/treemgr/nodechangeimpl.cxx
+++ b/configmgr/source/treemgr/nodechangeimpl.cxx
@@ -34,7 +34,7 @@
#include "nodechangeimpl.hxx"
#include "nodechangeinfo.hxx"
#include "nodeimpl.hxx"
-#include "treeimpl.hxx"
+#include "tree.hxx"
#include "configset.hxx"
#include "setnodeimpl.hxx"
#include "groupnodeimpl.hxx"
@@ -68,22 +68,22 @@ view::ViewTreeAccess NodeChangeImpl::getTargetView()
{
OSL_ENSURE( m_aAffectedTree.is(), "ERROR: Configuration Change: Target Tree Access has not been set up" );
- return Tree(m_aAffectedTree.get()).getView();
+ return view::ViewTreeAccess(m_aAffectedTree.get());
}
//-----------------------------------------------------------------------------
-TreeHolder NodeChangeImpl::getTargetTree() const
+rtl::Reference<Tree> NodeChangeImpl::getTargetTree() const
{
- TreeHolder aRet = m_aAffectedTree;
+ rtl::Reference<Tree> aRet = m_aAffectedTree;
OSL_ENSURE( aRet.is(), "ERROR: Configuration Change: Target Tree has not been set up" );
return aRet;
}
//-----------------------------------------------------------------------------
-NodeOffset NodeChangeImpl::getTargetNode() const
+unsigned int NodeChangeImpl::getTargetNode() const
{
- NodeOffset nRet = m_nAffectedNode;
+ unsigned int nRet = m_nAffectedNode;
OSL_ENSURE( nRet != 0, "ERROR: Configuration Change: Target Node has not been set up" );
OSL_ENSURE( m_aAffectedTree.is() && m_aAffectedTree->isValidNode(nRet),
"ERROR: Configuration Change: Changing Node does not match tree" );
@@ -94,10 +94,10 @@ NodeOffset NodeChangeImpl::getTargetNode() const
void NodeChangeImpl::setTarget(view::Node _aAffectedNode)
{
- this->setTarget(_aAffectedNode.tree().get_impl(), _aAffectedNode.get_offset());
+ this->setTarget(_aAffectedNode.tree(), _aAffectedNode.get_offset());
}
-void NodeChangeImpl::setTarget(TreeHolder const& _aAffectedTree, NodeOffset _nAffectedNode)
+void NodeChangeImpl::setTarget(rtl::Reference<Tree> const& _aAffectedTree, unsigned int _nAffectedNode)
{
OSL_ENSURE(m_nState == 0 || (!m_aAffectedTree.is() && m_nState == eNoCheck), "WARNING: Configuration: Retargeting change that already was tested or applied");
@@ -126,7 +126,7 @@ bool NodeChangeImpl::isChange(bool bAllowUntested) const
}
//-----------------------------------------------------------------------------
-NodeChangeImpl::ChangeCount NodeChangeImpl::getChangeDataCount() const
+sal_uInt32 NodeChangeImpl::getChangeDataCount() const
{
OSL_PRECOND(m_nState & eTestedChange, "WARNING: Configuration: Change was not tested - change data count may be incorrect");
@@ -134,7 +134,7 @@ NodeChangeImpl::ChangeCount NodeChangeImpl::getChangeDataCount() const
}
//-----------------------------------------------------------------------------
-bool NodeChangeImpl::fillChangeData(NodeChangeData& rChange, ChangeCount _ix) const
+bool NodeChangeImpl::fillChangeData(NodeChangeData& rChange, sal_uInt32 _ix) const
{
OSL_PRECOND(_ix < doGetChangeCount(), "ERROR: Configuration: Change index out of range");
OSL_PRECOND(m_nState & eTestedChange, "WARNING: Configuration: Change was not tested - fillChange is partially meaningless");
@@ -143,7 +143,7 @@ bool NodeChangeImpl::fillChangeData(NodeChangeData& rChange, ChangeCount _ix) co
}
//-----------------------------------------------------------------------------
-bool NodeChangeImpl::fillChangeLocation(NodeChangeLocation& rChange, ChangeCount _ix) const
+bool NodeChangeImpl::fillChangeLocation(NodeChangeLocation& rChange, sal_uInt32 _ix) const
{
if (!m_aAffectedTree.is()) return false;
@@ -159,7 +159,7 @@ bool NodeChangeImpl::fillChangeLocation(NodeChangeLocation& rChange, ChangeCount
}
//-----------------------------------------------------------------------------
-bool NodeChangeImpl::fillChangeInfo(NodeChangeInformation& rChange, ChangeCount _ix) const
+bool NodeChangeImpl::fillChangeInfo(NodeChangeInformation& rChange, sal_uInt32 _ix) const
{
return fillChangeLocation(rChange.location, _ix) & fillChangeData(rChange.change, _ix);
}
@@ -190,7 +190,7 @@ void NodeChangeImpl::apply()
//-----------------------------------------------------------------------------
// default count is 1
-NodeChangeImpl::ChangeCount NodeChangeImpl::doGetChangeCount() const
+sal_uInt32 NodeChangeImpl::doGetChangeCount() const
{
return 1;
}
@@ -237,14 +237,14 @@ ValueChangeImpl::ValueChangeImpl()
}
//-----------------------------------------------------------------------------
-ValueChangeImpl::ValueChangeImpl(UnoAny const& aNewValue)
+ValueChangeImpl::ValueChangeImpl(com::sun::star::uno::Any const& aNewValue)
: m_aNewValue(aNewValue)
, m_aOldValue()
{
}
//-----------------------------------------------------------------------------
-ValueChangeImpl::ValueChangeImpl(UnoAny const& aNewValue, UnoAny const& aOldValue)
+ValueChangeImpl::ValueChangeImpl(com::sun::star::uno::Any const& aNewValue, com::sun::star::uno::Any const& aOldValue)
: NodeChangeImpl(true)
, m_aNewValue(aNewValue)
, m_aOldValue(aOldValue)
@@ -257,25 +257,25 @@ ValueChangeImpl::~ValueChangeImpl()
}
//-----------------------------------------------------------------------------
-void ValueChangeImpl::setTarget(view::GroupNode const& _aParentNode, Name const& sNodeName)
+void ValueChangeImpl::setTarget(view::GroupNode const& _aParentNode, rtl::OUString const& sNodeName)
{
- OSL_ENSURE(!sNodeName.isEmpty(), "ValueChangeTarget is being set without a name");
+ OSL_ENSURE(sNodeName.getLength() != 0, "ValueChangeTarget is being set without a name");
NodeChangeImpl::setTarget(_aParentNode.node());
m_aName = sNodeName;
}
//-----------------------------------------------------------------------------
-void ValueChangeImpl::setTarget(TreeHolder const& aAffectedTree, NodeOffset nParentNode, Name const& sNodeName)
+void ValueChangeImpl::setTarget(rtl::Reference<Tree> const& aAffectedTree, unsigned int nParentNode, rtl::OUString const& sNodeName)
{
- OSL_ENSURE(!sNodeName.isEmpty(), "ValueChangeTarget is being set without a name");
+ OSL_ENSURE(sNodeName.getLength() != 0, "ValueChangeTarget is being set without a name");
NodeChangeImpl::setTarget(aAffectedTree,nParentNode);
m_aName = sNodeName;
}
//-----------------------------------------------------------------------------
-RelativePath ValueChangeImpl::doGetChangingNodePath(ChangeCount ) const
+RelativePath ValueChangeImpl::doGetChangingNodePath(sal_uInt32 ) const
{
return RelativePath( Path::wrapSimpleName(m_aName) );
}
@@ -283,7 +283,7 @@ RelativePath ValueChangeImpl::doGetChangingNodePath(ChangeCount ) const
bool ValueChangeImpl::doIsChangingSubnode() const
{
- return ! m_aName.isEmpty();
+ return m_aName.getLength() != 0;
}
//-----------------------------------------------------------------------------
@@ -293,7 +293,7 @@ bool ValueChangeImpl::doIsChange() const
}
//-----------------------------------------------------------------------------
-bool ValueChangeImpl::doFillChange(NodeChangeData& rChange, ChangeCount) const
+bool ValueChangeImpl::doFillChange(NodeChangeData& rChange, sal_uInt32) const
{
rChange.unoData.newValue = getNewValue();
rChange.unoData.oldValue = getOldValue();
@@ -331,17 +331,17 @@ void ValueChangeImpl::doApply( view::Node const& rTarget)
}
//-----------------------------------------------------------------------------
-void ValueChangeImpl::preCheckValue(ValueMemberNode& rNode, UnoAny& rOld, UnoAny& )
+void ValueChangeImpl::preCheckValue(ValueMemberNode& rNode, com::sun::star::uno::Any& rOld, com::sun::star::uno::Any& )
{
- UnoAny aPrevValue = rNode.getValue();
+ com::sun::star::uno::Any aPrevValue = rNode.getValue();
OSL_ENSURE(!rOld.hasValue() || rOld == aPrevValue, "ERROR: Configuration: Stored old value of target does not match the actual value");
rOld = aPrevValue;
}
//-----------------------------------------------------------------------------
-void ValueChangeImpl::postCheckValue(ValueMemberNode& rNode, UnoAny& rNew)
+void ValueChangeImpl::postCheckValue(ValueMemberNode& rNode, com::sun::star::uno::Any& rNew)
{
- UnoAny aResultValue = rNode.getValue();
+ com::sun::star::uno::Any aResultValue = rNode.getValue();
OSL_ENSURE(!rNew.hasValue() || rNew == aResultValue, "ERROR: Configuration: New value of target does not match the predicted result");
rNew = aResultValue;
}
@@ -351,13 +351,13 @@ void ValueChangeImpl::postCheckValue(ValueMemberNode& rNode, UnoAny& rNew)
// Value operations: ValueReplaceImpl = set local value
//-----------------------------------------------------------------------------
-ValueReplaceImpl::ValueReplaceImpl(UnoAny const& aNewValue)
+ValueReplaceImpl::ValueReplaceImpl(com::sun::star::uno::Any const& aNewValue)
:ValueChangeImpl(aNewValue)
{
}
//-----------------------------------------------------------------------------
-ValueReplaceImpl::ValueReplaceImpl(UnoAny const& aNewValue, UnoAny const& aOldValue)
+ValueReplaceImpl::ValueReplaceImpl(com::sun::star::uno::Any const& aNewValue, com::sun::star::uno::Any const& aOldValue)
:ValueChangeImpl(aNewValue, aOldValue)
{
}
@@ -369,7 +369,7 @@ void ValueReplaceImpl::doApplyChange( ValueMemberUpdate& rNode)
}
//-----------------------------------------------------------------------------
-bool ValueReplaceImpl::doFillChange( NodeChangeData& rChange, ChangeCount _ix) const
+bool ValueReplaceImpl::doFillChange( NodeChangeData& rChange, sal_uInt32 _ix) const
{
rChange.type = NodeChangeData::eSetValue;
return ValueChangeImpl::doFillChange(rChange, _ix);
@@ -386,7 +386,7 @@ ValueResetImpl::ValueResetImpl()
}
//-----------------------------------------------------------------------------
-ValueResetImpl::ValueResetImpl(UnoAny const& aNewValue, UnoAny const& aOldValue)
+ValueResetImpl::ValueResetImpl(com::sun::star::uno::Any const& aNewValue, com::sun::star::uno::Any const& aOldValue)
:ValueChangeImpl(aNewValue, aOldValue)
, m_bTargetIsDefault(false)
{
@@ -405,7 +405,7 @@ bool ValueResetImpl::doIsChange() const
}
//-----------------------------------------------------------------------------
-bool ValueResetImpl::doFillChange( NodeChangeData& rChange, ChangeCount _ix) const
+bool ValueResetImpl::doFillChange( NodeChangeData& rChange, sal_uInt32 _ix) const
{
rChange.type = NodeChangeData::eSetDefault;
ValueChangeImpl::doFillChange(rChange,_ix);
@@ -413,11 +413,11 @@ bool ValueResetImpl::doFillChange( NodeChangeData& rChange, ChangeCount _ix) con
}
//-----------------------------------------------------------------------------
-void ValueResetImpl::preCheckValue(ValueMemberNode& rNode, UnoAny& rOld, UnoAny& rNew)
+void ValueResetImpl::preCheckValue(ValueMemberNode& rNode, com::sun::star::uno::Any& rOld, com::sun::star::uno::Any& rNew)
{
ValueChangeImpl::preCheckValue(rNode,rOld,rNew);
- UnoAny aDefaultValue = rNode.getDefaultValue();
+ com::sun::star::uno::Any aDefaultValue = rNode.getDefaultValue();
OSL_ENSURE(!rNew.hasValue() || rNew == aDefaultValue, "ERROR: Configuration: Stored new value of target does not match the actual default value");
rNew = aDefaultValue;
m_bTargetIsDefault = rNode.isDefault();
@@ -460,7 +460,7 @@ SetResetImpl::~SetResetImpl()
}
//-----------------------------------------------------------------------------
-RelativePath SetResetImpl::doGetChangingNodePath(ChangeCount _ix) const
+RelativePath SetResetImpl::doGetChangingNodePath(sal_uInt32 _ix) const
{
OSL_ENSURE( _ix < m_aTreeChanges.size() || _ix == scCommonBase, "Illegal Change index" );
OSL_ASSERT( static_cast<size_t>(scCommonBase) > m_aTreeChanges.size() );
@@ -494,7 +494,7 @@ bool SetResetImpl::doIsChange() const
}
//-----------------------------------------------------------------------------
-bool SetResetImpl::doFillChange(NodeChangeData& rChange, ChangeCount _ix) const
+bool SetResetImpl::doFillChange(NodeChangeData& rChange, sal_uInt32 _ix) const
{
OSL_ENSURE( _ix < m_aTreeChanges.size() || _ix == scCommonBase, "Illegal Change index" );
if (_ix >= m_aTreeChanges.size())
@@ -530,19 +530,18 @@ void SetResetImpl::doTest( view::Node const& rTarget)
it != stop;
++it)
{
- Name aName = makeElementName(it->getNodeName(), Name::NoValidate());
+ rtl::OUString aName(it->getNodeName());
SetEntry anExistingEntry = accessor.findElement(aTargetSet,aName);
- ElementTreeHolder aOldTree = anExistingEntry.tree();
- ElementTreeHolder aNewTree;
+ rtl::Reference<ElementTree> aOldTree = anExistingEntry.tree();
+ rtl::Reference<ElementTree> aNewTree;
- if (it->ISA(AddNode))
+ if (AddNode * addNode = dynamic_cast< AddNode * >(&*it))
{
- AddNode& rAddNode = static_cast<AddNode&>(*it);
- data::TreeSegment pAddedNode = rAddNode.getNewTree();
+ rtl::Reference< data::TreeSegment > pAddedNode = addNode->getNewTree();
- OSL_ENSURE(pAddedNode.is(),"Processing an addNode to default - no node to add");
+ OSL_ENSURE(pAddedNode.is(), "Processing an addNode to default - no node to add");
aNewTree = m_rElementFactory.instantiateOnDefault(pAddedNode,accessor.getElementTemplate(aTargetSet)).get();
}
@@ -566,15 +565,13 @@ void SetResetImpl::doTest( view::Node const& rTarget)
void SetResetImpl::doApply( view::Node const& rTarget)
{
- typedef TreeChanges::iterator Iter;
-
view::ViewTreeAccess accessor = this->getTargetView();
view::SetNode aTargetSet(rTarget);
- for (Iter it = m_aTreeChanges.begin(); it != m_aTreeChanges.end(); ++it)
+ for (std::vector< ElementTreeChange >::iterator it = m_aTreeChanges.begin(); it != m_aTreeChanges.end(); ++it)
{
- Name aElementName = it->m_aElementName.getName();
+ rtl::OUString aElementName = it->m_aElementName.getName();
if (it->m_aRemovedElement.is())
accessor.removeElement(aTargetSet, aElementName);
@@ -601,7 +598,7 @@ SetElementChangeImpl::SetElementChangeImpl(Path::Component const& aName, bool bN
}
//-----------------------------------------------------------------------------
-RelativePath SetElementChangeImpl::doGetChangingNodePath(ChangeCount ) const
+RelativePath SetElementChangeImpl::doGetChangingNodePath(sal_uInt32 ) const
{
return RelativePath(getFullElementName());
}
@@ -622,7 +619,7 @@ void SetElementChangeImpl::doApply( view::Node const& rTarget)
// Full Sets: SetInsertTreeImpl
//-----------------------------------------------------------------------------
-SetInsertImpl::SetInsertImpl(Path::Component const& aName, ElementTreeHolder const& aNewTree, bool bNoCheck)
+SetInsertImpl::SetInsertImpl(Path::Component const& aName, rtl::Reference<ElementTree> const& aNewTree, bool bNoCheck)
: SetElementChangeImpl(aName,bNoCheck)
, m_aNewTree(aNewTree)
{
@@ -635,7 +632,7 @@ bool SetInsertImpl::doIsChange() const
}
//-----------------------------------------------------------------------------
-bool SetInsertImpl::doFillChange(NodeChangeData& rChange, ChangeCount) const
+bool SetInsertImpl::doFillChange(NodeChangeData& rChange, sal_uInt32) const
{
rChange.type = NodeChangeData::eInsertElement;
if (m_aNewTree.is())
@@ -645,14 +642,14 @@ bool SetInsertImpl::doFillChange(NodeChangeData& rChange, ChangeCount) const
}
//-----------------------------------------------------------------------------
-void SetInsertImpl::doTestElement( view::SetNode const& _aNode, Name const& aName)
+void SetInsertImpl::doTestElement( view::SetNode const& _aNode, rtl::OUString const& aName)
{
SetEntry anEntry = getTargetView().findElement(_aNode,aName); // require loaded children
OSL_ENSURE(!anEntry.isValid(), "ERROR: Configuration: Adding a node that already exists");
}
//-----------------------------------------------------------------------------
-void SetInsertImpl::doApplyToElement( view::SetNode const& _aNode, Name const& aName)
+void SetInsertImpl::doApplyToElement( view::SetNode const& _aNode, rtl::OUString const& aName)
{
if (m_aNewTree.is())
{
@@ -665,7 +662,7 @@ void SetInsertImpl::doApplyToElement( view::SetNode const& _aNode, Name const& a
// Full Sets: SetReplaceTreeImpl
//-----------------------------------------------------------------------------
-SetReplaceImpl::SetReplaceImpl(Path::Component const& aName, ElementTreeHolder const& aNewTree)
+SetReplaceImpl::SetReplaceImpl(Path::Component const& aName, rtl::Reference<ElementTree> const& aNewTree)
: SetElementChangeImpl(aName)
, m_aNewTree(aNewTree)
, m_aOldTree()
@@ -673,7 +670,7 @@ SetReplaceImpl::SetReplaceImpl(Path::Component const& aName, ElementTreeHolder c
}
//-----------------------------------------------------------------------------
-SetReplaceImpl::SetReplaceImpl(Path::Component const& aName, ElementTreeHolder const& aNewTree, ElementTreeHolder const& aOldTree)
+SetReplaceImpl::SetReplaceImpl(Path::Component const& aName, rtl::Reference<ElementTree> const& aNewTree, rtl::Reference<ElementTree> const& aOldTree)
: SetElementChangeImpl(aName,true)
, m_aNewTree(aNewTree)
, m_aOldTree(aOldTree)
@@ -689,7 +686,7 @@ bool SetReplaceImpl::doIsChange() const
//-----------------------------------------------------------------------------
/// fills in pre- and post-change values, returns wether they differ
-bool SetReplaceImpl::doFillChange(NodeChangeData& rChange, ChangeCount) const
+bool SetReplaceImpl::doFillChange(NodeChangeData& rChange, sal_uInt32) const
{
rChange.type = NodeChangeData::eReplaceElement;
if (m_aNewTree.is())
@@ -702,7 +699,7 @@ bool SetReplaceImpl::doFillChange(NodeChangeData& rChange, ChangeCount) const
}
//-----------------------------------------------------------------------------
-void SetReplaceImpl::doTestElement( view::SetNode const& _aNode, Name const& aName)
+void SetReplaceImpl::doTestElement( view::SetNode const& _aNode, rtl::OUString const& aName)
{
OSL_ASSERT(!m_aOldTree.is()); // already tested ?
@@ -714,7 +711,7 @@ void SetReplaceImpl::doTestElement( view::SetNode const& _aNode, Name const& aNa
}
//-----------------------------------------------------------------------------
-void SetReplaceImpl::doApplyToElement( view::SetNode const& _aNode, Name const& aName)
+void SetReplaceImpl::doApplyToElement( view::SetNode const& _aNode, rtl::OUString const& aName)
{
if (m_aOldTree != m_aNewTree)
{
@@ -744,7 +741,7 @@ SetRemoveImpl::SetRemoveImpl(Path::Component const& aName)
}
//-----------------------------------------------------------------------------
-SetRemoveImpl::SetRemoveImpl(Path::Component const& aName, ElementTreeHolder const& aOldTree)
+SetRemoveImpl::SetRemoveImpl(Path::Component const& aName, rtl::Reference<ElementTree> const& aOldTree)
: SetElementChangeImpl(aName,true)
, m_aOldTree(aOldTree)
{
@@ -759,7 +756,7 @@ bool SetRemoveImpl::doIsChange() const
//-----------------------------------------------------------------------------
/// fills in pre- and post-change values, returns wether they differ
-bool SetRemoveImpl::doFillChange(NodeChangeData& rChange, ChangeCount) const
+bool SetRemoveImpl::doFillChange(NodeChangeData& rChange, sal_uInt32) const
{
rChange.type = NodeChangeData::eRemoveElement;
if (m_aOldTree.is())
@@ -769,7 +766,7 @@ bool SetRemoveImpl::doFillChange(NodeChangeData& rChange, ChangeCount) const
}
//-----------------------------------------------------------------------------
-void SetRemoveImpl::doTestElement( view::SetNode const& _aNode, Name const& aName)
+void SetRemoveImpl::doTestElement( view::SetNode const& _aNode, rtl::OUString const& aName)
{
OSL_ASSERT(!m_aOldTree.is()); // already tested ?
@@ -781,7 +778,7 @@ void SetRemoveImpl::doTestElement( view::SetNode const& _aNode, Name const& aNam
}
//-----------------------------------------------------------------------------
-void SetRemoveImpl::doApplyToElement( view::SetNode const& _aNode, Name const& aName)
+void SetRemoveImpl::doApplyToElement( view::SetNode const& _aNode, rtl::OUString const& aName)
{
getTargetView().removeElement(_aNode, aName);
}
diff --git a/configmgr/source/treemgr/nodechangeimpl.hxx b/configmgr/source/treemgr/nodechangeimpl.hxx
index 12c8f3883a..5040b7d214 100644
--- a/configmgr/source/treemgr/nodechangeimpl.hxx
+++ b/configmgr/source/treemgr/nodechangeimpl.hxx
@@ -35,6 +35,7 @@
#include "configpath.hxx"
#include "viewaccess.hxx"
#include <rtl/ref.hxx>
+#include <salhelper/simplereferenceobject.hxx>
#include "utility.hxx"
#ifndef INCLUDED_VECTOR
@@ -57,10 +58,6 @@ namespace configmgr
{
//-----------------------------------------------------------------------------
- typedef com::sun::star::uno::Type UnoType;
- typedef com::sun::star::uno::Any UnoAny;
-//-----------------------------------------------------------------------------
-
class ValueMemberNode;
class ValueMemberUpdate;
//-----------------------------------------------------------------------------
@@ -68,20 +65,16 @@ namespace configmgr
class NodeChangeLocation;
class NodeChangeInformation;
//-----------------------------------------------------------------------------
-
- typedef rtl::Reference<TreeImpl> TreeHolder;
- typedef rtl::Reference<ElementTreeImpl> ElementTreeHolder;
-//-----------------------------------------------------------------------------
struct ElementTreeChange
{
Path::Component m_aElementName;
- ElementTreeHolder m_aAddedElement;
- ElementTreeHolder m_aRemovedElement;
+ rtl::Reference<ElementTree> m_aAddedElement;
+ rtl::Reference<ElementTree> m_aRemovedElement;
ElementTreeChange(
Path::Component const& _aElementName,
- ElementTreeHolder const& _aAddedElement,
- ElementTreeHolder const& _aRemovedElement
+ rtl::Reference<ElementTree> const& _aAddedElement,
+ rtl::Reference<ElementTree> const& _aRemovedElement
)
: m_aElementName(_aElementName)
, m_aAddedElement(_aAddedElement)
@@ -98,7 +91,7 @@ namespace configmgr
/// represents a node position in some tree
class NodeChangeImpl
- : public configmgr::SimpleReferenceObject
+ : public salhelper::SimpleReferenceObject
{
public:
explicit
@@ -107,36 +100,35 @@ namespace configmgr
public:
// related/affected nodes and trees
/// the tree within which the change occurs
- TreeHolder getTargetTree() const;
+ rtl::Reference<Tree> getTargetTree() const;
/// the node that is affected by the change
- NodeOffset getTargetNode() const;
+ unsigned int getTargetNode() const;
protected:
/// setup the 'target' node that is to be affected or changed
- void setTarget(TreeHolder const& _aAffectedTree, NodeOffset _nAffectedNode);
+ void setTarget(rtl::Reference<Tree> const& _aAffectedTree, unsigned int _nAffectedNode);
void setTarget(view::Node _aAffectedNode);
view::ViewTreeAccess getTargetView();
public:
// getting information
- typedef sal_uInt32 ChangeCount;
- /*static const ChangeCount*/ enum { scCommonBase = ~0u };
+ /*static const sal_uInt32*/ enum { scCommonBase = ~0u };
/// checks, if this represents an actual change - with or without requiring a preceding test
bool isChange(bool bAllowUntested) const;
/// return the number of distict changes in this object
- ChangeCount getChangeDataCount() const;
+ sal_uInt32 getChangeDataCount() const;
/// fills in base change location, returns whether it is set
- bool fillChangeLocation(NodeChangeLocation& rChange, ChangeCount _ix = scCommonBase) const;
+ bool fillChangeLocation(NodeChangeLocation& rChange, sal_uInt32 _ix = scCommonBase) const;
/// fills in pre- and post-change values, returns whether they may differ
- bool fillChangeData(NodeChangeData& rChange, ChangeCount _ix) const;
+ bool fillChangeData(NodeChangeData& rChange, sal_uInt32 _ix) const;
/// fills in change location and values, returns whether data may be changed
- bool fillChangeInfo(NodeChangeInformation& rChange, ChangeCount _ix) const;
+ bool fillChangeInfo(NodeChangeInformation& rChange, sal_uInt32 _ix) const;
/// test whether this really is a change to the stored 'changing' node
void test();
@@ -147,10 +139,10 @@ namespace configmgr
private:
/// virtual hooks for some of the public methods
/// return the number of distict changes in this object
- ChangeCount doGetChangeCount() const;
+ sal_uInt32 doGetChangeCount() const;
/// the path from base to 'changing' node
- virtual RelativePath doGetChangingNodePath(ChangeCount _ix) const = 0;
+ virtual RelativePath doGetChangingNodePath(sal_uInt32 _ix) const = 0;
/// is the change really affecting a child (or children) of the affected node (true for values)
virtual bool doIsChangingSubnode() const = 0;
@@ -159,7 +151,7 @@ namespace configmgr
virtual bool doIsChange() const = 0;
/// fills in pre- and post-change values, returns wether they differ
- virtual bool doFillChange(NodeChangeData& rChange, ChangeCount _ix) const = 0;
+ virtual bool doFillChange(NodeChangeData& rChange, sal_uInt32 _ix) const = 0;
/// dry-check whether this is a change
virtual void doTest( view::Node const& rTarget) = 0;
@@ -167,10 +159,9 @@ namespace configmgr
virtual void doApply( view::Node const& rTarget) = 0;
private:
- typedef sal_uInt16 State;
- TreeHolder m_aAffectedTree;
- NodeOffset m_nAffectedNode;
- State m_nState;
+ rtl::Reference<Tree> m_aAffectedTree;
+ unsigned int m_nAffectedNode;
+ sal_uInt16 m_nState;
void implApply();
view::Node implGetTarget();
@@ -181,34 +172,34 @@ namespace configmgr
class ValueChangeImpl
: public NodeChangeImpl
{
- Name m_aName;
- UnoAny m_aNewValue;
- UnoAny m_aOldValue;
+ rtl::OUString m_aName;
+ com::sun::star::uno::Any m_aNewValue;
+ com::sun::star::uno::Any m_aOldValue;
public:
explicit ValueChangeImpl();
- explicit ValueChangeImpl(UnoAny const& aNewValue);
- explicit ValueChangeImpl(UnoAny const& aNewValue, UnoAny const& aOldValue);
+ explicit ValueChangeImpl(com::sun::star::uno::Any const& aNewValue);
+ explicit ValueChangeImpl(com::sun::star::uno::Any const& aNewValue, com::sun::star::uno::Any const& aOldValue);
~ValueChangeImpl();
public:
/// setup the 'target' node that is to be affected or changed
- void setTarget(view::GroupNode const& _aParentNode, Name const& sNodeName);
- void setTarget(TreeHolder const& aAffectedTree, NodeOffset nParentNode, Name const& sNodeName);
+ void setTarget(view::GroupNode const& _aParentNode, rtl::OUString const& sNodeName);
+ void setTarget(rtl::Reference<Tree> const& aAffectedTree, unsigned int nParentNode, rtl::OUString const& sNodeName);
public:
/// get the name of the value
- Name getValueName() const { return m_aName; }
+ rtl::OUString getValueName() const { return m_aName; }
/// get the pre-change value (if known)
- UnoAny getOldValue() const { return m_aOldValue; }
+ com::sun::star::uno::Any getOldValue() const { return m_aOldValue; }
/// get the post-change value (if known)
- UnoAny getNewValue() const { return m_aNewValue; }
+ com::sun::star::uno::Any getNewValue() const { return m_aNewValue; }
protected:
using NodeChangeImpl::setTarget;
// override information items
/// the path from base to 'affected' node - here is the name of the changing node
- virtual RelativePath doGetChangingNodePath(ChangeCount _ix) const;
+ virtual RelativePath doGetChangingNodePath(sal_uInt32 _ix) const;
/// is the change really affecting a child of the affected node (true here)
virtual bool doIsChangingSubnode() const;
@@ -219,7 +210,7 @@ namespace configmgr
virtual bool doIsChange() const;
/// fills in pre- and post-change values, returns wether they differ
- virtual bool doFillChange(NodeChangeData& rChange, ChangeCount _ix) const = 0;
+ virtual bool doFillChange(NodeChangeData& rChange, sal_uInt32 _ix) const = 0;
protected:
// override apply functionality
@@ -231,9 +222,9 @@ namespace configmgr
protected:
// new overrideables
/// extract the pre-change value from the target context
- virtual void preCheckValue(ValueMemberNode& rNode, UnoAny& rOld, UnoAny& rNew);
+ virtual void preCheckValue(ValueMemberNode& rNode, com::sun::star::uno::Any& rOld, com::sun::star::uno::Any& rNew);
/// extract the post-change value from the target context
- virtual void postCheckValue(ValueMemberNode& rNode, UnoAny& rNew);
+ virtual void postCheckValue(ValueMemberNode& rNode, com::sun::star::uno::Any& rNew);
/// apply the new value to the target context
virtual void doApplyChange(ValueMemberUpdate& rNode) = 0;
};
@@ -244,15 +235,15 @@ namespace configmgr
: public ValueChangeImpl
{
public:
- explicit ValueReplaceImpl(UnoAny const& aNewValue);
- explicit ValueReplaceImpl(UnoAny const& aNewValue, UnoAny const& aOldValue);
+ explicit ValueReplaceImpl(com::sun::star::uno::Any const& aNewValue);
+ explicit ValueReplaceImpl(com::sun::star::uno::Any const& aNewValue, com::sun::star::uno::Any const& aOldValue);
protected:
// implement: set the target to the new value
virtual void doApplyChange( ValueMemberUpdate& rNode);
/// fills in pre- and post-change values, returns wether they differ
- virtual bool doFillChange(NodeChangeData& rChange, ChangeCount _ix) const;
+ virtual bool doFillChange(NodeChangeData& rChange, sal_uInt32 _ix) const;
// friend class SetReplaceValueImpl;
};
@@ -265,11 +256,11 @@ namespace configmgr
bool m_bTargetIsDefault;
public:
explicit ValueResetImpl();
- explicit ValueResetImpl(UnoAny const& aNewValue, UnoAny const& aOldValue);
+ explicit ValueResetImpl(com::sun::star::uno::Any const& aNewValue, com::sun::star::uno::Any const& aOldValue);
protected:
// override: set the new value as well and check the default state
- virtual void preCheckValue(ValueMemberNode& rNode, UnoAny& rOld, UnoAny& rNew);
+ virtual void preCheckValue(ValueMemberNode& rNode, com::sun::star::uno::Any& rOld, com::sun::star::uno::Any& rNew);
/// checks, if this represents an actual change (given whether the change has been applied or not)
virtual bool doIsChange() const;
@@ -278,7 +269,7 @@ namespace configmgr
virtual void doApplyChange( ValueMemberUpdate& rNode);
/// fills in pre- and post-change values, returns wether they differ
- virtual bool doFillChange(NodeChangeData& rChange, ChangeCount _ix) const;
+ virtual bool doFillChange(NodeChangeData& rChange, sal_uInt32 _ix) const;
};
//-----------------------------------------------------------------------------
@@ -304,11 +295,9 @@ namespace configmgr
class SetResetImpl
: public SetChangeImpl
{
- typedef std::vector< ElementTreeChange > TreeChanges;
-
std::auto_ptr<ISubtree> m_aDefaultData;
SetElementFactory& m_rElementFactory;
- TreeChanges m_aTreeChanges;
+ std::vector< ElementTreeChange > m_aTreeChanges;
public:
explicit SetResetImpl(
SetElementFactory& _rElementFactory,
@@ -320,15 +309,15 @@ namespace configmgr
protected:
/// virtual hooks for some of the public methods
/// retrieve the count of elements affected
- ChangeCount doGetChangeCount() const;
+ sal_uInt32 doGetChangeCount() const;
/// the path from base to 'affected' node
- virtual RelativePath doGetChangingNodePath(ChangeCount _ix) const;
+ virtual RelativePath doGetChangingNodePath(sal_uInt32 _ix) const;
/// checks, if this represents an actual change (given whether the change has been applied or not)
virtual bool doIsChange() const;
/// fills in pre- and post-change values, returns wether they differ
- virtual bool doFillChange(NodeChangeData& rChange, ChangeCount _ix) const;
+ virtual bool doFillChange(NodeChangeData& rChange, sal_uInt32 _ix) const;
/// retrieve the old value from the given node
@@ -350,12 +339,12 @@ namespace configmgr
Path::Component getFullElementName() const { return m_aName; }
/// the name of the element being changed
- Name getElementName() const { return m_aName.getName(); }
+ rtl::OUString getElementName() const { return m_aName.getName(); }
protected:
/// virtual hooks for some of the public methods
/// the path from base to 'affected' node - use element name
- virtual RelativePath doGetChangingNodePath(ChangeCount _ix) const;
+ virtual RelativePath doGetChangingNodePath(sal_uInt32 _ix) const;
/// retrieve the old value from the given node
virtual void doTest( view::Node const& rTarget);
@@ -364,9 +353,9 @@ namespace configmgr
private:
/// new overridable: retrieve the old value from a properly typed node
- virtual void doTestElement(view::SetNode const& _aNode, Name const& aName) = 0;
+ virtual void doTestElement(view::SetNode const& _aNode, rtl::OUString const& aName) = 0;
/// new overridable: apply the change to a properly typed node
- virtual void doApplyToElement(view::SetNode const& _aNode, Name const& aName) = 0;
+ virtual void doApplyToElement(view::SetNode const& _aNode, rtl::OUString const& aName) = 0;
};
//-----------------------------------------------------------------------------
@@ -374,20 +363,20 @@ namespace configmgr
class SetInsertImpl
: public SetElementChangeImpl
{
- ElementTreeHolder m_aNewTree;
+ rtl::Reference<ElementTree> m_aNewTree;
public:
- explicit SetInsertImpl(Path::Component const& aName, ElementTreeHolder const& aNewTree, bool bNoCheck = false);
+ explicit SetInsertImpl(Path::Component const& aName, rtl::Reference<ElementTree> const& aNewTree, bool bNoCheck = false);
protected:
/// checks, if this represents an actual change (given whether the change has been applied or not)
virtual bool doIsChange() const;
/// fills in pre- and post-change values, returns wether they differ
- virtual bool doFillChange(NodeChangeData& rChange, ChangeCount _ix) const;
+ virtual bool doFillChange(NodeChangeData& rChange, sal_uInt32 _ix) const;
/// new overridable: retrieve the old value from a properly typed node
- virtual void doTestElement(view::SetNode const& _aNode, Name const& aName);
+ virtual void doTestElement(view::SetNode const& _aNode, rtl::OUString const& aName);
/// new overridable: apply the change to a properly typed node
- virtual void doApplyToElement(view::SetNode const& _aNode, Name const& aName);
+ virtual void doApplyToElement(view::SetNode const& _aNode, rtl::OUString const& aName);
};
//-----------------------------------------------------------------------------
@@ -395,22 +384,22 @@ namespace configmgr
class SetReplaceImpl
: public SetElementChangeImpl
{
- ElementTreeHolder m_aNewTree;
- ElementTreeHolder m_aOldTree;
+ rtl::Reference<ElementTree> m_aNewTree;
+ rtl::Reference<ElementTree> m_aOldTree;
public:
- explicit SetReplaceImpl(Path::Component const& aName, ElementTreeHolder const& aNewTree);
- explicit SetReplaceImpl(Path::Component const& aName, ElementTreeHolder const& aNewTree, ElementTreeHolder const& aOldTree);
+ explicit SetReplaceImpl(Path::Component const& aName, rtl::Reference<ElementTree> const& aNewTree);
+ explicit SetReplaceImpl(Path::Component const& aName, rtl::Reference<ElementTree> const& aNewTree, rtl::Reference<ElementTree> const& aOldTree);
protected:
/// checks, if this represents an actual change (given whether the change has been applied or not)
virtual bool doIsChange() const;
/// fills in pre- and post-change values, returns wether they differ
- virtual bool doFillChange(NodeChangeData& rChange, ChangeCount _ix) const;
+ virtual bool doFillChange(NodeChangeData& rChange, sal_uInt32 _ix) const;
/// new overridable: retrieve the old value from a properly typed node
- virtual void doTestElement(view::SetNode const& _aNode, Name const& aName);
+ virtual void doTestElement(view::SetNode const& _aNode, rtl::OUString const& aName);
/// new overridable: apply the change to a properly typed node
- virtual void doApplyToElement(view::SetNode const& _aNode, Name const& aName);
+ virtual void doApplyToElement(view::SetNode const& _aNode, rtl::OUString const& aName);
};
//-----------------------------------------------------------------------------
@@ -418,21 +407,21 @@ namespace configmgr
class SetRemoveImpl
: public SetElementChangeImpl
{
- ElementTreeHolder m_aOldTree;
+ rtl::Reference<ElementTree> m_aOldTree;
public:
explicit SetRemoveImpl(Path::Component const& aName);
- explicit SetRemoveImpl(Path::Component const& aName, ElementTreeHolder const& aOldTree);
+ explicit SetRemoveImpl(Path::Component const& aName, rtl::Reference<ElementTree> const& aOldTree);
protected:
/// checks, if this represents an actual change (given whether the change has been applied or not)
virtual bool doIsChange() const;
/// fills in pre- and post-change values, returns wether they differ
- virtual bool doFillChange(NodeChangeData& rChange, ChangeCount _ix) const;
+ virtual bool doFillChange(NodeChangeData& rChange, sal_uInt32 _ix) const;
/// new overridable: retrieve the old value from a properly typed node
- virtual void doTestElement(view::SetNode const& _aNode, Name const& aName);
+ virtual void doTestElement(view::SetNode const& _aNode, rtl::OUString const& aName);
/// new overridable: apply the change to a properly typed node
- virtual void doApplyToElement(view::SetNode const& _aNode, Name const& aName);
+ virtual void doApplyToElement(view::SetNode const& _aNode, rtl::OUString const& aName);
};
//-----------------------------------------------------------------------------
diff --git a/configmgr/source/treemgr/nodechangeinfo.cxx b/configmgr/source/treemgr/nodechangeinfo.cxx
index c01e39d45f..9a6a0c21c6 100644
--- a/configmgr/source/treemgr/nodechangeinfo.cxx
+++ b/configmgr/source/treemgr/nodechangeinfo.cxx
@@ -34,7 +34,7 @@
#include "nodechangeinfo.hxx"
#include "noderef.hxx"
-#include "treeimpl.hxx"
+#include "tree.hxx"
namespace configmgr
{
@@ -81,24 +81,24 @@ bool NodeChangeData::isDataChange() const
}
//-----------------------------------------------------------------------------
-Tree NodeChangeData::getNewElementTree() const
+rtl::Reference< Tree > NodeChangeData::getNewElementTree() const
{
- return Tree( element.newValue.get() );
+ return element.newValue.get();
}
//-----------------------------------------------------------------------------
-Tree NodeChangeData::getOldElementTree() const
+rtl::Reference< Tree > NodeChangeData::getOldElementTree() const
{
- return Tree( element.oldValue.get() );
+ return element.oldValue.get();
}
//-----------------------------------------------------------------------------
NodeID NodeChangeData::getNewElementNodeID() const
{
- ElementTreeHolder newElement = this->element.newValue;
+ rtl::Reference<ElementTree> newElement = this->element.newValue;
if ( newElement.is() && newElement->nodeCount() > 0)
{
- return NodeID( newElement.get(), newElement->root_() );
+ return NodeID( newElement.get(), Tree::ROOT );
}
else
return NodeID(0,0);
@@ -107,10 +107,10 @@ NodeID NodeChangeData::getNewElementNodeID() const
NodeID NodeChangeData::getOldElementNodeID() const
{
- ElementTreeHolder oldElement = this->element.oldValue;
+ rtl::Reference<ElementTree> oldElement = this->element.oldValue;
if ( oldElement.is() && oldElement->nodeCount() > 0)
{
- return NodeID( oldElement.get(), oldElement->root_() );
+ return NodeID( oldElement.get(), Tree::ROOT );
}
else
return NodeID(0,0);
@@ -179,24 +179,24 @@ void NodeChangeLocation::setChangingSubnode( bool bSubnode )
}
//-----------------------------------------------------------------------------
-Tree NodeChangeLocation::getBaseTree() const
+rtl::Reference< Tree > NodeChangeLocation::getBaseTree() const
{
OSL_ENSURE(m_base.isValidNode(), "Invalid base location set in NodeChangeLocation");
- return Tree( TreeImplHelper::tree(m_base) );
+ return m_base.getTree();
}
//-----------------------------------------------------------------------------
NodeRef NodeChangeLocation::getBaseNode() const
{
OSL_ENSURE(m_base.isValidNode(), "Invalid base location set in NodeChangeLocation");
- return TreeImplHelper::makeNode(m_base);
+ return m_base.getNode();
}
//-----------------------------------------------------------------------------
-TreeRef NodeChangeLocation::getAffectedTreeRef() const
+rtl::Reference< Tree > NodeChangeLocation::getAffectedTreeRef() const
{
NodeID aAffected = this->getAffectedNodeID();
- return TreeRef( TreeImplHelper::tree(aAffected) );
+ return aAffected.getTree();
}
//-----------------------------------------------------------------------------
diff --git a/configmgr/source/treemgr/nodefactory.cxx b/configmgr/source/treemgr/nodefactory.cxx
index 47d9661633..3c9deb28ff 100644
--- a/configmgr/source/treemgr/nodefactory.cxx
+++ b/configmgr/source/treemgr/nodefactory.cxx
@@ -33,9 +33,6 @@
#include <stdio.h>
#include "nodefactory.hxx"
#include "nodeimplobj.hxx"
-#include "valuenodeaccess.hxx"
-#include "groupnodeaccess.hxx"
-#include "setnodeaccess.hxx"
#include "configpath.hxx"
#include <osl/diagnose.h>
@@ -50,107 +47,58 @@ namespace view
namespace
{
//---------------------------------------------------------------------
- using configuration::NodeImpl;
- using configuration::Template;
- using data::ValueNodeAccess;
- using data::GroupNodeAccess;
- using data::SetNodeAccess;
-//---------------------------------------------------------------------
-/* static bool isTreeSet(SetNodeAccess const& _aNodeAccess, Template* pTemplate)
- {
- OSL_ENSURE(pTemplate,"ERROR: Trying to instantiate a set without a template");
- if (!pTemplate) throw Exception("ERROR: Trying to instantiate a set without a template");
-
- OSL_ENSURE(pTemplate->getName().toString() == _aNodeAccess.getElementTemplateName(),
- "WARNING: Template name mismatch creating a set node");
-
- return ! pTemplate->isInstanceValue();
- }
-*/
-//---------------------------------------------------------------------
struct BasicNodeFactory : NodeFactory
{
- rtl::Reference<NodeImpl> makeValueNode(ValueNodeAccess const& _aNodeAccess);
- rtl::Reference<NodeImpl> makeGroupNode(GroupNodeAccess const& _aNodeAccess);
- rtl::Reference<NodeImpl> makeSetNode (SetNodeAccess const& _aNodeAccess, Template* pTemplate);
+ rtl::Reference<configuration::NodeImpl> makeValueNode(sharable::ValueNode * node);
+ rtl::Reference<configuration::NodeImpl> makeGroupNode(sharable::GroupNode * node);
+ rtl::Reference<configuration::NodeImpl> makeSetNode(sharable::SetNode * node, configuration::Template* pTemplate);
};
//-------------------------------------------------------------------------
- rtl::Reference<NodeImpl> BasicNodeFactory::makeValueNode(ValueNodeAccess const& _aNodeAccess)
- {
- return new configuration::ValueElementNodeImpl(_aNodeAccess);
- }
- //-------------------------------------------------------------------------
-
- rtl::Reference<NodeImpl> BasicNodeFactory::makeGroupNode(GroupNodeAccess const& _aNodeAccess)
- {
- return new configuration::GroupNodeImpl(_aNodeAccess);
- }
- //-------------------------------------------------------------------------
-
- rtl::Reference<NodeImpl> BasicNodeFactory::makeSetNode (SetNodeAccess const& _aNodeAccess, Template* pTemplate)
+ rtl::Reference<configuration::NodeImpl> BasicNodeFactory::makeValueNode(sharable::ValueNode * node)
{
- return new configuration::SetNodeImpl(_aNodeAccess,pTemplate);
+ return new configuration::ValueElementNodeImpl(node);
}
//-------------------------------------------------------------------------
-//-----------------------------------------------------------------------------
-/*
- struct DirectNodeFactory : NodeFactory
+ rtl::Reference<configuration::NodeImpl> BasicNodeFactory::makeGroupNode(sharable::GroupNode * node)
{
- rtl::Reference<NodeImpl> makeValueNode(ValueNodeAccess const& _aNodeAccess);
- rtl::Reference<NodeImpl> makeGroupNode(GroupNodeAccess const& _aNodeAccess);
- rtl::Reference<NodeImpl> makeSetNode (SetNodeAccess const& _aNodeAccess, Template* pTemplate);
- };
- //-------------------------------------------------------------------------
-
- rtl::Reference<NodeImpl> DirectNodeFactory::makeValueNode(ValueNodeAccess const& _aNodeAccess)
- {
- return new DirectValueElementNodeImpl(_aNodeAccess);
+ return new configuration::GroupNodeImpl(node);
}
//-------------------------------------------------------------------------
- rtl::Reference<NodeImpl> DirectNodeFactory::makeGroupNode(GroupNodeAccess const& _aNodeAccess)
+ rtl::Reference<configuration::NodeImpl> BasicNodeFactory::makeSetNode(sharable::SetNode * node, configuration::Template* pTemplate)
{
- return new DirectGroupNodeImpl(_aNodeAccess);
+ return new configuration::SetNodeImpl(node, pTemplate);
}
//-------------------------------------------------------------------------
- rtl::Reference<NodeImpl> DirectNodeFactory::makeSetNode (SetNodeAccess const& _aNodeAccess, Template* pTemplate)
- {
- if (isTreeSet(_aNodeAccess,pTemplate))
- return new DirectTreeSetNodeImpl(_aNodeAccess,pTemplate);
- else
- return new DirectValueSetNodeImpl(_aNodeAccess,pTemplate);
- }
- //-------------------------------------------------------------------------
-*/
//-----------------------------------------------------------------------------
struct DeferredNodeFactory : NodeFactory
{
- rtl::Reference<NodeImpl> makeValueNode(ValueNodeAccess const& _aNodeAccess);
- rtl::Reference<NodeImpl> makeGroupNode(GroupNodeAccess const& _aNodeAccess);
- rtl::Reference<NodeImpl> makeSetNode (SetNodeAccess const& _aNodeAccess, Template* pTemplate);
+ rtl::Reference<configuration::NodeImpl> makeValueNode(sharable::ValueNode * node);
+ rtl::Reference<configuration::NodeImpl> makeGroupNode(sharable::GroupNode * node);
+ rtl::Reference<configuration::NodeImpl> makeSetNode(sharable::SetNode * node, configuration::Template* pTemplate);
};
//-------------------------------------------------------------------------
- rtl::Reference<NodeImpl> DeferredNodeFactory::makeValueNode(ValueNodeAccess const& _aNodeAccess)
+ rtl::Reference<configuration::NodeImpl> DeferredNodeFactory::makeValueNode(sharable::ValueNode * node)
{
// OSL_ENSURE(false, "Wrong factory for value elements - should be immutable (=read-only)");
- return new configuration::ValueElementNodeImpl(_aNodeAccess);
+ return new configuration::ValueElementNodeImpl(node);
}
//-------------------------------------------------------------------------
- rtl::Reference<NodeImpl> DeferredNodeFactory::makeGroupNode(GroupNodeAccess const& _aNodeAccess)
+ rtl::Reference<configuration::NodeImpl> DeferredNodeFactory::makeGroupNode(sharable::GroupNode * node)
{
- return new configuration::DeferredGroupNodeImpl(_aNodeAccess);
+ return new configuration::DeferredGroupNodeImpl(node);
}
//-------------------------------------------------------------------------
- rtl::Reference<NodeImpl> DeferredNodeFactory::makeSetNode (SetNodeAccess const& _aNodeAccess, Template* pTemplate)
+ rtl::Reference<configuration::NodeImpl> DeferredNodeFactory::makeSetNode(sharable::SetNode * node, configuration::Template* pTemplate)
{
- return new configuration::DeferredSetNodeImpl(_aNodeAccess,pTemplate);
+ return new configuration::DeferredSetNodeImpl(node, pTemplate);
}
//-------------------------------------------------------------------------
diff --git a/configmgr/source/treemgr/nodefactory.hxx b/configmgr/source/treemgr/nodefactory.hxx
index 4612a2c59b..73c9e9603b 100644
--- a/configmgr/source/treemgr/nodefactory.hxx
+++ b/configmgr/source/treemgr/nodefactory.hxx
@@ -35,25 +35,19 @@
namespace configmgr
{
-//-----------------------------------------------------------------------------
- namespace data
- {
- class ValueNodeAccess;
- class GroupNodeAccess;
- class SetNodeAccess;
- }
-//-----------------------------------------------------------------------------
-
namespace configuration
{
class NodeImpl;
class Template;
}
+ namespace sharable {
+ struct GroupNode;
+ struct SetNode;
+ struct ValueNode;
+ }
//-----------------------------------------------------------------------------
namespace view
{
- typedef rtl::Reference<configuration::NodeImpl> NodeImplRef;
-
//-----------------------------------------------------------------------------
// Creating Specific types of nodes
@@ -61,9 +55,9 @@ namespace configmgr
struct NodeFactory
{
- virtual NodeImplRef makeValueNode(data::ValueNodeAccess const& _aNodeAccess) = 0;
- virtual NodeImplRef makeGroupNode(data::GroupNodeAccess const& _aNodeAccess) = 0;
- virtual NodeImplRef makeSetNode(data::SetNodeAccess const& _aNodeAccess, configuration::Template* pTemplate) = 0;
+ virtual rtl::Reference<configuration::NodeImpl> makeValueNode(sharable::ValueNode * node) = 0;
+ virtual rtl::Reference<configuration::NodeImpl> makeGroupNode(sharable::GroupNode * node) = 0;
+ virtual rtl::Reference<configuration::NodeImpl> makeSetNode(sharable::SetNode * node, configuration::Template* pTemplate) = 0;
};
}
//-----------------------------------------------------------------------------
diff --git a/configmgr/source/treemgr/nodeimpl.cxx b/configmgr/source/treemgr/nodeimpl.cxx
index 7baec8bd25..5c4abf60be 100644
--- a/configmgr/source/treemgr/nodeimpl.cxx
+++ b/configmgr/source/treemgr/nodeimpl.cxx
@@ -34,11 +34,8 @@
#include "nodeimpl.hxx"
#include "valuenodeimpl.hxx"
#include "groupnodeimpl.hxx"
-#include "nodeaccess.hxx"
-#include "valuenodeaccess.hxx"
-#include "groupnodeaccess.hxx"
#include "nodevisitor.hxx"
-#include "treeimpl.hxx"
+#include "tree.hxx"
#include "nodechange.hxx"
#include "nodechangeimpl.hxx"
#include "nodechangeinfo.hxx"
@@ -57,22 +54,16 @@ namespace configmgr
// class GroupNodeImpl
//-----------------------------------------------------------------------------
-data::GroupNodeAccess GroupNodeImpl::getDataAccess() const
+sharable::GroupNode * GroupNodeImpl::getDataAccess() const
{
- using namespace data;
-
- NodeAccess aNodeAccess = getOriginalNodeAccess();
- OSL_ASSERT(GroupNodeAccess::isInstance(aNodeAccess));
-
- GroupNodeAccess aGroupAccess(aNodeAccess);
- OSL_ASSERT(aGroupAccess.isValid());
-
- return aGroupAccess;
+ sharable::Node * node = getOriginalNodeAccess();
+ OSL_ASSERT(node != 0 && node->isGroup());
+ return &node->group;
}
//-----------------------------------------------------------------------------
-GroupNodeImpl::GroupNodeImpl(data::GroupNodeAddress _pNodeRef)
- : NodeImpl(reinterpret_cast<data::NodeAddress>(_pNodeRef))
+GroupNodeImpl::GroupNodeImpl(sharable::GroupNode * _pNodeRef)
+ : NodeImpl(reinterpret_cast<sharable::Node *>(_pNodeRef))
, m_pCache( NULL )
{
}
@@ -80,138 +71,69 @@ GroupNodeImpl::GroupNodeImpl(data::GroupNodeAddress _pNodeRef)
bool GroupNodeImpl::areValueDefaultsAvailable() const
{
- data::GroupNodeAccess aGroupAccess = getDataAccess();
-
- return aGroupAccess.data().hasDefaultsAvailable();
+ return getDataAccess()->hasDefaultsAvailable();
}
//-----------------------------------------------------------------------------
-ValueMemberNode GroupNodeImpl::makeValueMember(data::ValueNodeAccess const& _aNodeAccess)
+ValueMemberNode GroupNodeImpl::makeValueMember(sharable::ValueNode * node)
{
- return ValueMemberNode(_aNodeAccess);
+ return ValueMemberNode(node);
}
//-----------------------------------------------------------------------------
-data::ValueNodeAccess GroupNodeImpl::getOriginalValueNode(Name const& _aName) const
+sharable::ValueNode * GroupNodeImpl::getOriginalValueNode(rtl::OUString const& _aName) const
{
- OSL_ENSURE( !_aName.isEmpty(), "Cannot get nameless child value");
+ OSL_ENSURE( _aName.getLength() != 0, "Cannot get nameless child value");
- using namespace data;
-
- data::GroupNodeAccess aAccess = this->getDataAccess();
- const rtl::OUString &rName = _aName.toString();
-
-/*
- fprintf (stderr, "GroupNodeImpl::GetOriginalValueNode %p '%s' ", this,
- rtl::OUStringToOString(rName, RTL_TEXTENCODING_UTF8).getStr());
- fprintf (stderr, "cache '%s'\n",
- m_pCache ? rtl::OUStringToOString(m_pCache->getName(),
- RTL_TEXTENCODING_UTF8).getStr()
- : "<null>");
-*/
+ sharable::GroupNode * group = getDataAccess();
if (m_pCache)
{
- if (m_pCache->isNamed(rName))
- return ValueNodeAccess( (ValueNodeAddress) m_pCache );
+ if (m_pCache->isNamed(_aName))
+ return m_pCache->valueData();
- sharable::GroupNode & aNode = aAccess.data();
- m_pCache = aNode.getNextChild(m_pCache);
+ m_pCache = group->getNextChild(m_pCache);
- if (m_pCache && m_pCache->isNamed(rName))
- return ValueNodeAccess( (ValueNodeAddress) m_pCache );
+ if (m_pCache && m_pCache->isNamed(_aName))
+ return m_pCache->valueData();
m_pCache = NULL;
}
- NodeAccess aChild = aAccess.getChildNode(_aName);
- m_pCache = aChild;
+ sharable::Node * child = group->getChild(_aName);
+ m_pCache = child;
// to do: investigate cache lifecycle more deeply.
- return ValueNodeAccess(aChild);
+ return child == 0 ? 0 : child->valueData();
}
//-----------------------------------------------------------------------------
// class ValueElementNodeImpl
//-----------------------------------------------------------------------------
-data::ValueNodeAccess ValueElementNodeImpl::getDataAccess() const
+sharable::ValueNode * ValueElementNodeImpl::getDataAccess() const
{
- using namespace data;
-
- NodeAccess aNodeAccess = getOriginalNodeAccess();
- OSL_ASSERT(ValueNodeAccess::isInstance(aNodeAccess));
-
- ValueNodeAccess aValueAccess(aNodeAccess);
- OSL_ASSERT(aValueAccess.isValid());
-
- return aValueAccess;
+ sharable::Node * node = getOriginalNodeAccess();
+ OSL_ASSERT(node != 0 && node->isValue());
+ return &node->value;
}
//-----------------------------------------------------------------------------
-ValueElementNodeImpl::ValueElementNodeImpl(data::ValueNodeAddress const& _aNodeRef)
- : NodeImpl(reinterpret_cast<data::NodeAddress>(_aNodeRef))
+ValueElementNodeImpl::ValueElementNodeImpl(sharable::ValueNode * const& _aNodeRef)
+ : NodeImpl(reinterpret_cast<sharable::Node *>(_aNodeRef))
{
}
//-----------------------------------------------------------------------------
-UnoAny ValueElementNodeImpl::getValue() const
+com::sun::star::uno::Any ValueElementNodeImpl::getValue() const
{
- return getDataAccess().getValue();
+ return getDataAccess()->getValue();
}
//-----------------------------------------------------------------------------
-UnoType ValueElementNodeImpl::getValueType() const
+com::sun::star::uno::Type ValueElementNodeImpl::getValueType() const
{
- return getDataAccess().getValueType();
-}
-//-----------------------------------------------------------------------------
-
-namespace
-{
- struct AbstractNodeCast : data::NodeVisitor
- {
- virtual Result handle( data::ValueNodeAccess const& /*rNode*/)
- {
- throw Exception( "INTERNAL ERROR: Node is not a value node. Cast failing." );
- }
- virtual Result handle( data::GroupNodeAccess const& /*rNode*/)
- {
- throw Exception( "INTERNAL ERROR: Node is not a group node. Cast failing." );
- }
- virtual Result handle( data::SetNodeAccess const& /*rNode*/)
- {
- return CONTINUE;
- }
- protected:
- using NodeVisitor::handle;
- };
-
- template <class NodeType>
- class NodeCast : AbstractNodeCast
- {
- public:
- typedef typename NodeType::DataAccess DataNodeType;
-
- NodeCast(NodeImpl& rOriginalNode)
- : m_pNode(0)
- {
- if (this->visitNode(rOriginalNode.getOriginalNodeAccess()) == DONE)
- m_pNode = static_cast<NodeType*>(&rOriginalNode);
- }
-
- NodeType& get() const
- {
- OSL_ENSURE(m_pNode,"INTERNAL ERROR: Node not set after Cast." );
- return *m_pNode;
- }
-
- operator NodeType& () const { return get(); }
- private:
- virtual Result handle( DataNodeType& ) { return DONE; }
-
- NodeType* m_pNode;
- };
+ return getDataAccess()->getValueType();
}
//-----------------------------------------------------------------------------
}
diff --git a/configmgr/source/treemgr/nodeimpl.hxx b/configmgr/source/treemgr/nodeimpl.hxx
index 1c74feeb24..e4b350c30c 100644
--- a/configmgr/source/treemgr/nodeimpl.hxx
+++ b/configmgr/source/treemgr/nodeimpl.hxx
@@ -35,24 +35,17 @@
#include "node.hxx"
#include "utility.hxx"
#include <rtl/ref.hxx>
-
-#include "nodeaccess.hxx"
+#include <salhelper/simplereferenceobject.hxx>
namespace configmgr
{
//-----------------------------------------------------------------------------
- namespace data { class NodeAccess; }
namespace view { class ViewStrategy; }
//-----------------------------------------------------------------------------
namespace configuration
{
//-----------------------------------------------------------------------------
- typedef unsigned int NodeOffset;
-
- class TreeImpl;
-
- class Name;
-
+ class Tree;
class NodeChange;
class NodeChanges;
class NodeChangesInformation;
@@ -65,22 +58,18 @@ namespace configmgr
struct INodeHandler;
// Almost an interface, but derives from concrete OReference
- class NodeImpl : public configmgr::SimpleReferenceObject
+ class NodeImpl : public salhelper::SimpleReferenceObject
{
friend class view::ViewStrategy;
- data::NodeAddress m_pNodeRef;
+ sharable::Node * m_pNodeRef;
public:
- NodeImpl(data::NodeAddress _pNodeRef)
+ NodeImpl(sharable::Node * _pNodeRef)
: m_pNodeRef(_pNodeRef) {}
public:
- /// provide access to the address of the underlying node
- data::NodeAddress getOriginalNodeAddress() const
- { return m_pNodeRef; }
-
/// provide access to the data of the underlying node
- data::NodeAccess getOriginalNodeAccess() const
- { return data::NodeAccess( m_pNodeRef ); }
+ sharable::Node * getOriginalNodeAccess() const
+ { return m_pNodeRef; }
};
//-----------------------------------------------------------------------------
diff --git a/configmgr/source/treemgr/nodeimplobj.cxx b/configmgr/source/treemgr/nodeimplobj.cxx
index a8ab27724c..33e1515d4a 100644
--- a/configmgr/source/treemgr/nodeimplobj.cxx
+++ b/configmgr/source/treemgr/nodeimplobj.cxx
@@ -37,7 +37,6 @@
#include "nodechange.hxx"
#include "nodechangeinfo.hxx"
#include "nodechangeimpl.hxx"
-#include "setnodeaccess.hxx"
#include "valuenode.hxx"
#include "change.hxx"
#include "viewaccess.hxx"
@@ -62,7 +61,7 @@ namespace configmgr
// class DeferredGroupNodeImpl
//-----------------------------------------------------------------------------
-DeferredGroupNodeImpl::DeferredGroupNodeImpl(data::GroupNodeAddress const& _aNodeRef)
+DeferredGroupNodeImpl::DeferredGroupNodeImpl(sharable::GroupNode * const& _aNodeRef)
: GroupNodeImpl(_aNodeRef)
, m_aChanges()
{
@@ -74,14 +73,14 @@ DeferredGroupNodeImpl::~DeferredGroupNodeImpl()
}
//-----------------------------------------------------------------------------
-ValueMemberNode DeferredGroupNodeImpl::makeValueMember(Name const& _aName, bool _bForUpdate)
+ValueMemberNode DeferredGroupNodeImpl::makeValueMember(rtl::OUString const& _aName, bool _bForUpdate)
{
MemberChanges::iterator it = m_aChanges.find(_aName);
if (it != m_aChanges.end())
{
if (!it->second.is())
- OSL_ENSURE(_aName.isEmpty(), "ERROR: Found empty change reference");
+ OSL_ENSURE(_aName.getLength() == 0, "ERROR: Found empty change reference");
else if (_bForUpdate || it->second->isChange()) // found one
return ValueMemberNode(it->second);
@@ -92,20 +91,20 @@ ValueMemberNode DeferredGroupNodeImpl::makeValueMember(Name const& _aName, bool
// if not found continue with default
}
- data::ValueNodeAccess aOriginal = getOriginalValueNode(_aName);
+ sharable::ValueNode * original = getOriginalValueNode(_aName);
if (_bForUpdate) // create a new change
{
- if (aOriginal.isValid())
+ if (original != 0)
{
- MemberChange aNewChange(new ValueMemberNode::DeferredImpl(aOriginal));
+ rtl::Reference<ValueMemberNode::DeferredImpl> aNewChange(new ValueMemberNode::DeferredImpl(original));
m_aChanges[_aName] = aNewChange;
return ValueMemberNode(aNewChange);
}
}
- return GroupNodeImpl::makeValueMember(aOriginal);
+ return GroupNodeImpl::makeValueMember(original);
}
//-----------------------------------------------------------------------------
@@ -116,7 +115,7 @@ bool DeferredGroupNodeImpl::hasChanges() const
if (!it->second.is())
{
// empty element is present -> marked as changed
- OSL_ASSERT(it->first.isEmpty());
+ OSL_ASSERT(it->first.getLength() == 0);
return true;
}
@@ -128,13 +127,13 @@ bool DeferredGroupNodeImpl::hasChanges() const
}
//-----------------------------------------------------------------------------
-void DeferredGroupNodeImpl::collectValueChanges(NodeChanges& rChanges, TreeImpl* pParentTree, NodeOffset nNode) const
+void DeferredGroupNodeImpl::collectValueChanges(NodeChanges& rChanges, Tree* pParentTree, unsigned int nNode) const
{
for (MemberChanges::const_iterator it = m_aChanges.begin(); it != m_aChanges.end(); ++it)
{
if (it->second.is())
{
- OSL_ASSERT(!it->first.isEmpty());
+ OSL_ASSERT(it->first.getLength() != 0);
if (ValueChangeImpl* pValueChange = it->second->collectChange())
{
pValueChange->setTarget(pParentTree,nNode,it->first);
@@ -145,14 +144,14 @@ void DeferredGroupNodeImpl::collectValueChanges(NodeChanges& rChanges, TreeImpl*
OSL_ENSURE(!it->second->isChange(), "Got no change from a changing value") ;
}
else
- OSL_ASSERT(it->first.isEmpty());
+ OSL_ASSERT(it->first.getLength() == 0);
}
}
//-----------------------------------------------------------------------------
-DeferredGroupNodeImpl::MemberChange DeferredGroupNodeImpl::findValueChange(Name const& aName)
+rtl::Reference<ValueMemberNode::DeferredImpl> DeferredGroupNodeImpl::findValueChange(rtl::OUString const& aName)
{
- MemberChange aResult;
+ rtl::Reference<ValueMemberNode::DeferredImpl> aResult;
MemberChanges::iterator it = m_aChanges.find(aName);
@@ -171,7 +170,7 @@ DeferredGroupNodeImpl::MemberChange DeferredGroupNodeImpl::findValueChange(Name
}
}
else
- OSL_ENSURE(aName.isEmpty(), "ERROR: Found empty change reference");
+ OSL_ENSURE(aName.getLength() == 0, "ERROR: Found empty change reference");
}
return aResult;
@@ -185,9 +184,9 @@ std::auto_ptr<SubtreeChange> DeferredGroupNodeImpl::preCommitValueChanges()
if (!m_aChanges.empty())
{
- data::NodeAccess aOriginalData = this->getOriginalNodeAccess();
- aRet.reset( new SubtreeChange( aOriginalData.getName().toString(),
- aOriginalData->getAttributes() ) );
+ sharable::Node * originalData = this->getOriginalNodeAccess();
+ aRet.reset( new SubtreeChange( originalData->getName(),
+ originalData->getAttributes() ) );
for (MemberChanges::iterator pos = m_aChanges.begin(); pos != m_aChanges.end(); )
{
@@ -195,7 +194,7 @@ std::auto_ptr<SubtreeChange> DeferredGroupNodeImpl::preCommitValueChanges()
if (!it->second.is())
{
- OSL_ASSERT(it->first.isEmpty());
+ OSL_ASSERT(it->first.getLength() == 0);
}
else if (it->second->isChange())
{
@@ -226,34 +225,33 @@ void DeferredGroupNodeImpl::finishCommit(SubtreeChange& rChanges)
it != stop;
++it)
{
- Name aValueName = makeNodeName(it->getNodeName(), Name::NoValidate());
+ rtl::OUString aValueName(it->getNodeName());
MemberChanges::iterator itStoredChange = m_aChanges.find(aValueName);
if (itStoredChange != m_aChanges.end())
{
- OSL_ENSURE( it->ISA(ValueChange) , "Unexpected type of element change");
- if (!it->ISA(ValueChange)) throw Exception("Unexpected type of element change");
+ ValueChange * valueChange = dynamic_cast< ValueChange * >(&*it);
+ OSL_ENSURE(valueChange != 0, "Unexpected type of element change");
+ if (valueChange == 0) throw Exception("Unexpected type of element change");
- ValueChange & rValueChange = static_cast<ValueChange&>(*it);
-
- MemberChange aStoredChange = itStoredChange->second;
+ rtl::Reference<ValueMemberNode::DeferredImpl> aStoredChange = itStoredChange->second;
OSL_ENSURE( aStoredChange.is(), "Found empty change object for Member value change");
if (aStoredChange.is())
{
- aStoredChange->finishCommit(rValueChange);
+ aStoredChange->finishCommit(*valueChange);
OSL_ENSURE(!aStoredChange->isChange(),"ValueChange is not moot after finishCommit");
}
m_aChanges.erase( itStoredChange ); // remove finished change
}
else
- OSL_ENSURE( !it->ISA(ValueChange) , "Value member change has no change data representation");
+ OSL_ENSURE(dynamic_cast< ValueChange * >(&*it) == 0, "Value member change has no change data representation");
}
- OSL_DEBUG_ONLY( m_aChanges.erase( Name() ) ); // remove change marker (if present)
+ OSL_DEBUG_ONLY( m_aChanges.erase( rtl::OUString() ) ); // remove change marker (if present)
OSL_ENSURE(m_aChanges.empty(), "Found unprocessed changes to values in group");
m_aChanges.clear(); // remove all pending stuff and marker
@@ -268,29 +266,28 @@ void DeferredGroupNodeImpl::revertCommit(SubtreeChange& rChanges)
it != stop;
++it)
{
- Name aValueName = makeNodeName(it->getNodeName(), Name::NoValidate());
+ rtl::OUString aValueName(it->getNodeName());
MemberChanges::iterator itStoredChange = m_aChanges.find(aValueName);
if (itStoredChange != m_aChanges.end())
{
- OSL_ENSURE( it->ISA(ValueChange) , "Unexpected type of element change");
- if (!it->ISA(ValueChange)) continue;
-
- ValueChange & rValueChange = static_cast<ValueChange&>(*it);
+ ValueChange * valueChange = dynamic_cast< ValueChange * >(&*it);
+ OSL_ENSURE(valueChange != 0, "Unexpected type of element change");
+ if (valueChange == 0) continue;
- MemberChange aStoredChange = itStoredChange->second;
+ rtl::Reference<ValueMemberNode::DeferredImpl> aStoredChange = itStoredChange->second;
OSL_ENSURE( aStoredChange.is(), "Cannot restore change: found empty change object for Member value change");
if (aStoredChange.is())
{
- aStoredChange->revertCommit(rValueChange);
+ aStoredChange->revertCommit(*valueChange);
OSL_ENSURE(!aStoredChange->isChange(),"ValueChange is not moot after reverting - will be discarded nevertheless");
}
m_aChanges.erase( itStoredChange ); // remove change if it is moot
}
else
- OSL_ENSURE( !it->ISA(ValueChange) , "Value member change has no change data representation");
+ OSL_ENSURE(dynamic_cast< ValueChange * >(&*it) == 0, "Value member change has no change data representation");
}
}
//-----------------------------------------------------------------------------
@@ -303,32 +300,31 @@ void DeferredGroupNodeImpl::failedCommit(SubtreeChange& rChanges)
it != stop;
++it)
{
- Name aValueName = makeNodeName(it->getNodeName(), Name::NoValidate());
+ rtl::OUString aValueName(it->getNodeName());
MemberChanges::iterator itStoredChange = m_aChanges.find(aValueName);
if (itStoredChange != m_aChanges.end())
{
- OSL_ENSURE( it->ISA(ValueChange) , "Unexpected type of element change");
- if (!it->ISA(ValueChange)) continue;
+ ValueChange * valueChange = dynamic_cast< ValueChange * >(&*it);
+ OSL_ENSURE(valueChange != 0, "Unexpected type of element change");
+ if (valueChange == 0) continue;
- ValueChange & rValueChange = static_cast<ValueChange&>(*it);
-
- MemberChange aStoredChange = itStoredChange->second;
+ rtl::Reference<ValueMemberNode::DeferredImpl> aStoredChange = itStoredChange->second;
OSL_ENSURE( aStoredChange.is(), "Cannot recover from failed change: found empty change object for Member value change");
if (aStoredChange.is())
- aStoredChange->failedCommit(rValueChange);
+ aStoredChange->failedCommit(*valueChange);
{
if (!aStoredChange->isChange())
m_aChanges.erase( itStoredChange ); // remove change if it is moot
}
}
else
- OSL_ENSURE( !it->ISA(ValueChange) , "Value member change has no change data representation");
+ OSL_ENSURE(dynamic_cast< ValueChange * >(&*it) == 0, "Value member change has no change data representation");
}
- OSL_DEBUG_ONLY( m_aChanges.erase( Name() ) ); // remove change marker (if present)
+ OSL_DEBUG_ONLY( m_aChanges.erase( rtl::OUString() ) ); // remove change marker (if present)
OSL_ENSURE(m_aChanges.empty(), "RevertCommit: Found unprocessed changes to values in group");
m_aChanges.clear(); // discard all pending stuff and marker
@@ -338,7 +334,7 @@ void DeferredGroupNodeImpl::failedCommit(SubtreeChange& rChanges)
void DeferredGroupNodeImpl::markChanged()
{
- // special mark: a NULL DeferredImplRef at empty Name
+ // special mark: a NULL rtl::Reference<ValueMemberNode::DeferredImpl> at empty name
m_aChanges.insert( MemberChanges::value_type() );
}
//-----------------------------------------------------------------------------
@@ -351,7 +347,7 @@ void DeferredGroupNodeImpl::markChanged()
// class DeferredTreeSetNodeImpl
//-----------------------------------------------------------------------------
-DeferredSetNodeImpl::DeferredSetNodeImpl(data::SetNodeAddress const& _aNodeRef, Template* pTemplate)
+DeferredSetNodeImpl::DeferredSetNodeImpl(sharable::SetNode * const& _aNodeRef, Template* pTemplate)
: SetNodeImpl(_aNodeRef,pTemplate)
, m_aChangedData()
, m_bChanged(false)
@@ -375,7 +371,7 @@ bool DeferredSetNodeImpl::doIsEmpty() const
// look for elements in the base set that are not 'deleted' (the changes are all deletions here)
- {for(ElementSet::PairIterator it = SetNodeImpl::beginElementSet(), stop = SetNodeImpl::endElementSet();
+ {for(ElementSet::Data::const_iterator it = SetNodeImpl::beginElementSet(), stop = SetNodeImpl::endElementSet();
it != stop;
++it)
{
@@ -386,9 +382,9 @@ bool DeferredSetNodeImpl::doIsEmpty() const
}
//-----------------------------------------------------------------------------
-ElementTreeImpl* DeferredSetNodeImpl::doFindElement(Name const& aName)
+ElementTree* DeferredSetNodeImpl::doFindElement(rtl::OUString const& aName)
{
- Element* pElement = m_aChangedData.getElement(aName);
+ ElementTreeData* pElement = m_aChangedData.getElement(aName);
if (!pElement)
pElement = SetNodeImpl::getStoredElement(aName);
@@ -400,7 +396,7 @@ SetNodeVisitor::Result DeferredSetNodeImpl::doDispatchToElements(SetNodeVisitor&
{
SetNodeVisitor::Result eRet = SetNodeVisitor::CONTINUE;
// look for elements in the base set that are not hidden by changes
- {for(ElementSet::PairIterator it = SetNodeImpl::beginElementSet(), stop = SetNodeImpl::endElementSet();
+ {for(ElementSet::Data::const_iterator it = SetNodeImpl::beginElementSet(), stop = SetNodeImpl::endElementSet();
it != stop && eRet != SetNodeVisitor::DONE;
++it)
{
@@ -434,11 +430,11 @@ bool DeferredSetNodeImpl::hasChanges() const
void DeferredSetNodeImpl::collectElementChanges(NodeChanges& rChanges) const
{
// collect added and deleted nodes
- {for(ElementSet::PairIterator it = m_aChangedData.beginNative(), stop = m_aChangedData.endNative();
+ {for(ElementSet::Data::const_iterator it = m_aChangedData.beginNative(), stop = m_aChangedData.endNative();
it != stop;
++it)
{
- Element const* pOriginal = SetNodeImpl::getStoredElement(it->first);
+ ElementTreeData const* pOriginal = SetNodeImpl::getStoredElement(it->first);
if (it->second.isValid()) // added one
{
@@ -464,14 +460,14 @@ void DeferredSetNodeImpl::collectElementChanges(NodeChanges& rChanges) const
// collect preexisting nodes
// if (!containsValues()) // value elements ar immutable !
- {for(ElementSet::PairIterator it = SetNodeImpl::beginElementSet(), stop = SetNodeImpl::endElementSet();
+ {for(ElementSet::Data::const_iterator it = SetNodeImpl::beginElementSet(), stop = SetNodeImpl::endElementSet();
it != stop;
++it)
{
if (m_aChangedData.getElement(it->first) == 0)
{
OSL_ASSERT(it->second.isValid());
- view::ViewTreeAccess aElementView(*it->second);
+ view::ViewTreeAccess aElementView(it->second.get());
if (aElementView.hasChanges())
aElementView.collectChanges(rChanges);
@@ -490,7 +486,7 @@ void DeferredSetNodeImpl::markChanged()
void DeferredSetNodeImpl::doTransferElements(ElementSet& rReplacement)
{
// transfer preexisting nodes (unless replaced/deleted)
- {for(ElementSet::PairIterator it = SetNodeImpl::beginElementSet(), stop = SetNodeImpl::endElementSet();
+ {for(ElementSet::Data::const_iterator it = SetNodeImpl::beginElementSet(), stop = SetNodeImpl::endElementSet();
it != stop;
++it)
{
@@ -504,8 +500,8 @@ void DeferredSetNodeImpl::doTransferElements(ElementSet& rReplacement)
// commit added and deleted nodes
{
- ElementSet::PairIterator it = m_aChangedData.beginNative();
- ElementSet::PairIterator const stop = m_aChangedData.endNative();
+ ElementSet::Data::const_iterator it = m_aChangedData.beginNative();
+ ElementSet::Data::const_iterator const stop = m_aChangedData.endNative();
while(it != stop)
{
@@ -521,36 +517,36 @@ void DeferredSetNodeImpl::doTransferElements(ElementSet& rReplacement)
}
//-----------------------------------------------------------------------------
-void DeferredSetNodeImpl::rebuildElement(Name const& _aName, Element const& _aElement)
+void DeferredSetNodeImpl::rebuildElement(rtl::OUString const& _aName, ElementTreeData const& _aElement)
{
- TreeImpl* pContext = this->getParentTree();
+ Tree* pContext = this->getParentTree();
OSL_ENSURE(pContext, "Context tree must be set before rebuilding");
rtl::Reference<view::ViewStrategy> xContextBehavior = pContext->getViewBehavior();
- data::TreeAccessor aElementAccessor = this->getDataAccess().getElementTree(_aName);
- OSL_ENSURE(aElementAccessor != NULL, "Element Tree not found in data");
+ sharable::TreeFragment * elementAccessor = this->getDataAccess()->getElement(_aName);
+ OSL_ENSURE(elementAccessor != 0, "Element Tree not found in data");
OSL_ENSURE(_aElement.isValid(), "Element not found in view");
- _aElement->rebuild(xContextBehavior,aElementAccessor);
+ _aElement->rebuild(xContextBehavior, elementAccessor);
}
//-----------------------------------------------------------------------------
-std::auto_ptr<SubtreeChange> DeferredSetNodeImpl::preCommitChanges(ElementList& _rRemovedElements)
+std::auto_ptr<SubtreeChange> DeferredSetNodeImpl::preCommitChanges(std::vector< rtl::Reference<ElementTree> >& _rRemovedElements)
{
- data::NodeAccess aOriginalData = this->getOriginalNodeAccess();
+ sharable::Node * originalData = this->getOriginalNodeAccess();
// now first get the name of this node
- Name sSetName = aOriginalData.getName();
+ rtl::OUString sSetName = originalData->getName();
// and make a SubtreeChange
- std::auto_ptr<SubtreeChange> pSetChange( new SubtreeChange(sSetName.toString(),
- getElementTemplate()->getName().toString(),
- getElementTemplate()->getModule().toString(),
- aOriginalData->getAttributes() ) );
+ std::auto_ptr<SubtreeChange> pSetChange( new SubtreeChange(sSetName,
+ getElementTemplate()->getName(),
+ getElementTemplate()->getModule(),
+ originalData->getAttributes() ) );
// commit preexisting nodes
{
- for(ElementSet::PairIterator it = SetNodeImpl::beginElementSet(), stop = SetNodeImpl::endElementSet();
+ for(ElementSet::Data::const_iterator it = SetNodeImpl::beginElementSet(), stop = SetNodeImpl::endElementSet();
it != stop;
++it)
{
@@ -559,7 +555,7 @@ std::auto_ptr<SubtreeChange> DeferredSetNodeImpl::preCommitChanges(ElementList&
OSL_ASSERT(it->second.isValid());
OSL_ENSURE( !m_bDefault || it->second.inDefault, "m_bDefault is inconsistent");
- view::ViewTreeAccess aElementView(*it->second);
+ view::ViewTreeAccess aElementView(it->second.get());
std::auto_ptr<SubtreeChange> pNewChange = aElementView.preCommitChanges(_rRemovedElements);
if (pNewChange.get() != 0)
{
@@ -573,19 +569,19 @@ std::auto_ptr<SubtreeChange> DeferredSetNodeImpl::preCommitChanges(ElementList&
// commit added and deleted nodes
{
- ElementSet::PairIterator it = m_aChangedData.beginNative();
- ElementSet::PairIterator const stop = m_aChangedData.endNative();
+ ElementSet::Data::const_iterator it = m_aChangedData.beginNative();
+ ElementSet::Data::const_iterator const stop = m_aChangedData.endNative();
while(it != stop)
{
- Name aName = it->first;
- Element aNewElement = it->second;
+ rtl::OUString aName = it->first;
+ ElementTreeData aNewElement = it->second;
- Element* pOriginal = SetNodeImpl::getStoredElement(aName);
+ ElementTreeData* pOriginal = SetNodeImpl::getStoredElement(aName);
if (aNewElement.isValid())
{
- data::TreeSegment aAddedTree = aNewElement->releaseOwnedTree();
+ rtl::Reference< data::TreeSegment > aAddedTree = aNewElement->releaseOwnedTree();
if (!aAddedTree.is())
{
throw Exception("INTERNAL ERROR: Could not find data for the added ElementTree");
@@ -593,7 +589,7 @@ std::auto_ptr<SubtreeChange> DeferredSetNodeImpl::preCommitChanges(ElementList&
OSL_ENSURE( !m_bDefault || aNewElement.inDefault, "m_bDefault is inconsistent");
- AddNode* pAddNode = new AddNode(aAddedTree, aName.toString(), aNewElement.inDefault );
+ AddNode* pAddNode = new AddNode(aAddedTree, aName, aNewElement.inDefault );
std::auto_ptr<Change> pNewChange( pAddNode );
@@ -608,7 +604,7 @@ std::auto_ptr<SubtreeChange> DeferredSetNodeImpl::preCommitChanges(ElementList&
{
OSL_ENSURE( !m_bDefault || aNewElement.inDefault, "m_bDefault is inconsistent");
- std::auto_ptr<Change> pNewChange( new RemoveNode(aName.toString(),aNewElement.inDefault) );
+ std::auto_ptr<Change> pNewChange( new RemoveNode(aName,aNewElement.inDefault) );
pSetChange->addChange(pNewChange);
}
@@ -629,22 +625,22 @@ std::auto_ptr<SubtreeChange> DeferredSetNodeImpl::preCommitChanges(ElementList&
void DeferredSetNodeImpl::finishCommit(SubtreeChange& rChanges)
{
OSL_ENSURE(rChanges.isSetNodeChange(),"ERROR: Change type GROUP does not match set");
- OSL_ENSURE( rChanges.getElementTemplateName() == getElementTemplate()->getName().toString(),
+ OSL_ENSURE( rChanges.getElementTemplateName() == getElementTemplate()->getName(),
"ERROR: Element template of change does not match the template of the set");
- OSL_ENSURE( rChanges.getElementTemplateModule() == getElementTemplate()->getModule().toString(),
+ OSL_ENSURE( rChanges.getElementTemplateModule() == getElementTemplate()->getModule(),
"ERROR: Element template module of change does not match the template of the set");
for(SubtreeChange::MutatingChildIterator it = rChanges.begin_changes(), stop = rChanges.end_changes();
it != stop;
++it)
{
- Name aElementName = makeElementName(it->getNodeName(), Name::NoValidate());
+ rtl::OUString aElementName(it->getNodeName());
- Element* pOriginal = getStoredElement(aElementName);
+ ElementTreeData* pOriginal = getStoredElement(aElementName);
- if (Element* pNewElement = m_aChangedData.getElement(aElementName))
+ if (ElementTreeData* pNewElement = m_aChangedData.getElement(aElementName))
{
- Element aOriginal;
+ ElementTreeData aOriginal;
if (pOriginal)
{
aOriginal = *pOriginal;
@@ -654,18 +650,17 @@ void DeferredSetNodeImpl::finishCommit(SubtreeChange& rChanges)
OSL_ASSERT(!aOriginal.isValid());
// handle a added, replaced or deleted node
- data::TreeSegment aRemovedTree;
+ rtl::Reference< data::TreeSegment > aRemovedTree;
if (pNewElement->isValid())
{
- OSL_ENSURE( it->ISA(AddNode) , "Unexpected type of element change");
- if (!it->ISA(AddNode)) throw Exception("Unexpected type of element change");
-
- AddNode& rAddNode = static_cast<AddNode&>(*it);
+ AddNode * addNode = dynamic_cast< AddNode * >(&*it);
+ OSL_ENSURE(addNode != 0, "Unexpected type of element change");
+ if (addNode == 0) throw Exception("Unexpected type of element change");
- aRemovedTree = rAddNode.getReplacedTree();
- OSL_ASSERT( rAddNode.isReplacing() == (0!=pOriginal) );
- OSL_ASSERT( rAddNode.isReplacing() == aRemovedTree.is() );
+ aRemovedTree = addNode->getReplacedTree();
+ OSL_ASSERT( addNode->isReplacing() == (0!=pOriginal) );
+ OSL_ASSERT( addNode->isReplacing() == aRemovedTree.is() );
if (aOriginal.isValid())
SetNodeImpl::replaceElement(aElementName,*pNewElement);
@@ -677,11 +672,11 @@ void DeferredSetNodeImpl::finishCommit(SubtreeChange& rChanges)
}
else
{
- OSL_ENSURE( it->ISA(RemoveNode) , "Unexpected type of element change");
- if (!it->ISA(RemoveNode)) throw Exception("Unexpected type of element change");
+ RemoveNode * removeNode = dynamic_cast< RemoveNode * >(&*it);
+ OSL_ENSURE(removeNode != 0, "Unexpected type of element change");
+ if (removeNode == 0) throw Exception("Unexpected type of element change");
- RemoveNode& rRemoveNode = static_cast<RemoveNode&>(*it);
- aRemovedTree = rRemoveNode.getRemovedTree();
+ aRemovedTree = removeNode->getRemovedTree();
OSL_ASSERT(aOriginal.isValid());
if (aOriginal.isValid())
@@ -701,12 +696,13 @@ void DeferredSetNodeImpl::finishCommit(SubtreeChange& rChanges)
// handle preexisting nodes
//OSL_ENSURE(!containsValues(), "Unexpected change to value set element");
OSL_ENSURE(pOriginal && pOriginal->isValid(), "Changed Element is missing");
- OSL_ENSURE(it->ISA(SubtreeChange), "Unexpected type of element change");
+ SubtreeChange * subtreeChange = dynamic_cast< SubtreeChange * >(&*it);
+ OSL_ENSURE(subtreeChange != 0, "Unexpected type of element change");
- if (!it->ISA(SubtreeChange)) throw Exception("Unexpected set element change");
+ if (subtreeChange == 0) throw Exception("Unexpected set element change");
if (pOriginal && pOriginal->isValid())
- view::ViewTreeAccess(**pOriginal).finishCommit(static_cast<SubtreeChange&>(*it));
+ view::ViewTreeAccess(pOriginal->get()).finishCommit(*subtreeChange);
}
}
m_bChanged = false;
@@ -718,9 +714,9 @@ void DeferredSetNodeImpl::finishCommit(SubtreeChange& rChanges)
void DeferredSetNodeImpl::revertCommit(SubtreeChange& rChanges)
{
OSL_ENSURE(rChanges.isSetNodeChange(),"ERROR: Change type GROUP does not match set");
- OSL_ENSURE( rChanges.getElementTemplateName() == getElementTemplate()->getName().toString(),
+ OSL_ENSURE( rChanges.getElementTemplateName() == getElementTemplate()->getName(),
"ERROR: Element template of change does not match the template of the set");
- OSL_ENSURE( rChanges.getElementTemplateModule() == getElementTemplate()->getModule().toString(),
+ OSL_ENSURE( rChanges.getElementTemplateModule() == getElementTemplate()->getModule(),
"ERROR: Element template module of change does not match the template of the set");
@@ -728,29 +724,28 @@ void DeferredSetNodeImpl::revertCommit(SubtreeChange& rChanges)
it != stop;
++it)
{
- Name aElementName = makeElementName(it->getNodeName(), Name::NoValidate());
+ rtl::OUString aElementName(it->getNodeName());
- Element* pOriginal = getStoredElement(aElementName);
+ ElementTreeData* pOriginal = getStoredElement(aElementName);
- if (Element* pNewElement = m_aChangedData.getElement(aElementName))
+ if (ElementTreeData* pNewElement = m_aChangedData.getElement(aElementName))
{
// handle a added, replaced or deleted node
- data::TreeSegment pRemovedTree;
+ rtl::Reference< data::TreeSegment > pRemovedTree;
if (pNewElement->isValid())
{
- OSL_ENSURE( it->ISA(AddNode) , "Unexpected type of element change");
- if (!it->ISA(AddNode)) throw Exception("Unexpected type of element change");
+ AddNode * addNode = dynamic_cast< AddNode * >(&*it);
+ OSL_ENSURE(addNode != 0, "Unexpected type of element change");
+ if (addNode == 0) throw Exception("Unexpected type of element change");
- AddNode& rAddNode = static_cast<AddNode&>(*it);
-
- pRemovedTree = rAddNode.getReplacedTree();
- OSL_ASSERT( rAddNode.isReplacing() == (0!=pOriginal) );
- OSL_ASSERT( rAddNode.isReplacing() == (0!=pRemovedTree.is()) );
+ pRemovedTree = addNode->getReplacedTree();
+ OSL_ASSERT( addNode->isReplacing() == (0!=pOriginal) );
+ OSL_ASSERT( addNode->isReplacing() == (0!=pRemovedTree.is()) );
- OSL_ENSURE(!rAddNode.wasInserted(), "Cannot retract new node: Change was integrated");
+ OSL_ENSURE(!addNode->wasInserted(), "Cannot retract new node: Change was integrated");
- data::TreeSegment aAddedTree = rAddNode.getNewTree();
+ rtl::Reference< data::TreeSegment > aAddedTree = addNode->getNewTree();
OSL_ENSURE(aAddedTree.is(), "Cannot restore new node: Change lost ownership");
// restore the tree
@@ -758,18 +753,18 @@ void DeferredSetNodeImpl::revertCommit(SubtreeChange& rChanges)
}
else
{
- OSL_ENSURE( it->ISA(RemoveNode) , "Unexpected type of element change");
- if (!it->ISA(RemoveNode)) throw Exception("Unexpected type of element change");
+ RemoveNode * removeNode = dynamic_cast< RemoveNode * >(&*it);
+ OSL_ENSURE(removeNode != 0, "Unexpected type of element change");
+ if (removeNode == 0) throw Exception("Unexpected type of element change");
- RemoveNode& rRemoveNode = static_cast<RemoveNode&>(*it);
- pRemovedTree = rRemoveNode.getRemovedTree();
+ pRemovedTree = removeNode->getRemovedTree();
OSL_ASSERT(pOriginal);
OSL_ASSERT((0 != pOriginal) == (0!=pRemovedTree.is()) );
}
OSL_ENSURE(pRemovedTree.is(), "Possible problems reverting removed node: Change took ownership");
// try handle a added or deleted node
- if (pOriginal && pRemovedTree.is())
+ if (pOriginal)
{
OSL_ASSERT(pOriginal->isValid());
(*pOriginal)->takeTreeAndRebuild(pRemovedTree);
@@ -782,12 +777,13 @@ void DeferredSetNodeImpl::revertCommit(SubtreeChange& rChanges)
// handle preexisting nodes
//OSL_ENSURE(!containsValues(), "Unexpected change to value set element");
OSL_ENSURE(pOriginal && pOriginal->isValid(), "Changed Element is missing");
- OSL_ENSURE(it->ISA(SubtreeChange), "Unexpected set element change");
+ SubtreeChange * subtreeChange = dynamic_cast< SubtreeChange * >(&*it);
+ OSL_ENSURE(subtreeChange != 0, "Unexpected set element change");
- if (!it->ISA(SubtreeChange)) throw Exception("Unexpected set element change");
+ if (subtreeChange == 0) throw Exception("Unexpected set element change");
if (pOriginal && pOriginal->isValid())
- view::ViewTreeAccess(**pOriginal).revertCommit(static_cast<SubtreeChange&>(*it));
+ view::ViewTreeAccess(pOriginal->get()).revertCommit(*subtreeChange);
}
}
}
@@ -796,22 +792,22 @@ void DeferredSetNodeImpl::revertCommit(SubtreeChange& rChanges)
void DeferredSetNodeImpl::failedCommit(SubtreeChange& rChanges)
{
OSL_ENSURE(rChanges.isSetNodeChange(),"ERROR: Change type GROUP does not match set");
- OSL_ENSURE( rChanges.getElementTemplateName() == getElementTemplate()->getName().toString(),
+ OSL_ENSURE( rChanges.getElementTemplateName() == getElementTemplate()->getName(),
"ERROR: Element template of change does not match the template of the set");
- OSL_ENSURE( rChanges.getElementTemplateModule() == getElementTemplate()->getModule().toString(),
+ OSL_ENSURE( rChanges.getElementTemplateModule() == getElementTemplate()->getModule(),
"ERROR: Element template module of change does not match the template of the set");
for(SubtreeChange::MutatingChildIterator it = rChanges.begin_changes(), stop = rChanges.end_changes();
it != stop;
++it)
{
- Name aElementName = makeElementName(it->getNodeName(), Name::NoValidate());
+ rtl::OUString aElementName(it->getNodeName());
- Element* pOriginal = getStoredElement(aElementName);
+ ElementTreeData* pOriginal = getStoredElement(aElementName);
- if (Element* pNewElement = m_aChangedData.getElement(aElementName))
+ if (ElementTreeData* pNewElement = m_aChangedData.getElement(aElementName))
{
- Element aOriginal;
+ ElementTreeData aOriginal;
if (pOriginal)
{
aOriginal = *pOriginal;
@@ -821,22 +817,21 @@ void DeferredSetNodeImpl::failedCommit(SubtreeChange& rChanges)
OSL_ASSERT(!aOriginal.isValid());
// handle a added, replaced or deleted node
- data::TreeSegment aRemovedTree;
+ rtl::Reference< data::TreeSegment > aRemovedTree;
if (pNewElement->isValid())
{
- OSL_ENSURE( it->ISA(AddNode) , "Unexpected type of element change");
- if (!it->ISA(AddNode)) throw Exception("Unexpected type of element change");
+ AddNode * addNode = dynamic_cast< AddNode * >(&*it);
+ OSL_ENSURE(addNode != 0, "Unexpected type of element change");
+ if (addNode == 0) throw Exception("Unexpected type of element change");
- AddNode& rAddNode = static_cast<AddNode&>(*it);
+ aRemovedTree = addNode->getReplacedTree();
+ OSL_ASSERT( addNode->isReplacing() == (0!=pOriginal) );
+ OSL_ASSERT( addNode->isReplacing() == aRemovedTree.is() );
- aRemovedTree = rAddNode.getReplacedTree();
- OSL_ASSERT( rAddNode.isReplacing() == (0!=pOriginal) );
- OSL_ASSERT( rAddNode.isReplacing() == aRemovedTree.is() );
-
- if (rAddNode.wasInserted())
+ if (addNode->wasInserted())
{ // it has been integrated into the master tree
- OSL_ENSURE(getDataAccess().getElementTree(aElementName) == rAddNode.getInsertedTree(),
+ OSL_ENSURE(getDataAccess()->getElement(aElementName) == addNode->getInsertedTree(),
"Internal Error: Inserted tree address does not match actual data");
// so add it
@@ -850,24 +845,23 @@ void DeferredSetNodeImpl::failedCommit(SubtreeChange& rChanges)
}
else // Change not done; need to restore new node (element will be released into the wild then)
{
- data::TreeSegment aAddedTree = rAddNode.getNewTree();
+ rtl::Reference< data::TreeSegment > aAddedTree = addNode->getNewTree();
OSL_ENSURE(aAddedTree.is(), "Unexpected: added node is gone, but where ? May cause invalid references");
- if (aAddedTree.is())
- (*pNewElement)->takeTreeBack(aAddedTree);
+ (*pNewElement)->takeTreeBack(aAddedTree);
detach(*pNewElement);
}
}
else
{
- OSL_ENSURE( it->ISA(RemoveNode) , "Unexpected type of element change");
- if (!it->ISA(RemoveNode)) throw Exception("Unexpected type of element change");
+ RemoveNode * removeNode = dynamic_cast< RemoveNode * >(&*it);
+ OSL_ENSURE(removeNode != 0, "Unexpected type of element change");
+ if (removeNode == 0) throw Exception("Unexpected type of element change");
- RemoveNode& rRemoveNode = static_cast<RemoveNode&>(*it);
- aRemovedTree = rRemoveNode.getRemovedTree();
+ aRemovedTree = removeNode->getRemovedTree();
OSL_ASSERT(aOriginal.isValid());
- if (aRemovedTree.is() && !getDataAccess().hasElement(aElementName))
+ if (aRemovedTree.is() && getDataAccess()->getElement(aElementName) == 0)
{
// really removed - then remove the originel
if (aOriginal.isValid())
@@ -891,12 +885,13 @@ void DeferredSetNodeImpl::failedCommit(SubtreeChange& rChanges)
// handle preexisting nodes
//OSL_ENSURE(!containsValues(), "Unexpected change to value set element");
OSL_ENSURE(pOriginal && pOriginal->isValid(), "Changed Element is missing");
- OSL_ENSURE(it->ISA(SubtreeChange), "Unexpected set element change");
+ SubtreeChange * subtreeChange = dynamic_cast< SubtreeChange * >(&*it);
+ OSL_ENSURE(subtreeChange != 0, "Unexpected set element change");
- if (!it->ISA(SubtreeChange)) throw Exception("Unexpected set element change");
+ if (subtreeChange == 0) throw Exception("Unexpected set element change");
if (pOriginal && pOriginal->isValid())
- view::ViewTreeAccess(**pOriginal).recoverFailedCommit(static_cast<SubtreeChange&>(*it));
+ view::ViewTreeAccess(pOriginal->get()).recoverFailedCommit(*subtreeChange);
}
}
m_bChanged = false;
@@ -906,13 +901,13 @@ void DeferredSetNodeImpl::failedCommit(SubtreeChange& rChanges)
}
//-----------------------------------------------------------------------------
-void DeferredSetNodeImpl::insertNewElement(Name const& aName, Element const& aNewElement)
+void DeferredSetNodeImpl::insertNewElement(rtl::OUString const& aName, ElementTreeData const& aNewElement)
{
attach(aNewElement,aName);
try
{
// put the new element into the changed set
- Element* pAddedElement = m_aChangedData.getElement(aName);
+ ElementTreeData* pAddedElement = m_aChangedData.getElement(aName);
if (pAddedElement)
{
OSL_ENSURE(!pAddedElement->isValid(),"WARNING: Element being inserted was already there - replacing");
@@ -933,24 +928,24 @@ void DeferredSetNodeImpl::insertNewElement(Name const& aName, Element const& aNe
}
//-------------------------------------------------------------------------
-void DeferredSetNodeImpl::removeOldElement(Name const& aName)
+void DeferredSetNodeImpl::removeOldElement(rtl::OUString const& aName)
{
// put an empty (dummy) element into the changed set
- Element* pAddedElement = m_aChangedData.getElement(aName);
+ ElementTreeData* pAddedElement = m_aChangedData.getElement(aName);
if (pAddedElement)
{
OSL_ENSURE(pAddedElement->isValid(),"WARNING: Element being removed was already removed");
- detach(m_aChangedData.replaceElement(aName, Element()));
+ detach(m_aChangedData.replaceElement(aName, ElementTreeData()));
m_bChanged = true;
m_bDefault = false;
}
else
{
- m_aChangedData.insertElement(aName, Element());
+ m_aChangedData.insertElement(aName, ElementTreeData());
}
// now check the original one
- Element* pOldElement = getStoredElement(aName);
+ ElementTreeData* pOldElement = getStoredElement(aName);
if (pOldElement)
{
OSL_ASSERT(pOldElement->isValid());
@@ -967,28 +962,25 @@ void DeferredSetNodeImpl::removeOldElement(Name const& aName)
}
//-----------------------------------------------------------------------------
-SetElementChangeImpl* DeferredSetNodeImpl::doAdjustChangedElement(NodeChangesInformation& rLocalChanges, Name const& aName, Change const& aChange)
+SetElementChangeImpl* DeferredSetNodeImpl::doAdjustChangedElement(NodeChangesInformation& rLocalChanges, rtl::OUString const& aName, Change const& aChange)
{
- if (Element* pLocalElement = m_aChangedData.getElement(aName))
+ if (ElementTreeData* pLocalElement = m_aChangedData.getElement(aName))
{
- if (Element* pElement = getStoredElement(aName))
+ if (ElementTreeData* pElement = getStoredElement(aName))
{
OSL_ASSERT(pElement->isValid());
- if (aChange.ISA(SubtreeChange))
+ if (SubtreeChange const * subtreeChange = dynamic_cast< SubtreeChange const * >(&aChange))
{
- //OSL_ENSURE( !containsValues(), "Unexpected kind of change: Tree change applied to value set element" );
- SubtreeChange const& aSubtreeChange = static_cast<SubtreeChange const&>(aChange);
-
// recurse to element tree - but do not notify those changes (?)
- view::Tree aElementTree(**pElement);
+ Tree * elementTree = pElement->get();
NodeChangesInformation aIgnoredChanges;
- view::getViewBehavior(aElementTree)->adjustToChanges(aIgnoredChanges,view::getRootNode(aElementTree),aSubtreeChange);
+ view::getViewBehavior(elementTree)->adjustToChanges(aIgnoredChanges, view::getRootNode(elementTree), *subtreeChange);
}
else
{
- OSL_ENSURE( aChange.ISA(ValueChange), "Unexpected kind of change to value set element" );
+ OSL_ENSURE(dynamic_cast<ValueChange const * >(&aChange) != 0, "Unexpected kind of change to value set element" );
//OSL_ENSURE( containsValues(), "Unexpected kind of change: Value change applied to tree set element" );
}
@@ -1002,7 +994,7 @@ SetElementChangeImpl* DeferredSetNodeImpl::doAdjustChangedElement(NodeChangesInf
if (pLocalElement->isValid())
{
// we have a complete replacement for the changed node
- Element aLocalElement = *pLocalElement;
+ ElementTreeData aLocalElement = *pLocalElement;
// also signal something happened
return implCreateReplace(aName,aLocalElement,aLocalElement);
@@ -1020,10 +1012,10 @@ SetElementChangeImpl* DeferredSetNodeImpl::doAdjustChangedElement(NodeChangesInf
}
//-----------------------------------------------------------------------------
-SetElementChangeImpl* DeferredSetNodeImpl::doAdjustToAddedElement(Name const& aName, AddNode const& aAddNodeChange, Element const& aNewElement)
+SetElementChangeImpl* DeferredSetNodeImpl::doAdjustToAddedElement(rtl::OUString const& aName, AddNode const& aAddNodeChange, ElementTreeData const& aNewElement)
{
m_bDefault = false;
- if (Element* pLocalElement = m_aChangedData.getElement(aName))
+ if (ElementTreeData* pLocalElement = m_aChangedData.getElement(aName))
{
// We have another element replacing ours - what do we do ?
if (hasStoredElement(aName))
@@ -1041,7 +1033,7 @@ SetElementChangeImpl* DeferredSetNodeImpl::doAdjustToAddedElement(Name const& aN
if (pLocalElement->isValid()) // ours remains a valid replacement
{
- Element aLocalElement = *pLocalElement;
+ ElementTreeData aLocalElement = *pLocalElement;
// just signal something happened
return implCreateReplace(aName,aLocalElement,aLocalElement);
@@ -1059,10 +1051,10 @@ SetElementChangeImpl* DeferredSetNodeImpl::doAdjustToAddedElement(Name const& aN
}
//-----------------------------------------------------------------------------
-SetElementChangeImpl* DeferredSetNodeImpl::doAdjustToRemovedElement(Name const& aName, RemoveNode const& /*aRemoveNodeChange*/)
+SetElementChangeImpl* DeferredSetNodeImpl::doAdjustToRemovedElement(rtl::OUString const& aName, RemoveNode const& /*aRemoveNodeChange*/)
{
m_bDefault = false;
- if (Element* pLocalElement = m_aChangedData.getElement(aName))
+ if (ElementTreeData* pLocalElement = m_aChangedData.getElement(aName))
{
if (hasStoredElement(aName))
{
@@ -1072,7 +1064,7 @@ SetElementChangeImpl* DeferredSetNodeImpl::doAdjustToRemovedElement(Name const&
if (pLocalElement->isValid()) // remains a valid replacement
{
- Element aLocalElement = *pLocalElement;
+ ElementTreeData aLocalElement = *pLocalElement;
// signal something happened
return implCreateReplace(aName,aLocalElement,aLocalElement);
@@ -1095,30 +1087,30 @@ void DeferredSetNodeImpl::doDifferenceToDefaultState(SubtreeChange& _rChangeToDe
{
implDifferenceToDefaultState(_rChangeToDefault,_rDefaultTree);
- ElementSet::PairIterator it = m_aChangedData.beginNative();
- ElementSet::PairIterator const stop = m_aChangedData.endNative();
+ ElementSet::Data::const_iterator it = m_aChangedData.beginNative();
+ ElementSet::Data::const_iterator const stop = m_aChangedData.endNative();
while(it != stop)
{
- Name aName = it->first;
- Element aElement = it->second;
+ rtl::OUString aName = it->first;
+ ElementTreeData aElement = it->second;
- Change* pChange = _rChangeToDefault.getChange( aName.toString() );
- OSL_ENSURE(pChange == NULL || pChange->ISA(AddNode) || pChange->ISA(RemoveNode),
+ Change* pChange = _rChangeToDefault.getChange( aName );
+ OSL_ENSURE(pChange == NULL || dynamic_cast< AddNode * >(pChange) != 0 || dynamic_cast< RemoveNode * >(pChange) != 0,
"Unexpected change type found in difference to default tree");
if (pChange == NULL)
{
- std::auto_ptr<INode> aDefaultNode = _rDefaultTree.removeChild(aName.toString());
+ std::auto_ptr<INode> aDefaultNode = _rDefaultTree.removeChild(aName);
OSL_ENSURE( aDefaultNode.get(), "Error: unused Default tree not found after SetNodeImpl::implDifferenceToDefaultState");
- OUString aElementTypeName = _rDefaultTree.getElementTemplateName();
+ rtl::OUString aElementTypeName = _rDefaultTree.getElementTemplateName();
OSL_ENSURE( _rDefaultTree.isSetNode(), "Error: missing set template information in default data");
- data::TreeSegment aDefaultTree = data::TreeSegment::createNew(aDefaultNode,aElementTypeName);
- OSL_ENSURE( aDefaultTree.is(), "Error: unused Default tree not accessible after SetNodeImpl::implDifferenceToDefaultState");
+ rtl::Reference< data::TreeSegment > aDefaultTree = data::TreeSegment::create(aDefaultNode,aElementTypeName);
+ OSL_ENSURE(aDefaultTree.is(), "Error: unused Default tree not accessible after SetNodeImpl::implDifferenceToDefaultState");
- AddNode* pAddIt = new AddNode(aDefaultTree, aName.toString(), true );
+ AddNode* pAddIt = new AddNode(aDefaultTree, aName, true );
std::auto_ptr<Change> pNewChange( pAddIt );
@@ -1131,39 +1123,37 @@ void DeferredSetNodeImpl::doDifferenceToDefaultState(SubtreeChange& _rChangeToDe
_rChangeToDefault.addChange(pNewChange);
}
- else if ( pChange->ISA(AddNode) )
+ else if (AddNode * addNode = dynamic_cast< AddNode * >(pChange))
{
// adjust the AddNode - remove the original expected node
- AddNode* pAddIt = static_cast<AddNode*>(pChange);
- pAddIt->clearReplacedTree();
+ addNode->clearReplacedTree();
if (aElement.isValid())
{
if (aElement.inDefault)
{
// change already done locally
- _rChangeToDefault.removeChange(aName.toString());
+ _rChangeToDefault.removeChange(aName);
}
else // adjust here
- pAddIt->setReplacing();
+ addNode->setReplacing();
}
else
- OSL_ENSURE(!pAddIt->isReplacing(),"Could not unmark the 'replacing' state of an AddNode");
+ OSL_ENSURE(!addNode->isReplacing(),"Could not unmark the 'replacing' state of an AddNode");
}
- else if ( pChange->ISA(RemoveNode) )
+ else if (RemoveNode * removeNode = dynamic_cast< RemoveNode * >(pChange))
{
if (aElement.isValid())
{
OSL_ENSURE(!aElement.inDefault, "Default element replaced by default");
// adjust the RemoveNode - remove the original expected node
- RemoveNode* pRemoveIt = static_cast<RemoveNode*>(pChange);
- pRemoveIt->clearRemovedTree();
+ removeNode->clearRemovedTree();
}
else
{
// change already done locally
- _rChangeToDefault.removeChange(aName.toString());
+ _rChangeToDefault.removeChange(aName);
}
// TODO: mark local removal as to-default
}
diff --git a/configmgr/source/treemgr/nodeimplobj.hxx b/configmgr/source/treemgr/nodeimplobj.hxx
index e4822df977..4aa2431958 100644
--- a/configmgr/source/treemgr/nodeimplobj.hxx
+++ b/configmgr/source/treemgr/nodeimplobj.hxx
@@ -31,6 +31,10 @@
#ifndef CONFIGMGR_NODEIMPLOBJECTS_HXX_
#define CONFIGMGR_NODEIMPLOBJECTS_HXX_
+#include "sal/config.h"
+
+#include "salhelper/simplereferenceobject.hxx"
+
#include "node.hxx"
#include "nodeimpl.hxx"
#include "groupnodeimpl.hxx"
@@ -55,38 +59,34 @@ namespace configmgr
// Value Nodes
//-----------------------------------------------------------------------------
- class ValueMemberNode::DeferredImpl : public configmgr::SimpleReferenceObject
+ class ValueMemberNode::DeferredImpl : public salhelper::SimpleReferenceObject
{
- data::ValueNodeAddress m_aValueRef;
+ sharable::ValueNode * m_valueNode;
- UnoAny m_aNewValue;
+ com::sun::star::uno::Any m_aNewValue;
bool m_bToDefault;
bool m_bChange;
public:
- explicit DeferredImpl(data::ValueNodeAccess const& _aValueNode);
+ explicit DeferredImpl(sharable::ValueNode * valueNode);
/// does this wrap a change
bool isChange() const { return m_bChange; }
- /// retrieve the underlying (original) node location
- data::ValueNodeAddress getOriginalNodeAddress() const
- { return m_aValueRef; }
-
/// retrieve the underlying (original) node
- data::ValueNodeAccess getOriginalNode() const
- { return data::ValueNodeAccess(m_aValueRef); }
+ sharable::ValueNode * getOriginalNode() const
+ { return m_valueNode; }
/// Does this node change to default
bool isToDefault() const { return m_bToDefault; }
/// retrieve the current value of this node
- UnoAny getNewValue() const { return m_aNewValue; }
+ com::sun::star::uno::Any getNewValue() const { return m_aNewValue; }
/// Set this node to a new value
- void setValue(UnoAny const& aNewValue, data::ValueNodeAccess const& _aOriginalNode);
+ void setValue(com::sun::star::uno::Any const& aNewValue, sharable::ValueNode * originalNode);
/// Set this node to assume its default value
- void setValueToDefault(data::ValueNodeAccess const& _aOriginalNode);
+ void setValueToDefault(sharable::ValueNode * originalNode);
public:
// commit protocol
@@ -99,7 +99,7 @@ namespace configmgr
ValueChangeImpl* adjustToChange(ValueChange const& rExternalChange);
// notification protocol
- void adjustToChange(NodeChangesInformation& rLocalChange, ValueChange const& rExternalChange, TreeImpl& rParentTree, NodeOffset nParentPos, Name const& aName);
+ void adjustToChange(NodeChangesInformation& rLocalChange, ValueChange const& rExternalChange, Tree& rParentTree, unsigned int nParentPos, rtl::OUString const& aName);
};
//-----------------------------------------------------------------------------
@@ -113,9 +113,9 @@ namespace configmgr
{
public:
explicit
- DeferredGroupNodeImpl(data::GroupNodeAddress const& _aNodeRef);
+ DeferredGroupNodeImpl(sharable::GroupNode * const& _aNodeRef);
explicit
- DeferredGroupNodeImpl(data::GroupNodeAddress const& _aNewAddress, GroupNodeImpl& rOriginal);
+ DeferredGroupNodeImpl(sharable::GroupNode * const& _aNewAddress, GroupNodeImpl& rOriginal);
~DeferredGroupNodeImpl();
@@ -126,21 +126,20 @@ namespace configmgr
void revertCommit(SubtreeChange& rChange);
void failedCommit(SubtreeChange& rChange);
- void collectValueChanges(NodeChanges& rChanges, TreeImpl* pParent, NodeOffset nNode) const;
+ void collectValueChanges(NodeChanges& rChanges, Tree* pParent, unsigned int nNode) const;
public:
// data access
bool hasChanges() const;
void markChanged();
- typedef ValueMemberNode::DeferredImplRef MemberChange;
- MemberChange findValueChange(Name const& aName);
+ rtl::Reference<ValueMemberNode::DeferredImpl> findValueChange(rtl::OUString const& aName);
using GroupNodeImpl::makeValueMember;
- ValueMemberNode makeValueMember(Name const& _aName, bool _bForUpdate);
+ ValueMemberNode makeValueMember(rtl::OUString const& _aName, bool _bForUpdate);
private:
- typedef std::map< Name, MemberChange > MemberChanges;
+ typedef std::map< rtl::OUString, rtl::Reference<ValueMemberNode::DeferredImpl> > MemberChanges;
MemberChanges m_aChanges;
};
@@ -153,7 +152,7 @@ namespace configmgr
{
public:
explicit
- DeferredSetNodeImpl(data::SetNodeAddress const& _aNodeRef, Template* pTemplate);
+ DeferredSetNodeImpl(sharable::SetNode * const& _aNodeRef, Template* pTemplate);
public:
bool hasChanges() const;
@@ -161,32 +160,32 @@ namespace configmgr
void collectElementChanges(NodeChanges& rChanges) const;
public:
- std::auto_ptr<SubtreeChange> preCommitChanges(ElementList& _rRemovedElements);
+ std::auto_ptr<SubtreeChange> preCommitChanges(std::vector< rtl::Reference<ElementTree> >& _rRemovedElements);
void failedCommit(SubtreeChange& rChanges);
void finishCommit(SubtreeChange& rChanges);
void revertCommit(SubtreeChange& rChanges);
- void insertNewElement(Name const& aName, Element const& aNewElement);
- void removeOldElement(Name const& aName);
+ void insertNewElement(rtl::OUString const& aName, ElementTreeData const& aNewElement);
+ void removeOldElement(rtl::OUString const& aName);
// Base Overrideables
private:
// NodeImpl implementation
virtual bool doIsEmpty() const;
- virtual ElementTreeImpl* doFindElement(Name const& aName) ;
+ virtual ElementTree* doFindElement(rtl::OUString const& aName) ;
virtual SetNodeVisitor::Result doDispatchToElements(SetNodeVisitor& aVisitor);
virtual void doDifferenceToDefaultState(SubtreeChange& _rChangeToDefault, ISubtree& _rDefaultTree);
- virtual SetElementChangeImpl* doAdjustToAddedElement(Name const& aName, AddNode const& aAddNodeChange, Element const & aNewElement);
- virtual SetElementChangeImpl* doAdjustToRemovedElement(Name const& aName, RemoveNode const& aRemoveNodeChange);
+ virtual SetElementChangeImpl* doAdjustToAddedElement(rtl::OUString const& aName, AddNode const& aAddNodeChange, ElementTreeData const & aNewElement);
+ virtual SetElementChangeImpl* doAdjustToRemovedElement(rtl::OUString const& aName, RemoveNode const& aRemoveNodeChange);
- virtual SetElementChangeImpl* doAdjustChangedElement(NodeChangesInformation& rLocalChanges, Name const& aName, Change const& aChange);
+ virtual SetElementChangeImpl* doAdjustChangedElement(NodeChangesInformation& rLocalChanges, rtl::OUString const& aName, Change const& aChange);
virtual void doTransferElements(ElementSet& rReplacement);
// Implementation
private:
- void rebuildElement(Name const& aName, Element const& _aElement);
+ void rebuildElement(rtl::OUString const& aName, ElementTreeData const& _aElement);
private:
ElementSet m_aChangedData;
diff --git a/configmgr/source/treemgr/noderef.cxx b/configmgr/source/treemgr/noderef.cxx
index 905fe7900d..7b2c36ba71 100644
--- a/configmgr/source/treemgr/noderef.cxx
+++ b/configmgr/source/treemgr/noderef.cxx
@@ -34,7 +34,7 @@
#include "anynoderef.hxx"
#include "valueref.hxx"
#include "noderef.hxx"
-#include "treeimpl.hxx"
+#include "tree.hxx"
#include "viewaccess.hxx"
#include "configpath.hxx"
#include "nodechange.hxx"
@@ -56,182 +56,15 @@ namespace configmgr
namespace configuration
{
//-----------------------------------------------------------------------------
-// helpers first
-
-view::ViewTreeAccess Tree::getView() const
-{
- OSL_ENSURE(!isEmpty(),"Accessing view for tree: Tree must not be nil");
- return view::ViewTreeAccess(*m_ref);
-}
-//-----------------------------------------------------------------------------
-// class TreeImplHelper (declared in treeimpl.hxx)
-//-----------------------------------------------------------------------------
-
-NodeRef TreeImplHelper::makeNode(NodeOffset nOffset, TreeDepth nDepth)
-{
- return NodeRef(nOffset,nDepth);
-}
-//-----------------------------------------------------------------------------
-
-NodeRef TreeImplHelper::makeNode(TreeImpl& rTree, NodeOffset nOffset)
-{
- if (nOffset)
- {
- OSL_ASSERT(rTree.isValidNode(nOffset));
-
- TreeDepth nDepth = remainingDepth(rTree.getAvailableDepth(), rTree.depthTo(nOffset));
- return NodeRef(nOffset,nDepth);
- }
- else
- return NodeRef();
-}
-//-----------------------------------------------------------------------------
-
-NodeRef TreeImplHelper::makeNode(NodeID const& aNodeID)
-{
- if (TreeImpl* pTree = aNodeID.m_pTree)
- {
- return makeNode(*pTree,aNodeID.m_nNode);
- }
- else
- return NodeRef();
-}
-//-----------------------------------------------------------------------------
-
-ValueRef TreeImplHelper::makeValue(Name const& aName, NodeOffset nParentOffset)
-{
- return ValueRef(aName,nParentOffset);
-}
-//-----------------------------------------------------------------------------
-
-TreeImpl* TreeImplHelper::impl(TreeRef const& aRef)
-{
- return aRef.get();
-}
-//-----------------------------------------------------------------------------
-
-TreeImpl* TreeImplHelper::impl(Tree const& aTree)
-{
- return aTree.m_ref.get();
-}
-//-----------------------------------------------------------------------------
-
-NodeOffset TreeImplHelper::offset(NodeRef const& aNode)
-{
- return aNode.m_nPos;
-}
-//-----------------------------------------------------------------------------
-
-NodeOffset TreeImplHelper::parent_offset(ValueRef const& aNode)
-{
- return aNode.m_nParentPos;
-}
-//-----------------------------------------------------------------------------
-
-Name TreeImplHelper::value_name(ValueRef const& aValueNode)
-{
- return aValueNode.m_sNodeName;
-}
-//-----------------------------------------------------------------------------
-
-TreeImpl* TreeImplHelper::tree(NodeID const& aNodeID)
-{
- return aNodeID.m_pTree;
-}
-//-----------------------------------------------------------------------------
-
-NodeOffset TreeImplHelper::offset(NodeID const& aNodeID)
-{
- return aNodeID.m_nNode;
-}
-//-----------------------------------------------------------------------------
-
-ValueMemberNode TreeImplHelper::member_node(Tree const & _aTree, ValueRef const& aValueNode)
-{
- OSL_ENSURE(!_aTree.isEmpty(),"INTERNAL ERROR: member_node: NULL tree passed");
- view::ViewTreeAccess aView = _aTree.getView();
-
- return aView.getValue(aView.getGroupNodeAt(aValueNode.m_nParentPos), aValueNode.m_sNodeName );
-}
-
-//-----------------------------------------------------------------------------
// local helpers
//-----------------------------------------------------------------------------
namespace
{
//-----------------------------------------------------------------------------
- struct SetVisitorAdapter : SetNodeVisitor
- {
- SetVisitorAdapter(NodeVisitor& rVisitor)
- : m_rVisitor(rVisitor)
- {}
- Result visit(SetEntry const& anEntry);
-
- NodeVisitor& m_rVisitor;
- };
-
- SetNodeVisitor::Result SetVisitorAdapter::visit(SetEntry const& anEntry)
- {
- OSL_ASSERT(anEntry.isValid());
-
- Result aResult = CONTINUE;
-
- if (TreeImpl* pTree = anEntry.tree())
- {
- Tree aTree( pTree );
- NodeRef aTreeRoot = aTree.getRootNode();
-
- OSL_ASSERT( Result(NodeVisitor::DONE) == SetNodeVisitor::DONE );
- OSL_ASSERT( Result(NodeVisitor::CONTINUE) == SetNodeVisitor::CONTINUE );
-
- aResult = Result( aTree.visit(aTreeRoot,m_rVisitor) );
- }
-
- return aResult;
- }
-//-----------------------------------------------------------------------------
- struct GroupVisitorAdapter : GroupMemberVisitor
- {
- GroupVisitorAdapter(Tree const& aParentTree, NodeRef const& aParentNode, NodeVisitor& rVisitor)
- : m_rVisitor(rVisitor)
- , m_aParentTree(aParentTree)
- , m_nParentPos( TreeImplHelper::offset(aParentNode) )
- {
- OSL_ASSERT(!aParentTree.isEmpty());
- OSL_ASSERT(aParentNode.isValid());
- OSL_ASSERT(aParentTree.isValidNode(aParentNode));
-
- }
-
- Result visit(ValueMemberNode const& anEntry);
-
- NodeVisitor& m_rVisitor;
- Tree m_aParentTree;
- NodeOffset m_nParentPos;
- };
-
- GroupMemberVisitor::Result GroupVisitorAdapter::visit(ValueMemberNode const& aValue)
- {
- OSL_ASSERT(aValue.isValid());
-
- Result aResult = CONTINUE;
-
- Name aValueName = aValue.getNodeName();
-
- ValueRef const aValueRef = TreeImplHelper::makeValue(aValueName,m_nParentPos);
-
- OSL_ASSERT( Result(NodeVisitor::DONE) == GroupMemberVisitor::DONE );
- OSL_ASSERT( Result(NodeVisitor::CONTINUE) == GroupMemberVisitor::CONTINUE );
-
- aResult = Result( m_aParentTree.visit(aValueRef,m_rVisitor) );
-
- return aResult;
- }
-//-----------------------------------------------------------------------------
struct CollectValueIDs : GroupMemberVisitor
{
- CollectValueIDs(NodeID const& aParentID, SubNodeIDList& rValueList)
+ CollectValueIDs(NodeID const& aParentID, std::vector<SubNodeID>& rValueList)
: m_aParentID(aParentID)
, m_rValueList(rValueList)
{
@@ -240,57 +73,20 @@ namespace
Result visit(ValueMemberNode const& anEntry);
NodeID m_aParentID;
- SubNodeIDList& m_rValueList;
+ std::vector<SubNodeID>& m_rValueList;
};
GroupMemberVisitor::Result CollectValueIDs::visit(ValueMemberNode const& aValue)
{
OSL_ASSERT(aValue.isValid());
- Name aValueName = aValue.getNodeName();
+ rtl::OUString aValueName = aValue.getNodeName();
m_rValueList.push_back(SubNodeID( m_aParentID, aValueName));
return CONTINUE;
}
//-----------------------------------------------------------------------------
- struct FindNonDefaultElement : SetNodeVisitor
- {
- Result visit(SetEntry const& anEntry);
-
- static bool hasNonDefaultElement(view::ViewTreeAccess const& _aView, view::SetNode const& _aSet);
- };
-
- SetNodeVisitor::Result FindNonDefaultElement::visit(SetEntry const& anEntry)
- {
- OSL_ASSERT(anEntry.isValid());
-
- Result aResult = DONE; // if we find a NULL element we consider this
-
- if (TreeImpl* pTree = anEntry.tree())
- {
- Tree aTree( pTree );
-
- node::Attributes aElementAttributes = aTree.getAttributes(aTree.getRootNode());
-
- // a set element is considered default iff it is not replaced/added
- bool bDefault = !aElementAttributes.isReplacedForUser();
-
- aResult = bDefault ? CONTINUE : DONE;
- }
- else
- OSL_ENSURE(false,"Unexpected NULL SetEntry considered as non-default.");
-
- return aResult;
- }
-
- bool FindNonDefaultElement::hasNonDefaultElement(view::ViewTreeAccess const& _aView, view::SetNode const& _aSet)
- {
- FindNonDefaultElement aCheck;
- Result aRes = _aView.dispatchToElements(_aSet,aCheck);
- return aRes == DONE;
- }
-//-----------------------------------------------------------------------------
}
//-----------------------------------------------------------------------------
@@ -304,7 +100,7 @@ NodeRef::NodeRef()
}
//-----------------------------------------------------------------------------
-NodeRef::NodeRef(NodeOffset nPos, TreeDepth nDepth)
+NodeRef::NodeRef(unsigned int nPos, unsigned int nDepth)
: m_nPos(nPos)
, m_nDepth(nDepth)
{}
@@ -336,139 +132,6 @@ NodeRef::~NodeRef()
}
//-----------------------------------------------------------------------------
-
-bool Tree::hasElements(NodeRef const& aNode) const
-{
- OSL_PRECOND( !isEmpty(), "ERROR: Configuration: Tree operation requires valid tree" );
- OSL_PRECOND( aNode.isValid(), "ERROR: Configuration: NodeRef operation requires valid node" );
- OSL_PRECOND( isValidNode(aNode), "ERROR: Configuration: NodeRef does not match tree" );
-
- if (aNode.m_nDepth == 0)
- {
- CFG_TRACE_WARNING( "configuration: Querying node beyond available depth" );
- }
-
- view::ViewTreeAccess aView = this->getView();
-
- return aView.isSetNode(aNode) &&
- ! aView.isEmpty(aView.toSetNode(aNode));
-}
-//-----------------------------------------------------------------------------
-
-bool Tree::hasElement(NodeRef const& aNode, Name const& aName) const
-{
- OSL_PRECOND( !isEmpty(), "ERROR: Configuration: Tree operation requires valid tree" );
- OSL_PRECOND( aNode.isValid(), "ERROR: Configuration: NodeRef operation requires valid node" );
- OSL_PRECOND( isValidNode(aNode), "ERROR: Configuration: NodeRef does not match tree" );
-
- if (aNode.m_nDepth == 0)
- {
- CFG_TRACE_WARNING( "configuration: Querying node beyond available depth" );
- }
-
- view::ViewTreeAccess aView = this->getView();
-
- return aView.isSetNode(aNode) &&
- aView.findElement(aView.toSetNode(aNode),aName).isValid();
-}
-//-----------------------------------------------------------------------------
-
-bool Tree::hasElement(NodeRef const& aNode, Path::Component const& aName) const
-{
- OSL_PRECOND( !isEmpty(), "ERROR: Configuration: Tree operation requires valid tree" );
- OSL_PRECOND( aNode.isValid(), "ERROR: Configuration: NodeRef operation requires valid node" );
- OSL_PRECOND( isValidNode(aNode), "ERROR: Configuration: NodeRef does not match tree" );
-
- if (aNode.m_nDepth == 0)
- {
- CFG_TRACE_WARNING( "configuration: Querying node beyond available depth" );
- }
-
- view::ViewTreeAccess aView = this->getView();
-
- bool bFound = false;
-
- if (aView.isSetNode(aNode))
- {
- SetEntry aChildEntry = aView.findElement(aView.toSetNode(aNode),aName.getName());
-
- // do check if types do match as well
- bFound = aChildEntry.isValid() &&
- Path::matches(aChildEntry.tree()->getExtendedRootName(),aName);
- }
-
- return bFound; // even if nothing found
-}
-//-----------------------------------------------------------------------------
-
-ElementRef Tree::getElement(NodeRef const& aNode, Name const& aName) const
-{
- OSL_PRECOND( !isEmpty(), "ERROR: Configuration: Tree operation requires valid tree" );
- OSL_PRECOND( aNode.isValid(), "ERROR: Configuration: NodeRef operation requires valid node" );
- OSL_PRECOND( isValidNode(aNode), "ERROR: Configuration: NodeRef does not match tree" );
-
- if (aNode.m_nDepth == 0)
- {
- CFG_TRACE_WARNING( "configuration: Requesting node beyond available depth" );
- }
-
- view::ViewTreeAccess aView = this->getView();
-
- ElementTreeImpl* pElementTree = NULL;
-
- if (aView.isSetNode(aNode))
- {
- SetEntry aChildEntry = aView.findElement(aView.toSetNode(aNode),aName);
- pElementTree = aChildEntry.tree();
- }
-
- return ElementRef(pElementTree); // even if nothing found
-}
-//-----------------------------------------------------------------------------
-
-// a version of Tree::getElement that retrieves only loaded nodes
-ElementRef Tree::getAvailableElement(NodeRef const& aNode, Name const& aName) const
-{
- OSL_PRECOND( !isEmpty(), "ERROR: Configuration: Tree operation requires valid tree" );
- OSL_PRECOND( aNode.isValid(), "ERROR: Configuration: NodeRef operation requires valid node" );
- OSL_PRECOND( isValidNode(aNode), "ERROR: Configuration: NodeRef does not match tree" );
-
- view::ViewTreeAccess aView = this->getView();
-
- ElementTreeImpl* pElementTree = NULL;
-
- if (aView.isSetNode(aNode))
- {
- SetEntry aChildEntry = aView.findAvailableElement(aView.toSetNode(aNode),aName);
- pElementTree = aChildEntry.tree();
- }
-
- return ElementRef(pElementTree); // even if nothing found
-}
-//-----------------------------------------------------------------------------
-
-node::Attributes Tree::getAttributes(NodeRef const& aNode) const
-{
- OSL_PRECOND( !isEmpty(), "ERROR: Configuration: Tree operation requires valid tree" );
- OSL_PRECOND( aNode.isValid(), "ERROR: Configuration: NodeRef operation requires valid node" );
- OSL_PRECOND( isValidNode(aNode), "ERROR: Configuration: NodeRef does not match tree" );
-
- if (!aNode.isValid()) return NodeAttributes();
-
- return this->getView().getAttributes(aNode);
-}
-//-----------------------------------------------------------------------------
-
-Name Tree::getName(NodeRef const& aNode) const
-{
- OSL_PRECOND( !isEmpty(), "ERROR: Configuration: Tree operation requires valid tree" );
- OSL_PRECOND( !aNode.isValid() || isValidNode(aNode), "ERROR: Configuration: NodeRef does not match tree" );
-
- if (isEmpty()) return Name();
-
- return m_ref->getSimpleNodeName(aNode.m_nPos);
-}
-//-----------------------------------------------------------------------------
// class ValueRef
//-----------------------------------------------------------------------------
@@ -477,7 +140,7 @@ bool ValueRef::checkValidState() const
if (m_nParentPos == 0) return false;
// old node semantics for now
- if ( m_sNodeName.isEmpty() ) return false;
+ if ( m_sNodeName.getLength() == 0 ) return false;
return true;
}
@@ -490,7 +153,7 @@ ValueRef::ValueRef()
}
//-----------------------------------------------------------------------------
-ValueRef::ValueRef(Name const& aName, NodeOffset nParentPos)
+ValueRef::ValueRef(rtl::OUString const& aName, unsigned int nParentPos)
: m_sNodeName(aName)
, m_nParentPos(nParentPos)
{
@@ -524,42 +187,6 @@ ValueRef::~ValueRef()
}
//-----------------------------------------------------------------------------
-
-node::Attributes Tree::getAttributes(ValueRef const& aValue) const
-{
- OSL_PRECOND( !isEmpty(), "ERROR: Configuration: Tree operation requires valid tree" );
- OSL_PRECOND( aValue.isValid(), "ERROR: Configuration: ValueRef operation requires valid reference" );
- OSL_PRECOND( isValidNode(aValue), "ERROR: Configuration: ValueRef does not match tree" );
-
- if (!aValue.isValid()) return NodeAttributes();
-
- return TreeImplHelper::member_node(*this,aValue).getAttributes();
-}
-//-----------------------------------------------------------------------------
-
-Name Tree::getName(ValueRef const& aValue) const
-{
- OSL_PRECOND( !isEmpty(), "ERROR: Configuration: Tree operation requires valid tree" );
- OSL_PRECOND( !aValue.isValid() || isValidNode(aValue), "ERROR: Configuration: ValueRef does not match tree" );
-
- OSL_ENSURE( aValue.isValid() || aValue.m_sNodeName.isEmpty(), "Invalid value has a non-empty name ?!");
-
- return aValue.m_sNodeName;
-}
-//-----------------------------------------------------------------------------
-
-UnoType Tree::getUnoType(ValueRef const& aValue) const
-{
- OSL_PRECOND( !isEmpty(), "ERROR: Configuration: Tree operation requires valid tree" );
- OSL_PRECOND( aValue.isValid(), "ERROR: Configuration: ValueRef operation requires valid reference" );
- OSL_PRECOND( isValidNode(aValue), "ERROR: Configuration: ValueRef does not match tree" );
-
- if (!aValue.isValid()) return getVoidCppuType();
-
- return TreeImplHelper::member_node(*this,aValue).getValueType();
-}
-
-//-----------------------------------------------------------------------------
// class AnyNodeRef
//-----------------------------------------------------------------------------
#if OSL_DEBUG_LEVEL > 0
@@ -567,7 +194,7 @@ bool AnyNodeRef::checkValidState() const
{
if (m_nUsedPos == 0) return false;
- if ( !m_sNodeName.isEmpty() ) // it's a local value
+ if ( m_sNodeName.getLength() != 0 ) // it's a local value
{
// not used as runtime check as it should not be dangerous
OSL_ENSURE(m_nDepth ==0, "AnyNodeRef that wraps a ValueRef should have no depth"); // value has no depth
@@ -586,14 +213,14 @@ AnyNodeRef::AnyNodeRef()
}
//-----------------------------------------------------------------------------
-AnyNodeRef::AnyNodeRef(NodeOffset nPos, TreeDepth nDepth)
+AnyNodeRef::AnyNodeRef(unsigned int nPos, unsigned int nDepth)
: m_sNodeName()
, m_nUsedPos(nPos)
, m_nDepth(nDepth)
{}
//-----------------------------------------------------------------------------
-AnyNodeRef::AnyNodeRef(Name const& aName, NodeOffset nParentPos)
+AnyNodeRef::AnyNodeRef(rtl::OUString const& aName, unsigned int nParentPos)
: m_sNodeName(aName)
, m_nUsedPos(nParentPos)
, m_nDepth(0)
@@ -616,8 +243,8 @@ AnyNodeRef::AnyNodeRef(NodeRef const& aNodeRef)
//-----------------------------------------------------------------------------
AnyNodeRef::AnyNodeRef(ValueRef const& aValueRef)
-: m_sNodeName( TreeImplHelper::value_name(aValueRef) )
-, m_nUsedPos( TreeImplHelper::parent_offset(aValueRef) )
+: m_sNodeName( aValueRef.m_sNodeName )
+, m_nUsedPos( aValueRef.m_nParentPos )
, m_nDepth( 0 )
{}
//-----------------------------------------------------------------------------
@@ -648,7 +275,7 @@ bool AnyNodeRef::isNode() const
OSL_PRECOND( isValid(), "ERROR: Configuration: AnyNodeRef operation requires valid node" );
if (!isValid()) return false;
- return m_sNodeName.isEmpty();
+ return m_sNodeName.getLength() == 0;
}
//-----------------------------------------------------------------------------
@@ -657,7 +284,7 @@ NodeRef AnyNodeRef::toNode() const
OSL_PRECOND( isValid(), "ERROR: Configuration: AnyNodeRef operation requires valid node" );
if (!isValid() || !isNode()) return NodeRef();
- return TreeImplHelper::makeNode(m_nUsedPos,m_nDepth);
+ return NodeRef(m_nUsedPos,m_nDepth);
}
//-----------------------------------------------------------------------------
@@ -666,678 +293,10 @@ ValueRef AnyNodeRef::toValue() const
OSL_PRECOND( isValid(), "ERROR: Configuration: AnyNodeRef operation requires valid node" );
if (!isValid() || isNode()) return ValueRef();
- return TreeImplHelper::makeValue(m_sNodeName, m_nUsedPos);
-}
-//-----------------------------------------------------------------------------
-
-node::Attributes Tree::getAttributes(AnyNodeRef const& aNode) const
-{
- OSL_PRECOND( !isEmpty(), "ERROR: Configuration: Tree operation requires valid tree" );
- OSL_PRECOND( aNode.isValid(), "ERROR: Configuration: NodeRef operation requires valid node" );
- OSL_PRECOND( isValidNode(aNode), "ERROR: Configuration: NodeRef does not match tree" );
-
- if (!aNode.isValid()) return NodeAttributes();
-
- if (aNode.isNode())
- return this->getView().getAttributes(aNode.toNode());
-
- else
- return TreeImplHelper::member_node(*this,aNode.toValue()).getAttributes();
-}
-//-----------------------------------------------------------------------------
-
-//-----------------------------------------------------------------------------
-// class TreeRef
-//-----------------------------------------------------------------------------
-
-TreeRef::TreeRef(TreeImpl* pImpl)
-: m_pImpl(pImpl)
-{
- if (m_pImpl) m_pImpl->acquire();
-}
-//-----------------------------------------------------------------------------
-
-// just DTRT
-TreeRef::TreeRef(TreeRef const& aTree)
-: m_pImpl(aTree.m_pImpl)
-{
- if (m_pImpl) m_pImpl->acquire();
-}
-//-----------------------------------------------------------------------------
-
-// the usual exception-safe swap-based one
-TreeRef& TreeRef::operator=(TreeRef const& rOther)
-{
- TreeRef(rOther).swap(*this);
- return *this;
-}
-//-----------------------------------------------------------------------------
-
-void TreeRef::swap(TreeRef& rOther)
-{
- std::swap(m_pImpl, rOther.m_pImpl);
-}
-//-----------------------------------------------------------------------------
-
-TreeRef::~TreeRef()
-{
- if (m_pImpl) m_pImpl->release();
-}
-//-----------------------------------------------------------------------------
-
-bool TreeRef::isEmpty() const
-{
- return m_pImpl == 0 || m_pImpl->nodeCount() == 0;
-}
-//-----------------------------------------------------------------------------
-
-NodeOffset TreeRef::getContainedInnerNodeCount() const
-{
- OSL_PRECOND(isValid(), "ERROR: Configuration: Counting nodes requires a valid Tree");
-
- return m_pImpl ? m_pImpl->nodeCount() : 0;
-}
-//-----------------------------------------------------------------------------
-
-//-----------------------------------------------------------------------------
-// class Tree
-//-----------------------------------------------------------------------------
-
-Tree::Tree(TreeImpl* pImpl)
-: m_ref(pImpl)
-{
-}
-
-Tree::Tree(TreeRef const& _ref)
-: m_ref(_ref)
-{
-}
-
-//-----------------------------------------------------------------------------
-
-void TreeRef::disposeData()
-{
- if (TreeImpl* pImpl = get())
- {
- pImpl->disposeData();
-// pImpl->release();
- }
-}
-//-----------------------------------------------------------------------------
-
-bool Tree::isValidNode(ValueRef const& aNode) const
-{
- OSL_PRECOND( !isEmpty(), "ERROR: Configuration: Tree operation requires a valid Tree");
-
- if (!this->isValid()) return false;
-
- if (!aNode.isValid()) return false;
- if (!aNode.checkValidState()) return false;
-
- if (!m_ref->isValidNode(aNode.m_nParentPos)) return false;
-
- if (!this->getView().isGroupNodeAt(aNode.m_nParentPos)) return false;
- if (!TreeImplHelper::member_node(*this,aNode).isValid()) return false;
-
- OSL_ASSERT(!aNode.m_sNodeName.isEmpty()); // old value handling ?
-
- return true;
-}
-//-----------------------------------------------------------------------------
-
-bool TreeRef::isValidNode(NodeRef const& aNode) const
-{
- OSL_PRECOND(!isEmpty(), "ERROR: Configuration: Tree operation requires a valid Tree");
-
- if (!this->isValid()) return false;
- if (!aNode.isValid()) return false;
-
- if (!m_pImpl->isValidNode(aNode.m_nPos)) return false;
-
- return true;
-}
-//-----------------------------------------------------------------------------
-
-bool Tree::isValidNode(NodeRef const& aNode) const
-{
- return m_ref.isValidNode(aNode);
-}
-//-----------------------------------------------------------------------------
-#if OSL_DEBUG_LEVEL > 0
-bool Tree::isValidNode(AnyNodeRef const& aNode) const
-{
- OSL_PRECOND(!isEmpty(), "ERROR: Configuration: Tree operation requires a valid Tree");
-
- if (!this->isValid()) return false;
-
- if (!aNode.isValid()) return false;
- if (!aNode.checkValidState()) return false;
-
- if (!m_ref->isValidNode(aNode.m_nUsedPos)) return false;
-
- if (!aNode.isNode() && !this->getView().isGroupNodeAt(aNode.m_nUsedPos)) return false;
- if (!aNode.isNode() && !TreeImplHelper::member_node(*this,aNode.toValue()).isValid()) return false;
-
- return true;
-}
-#endif
-//-----------------------------------------------------------------------------
-
-bool Tree::hasChildren(NodeRef const& aNode) const
-{
- OSL_PRECOND( !isEmpty(), "ERROR: Configuration: Tree operation requires a valid Tree");
- OSL_PRECOND( isValidNode(aNode), "ERROR: Configuration: NodeRef does not match Tree");
- if (aNode.m_nDepth == 0)
- {
- CFG_TRACE_WARNING( "configuration: Querying node beyond available depth" );
- }
-
- if (this->isEmpty()) return false;
-
- view::ViewTreeAccess aView = this->getView();
-
- if (!aView.isGroupNode(aNode)) return false;
-
- view::GroupNode aGroupNode = aView.toGroupNode(aNode);
-
- if (aView.hasValue(aGroupNode))return true;
-
- return aView.toGroupNode(aNode).getFirstChild().is();
-
-}
-//-----------------------------------------------------------------------------
-
-bool Tree::hasChildNode(NodeRef const& aNode, Name const& aName) const
-{
- OSL_PRECOND( !isEmpty(), "ERROR: Configuration: Tree operation requires a valid Tree");
- OSL_PRECOND( isValidNode(aNode), "ERROR: Configuration: NodeRef does not match Tree");
- if (aNode.m_nDepth == 0)
- {
- CFG_TRACE_WARNING( "configuration: Querying node beyond available depth" );
- }
-
- if (this->isEmpty()) return false;
-
- view::ViewTreeAccess aView = this->getView();
-
- if (!aView.isGroupNode(aNode)) return false;
-
- return aView.toGroupNode(aNode).findChild(aName).is();
-}
-//-----------------------------------------------------------------------------
-
-bool Tree::hasChildValue(NodeRef const& aNode, Name const& aName) const
-{
- OSL_PRECOND( !isEmpty(), "ERROR: Configuration: Tree operation requires a valid Tree");
- OSL_PRECOND( isValidNode(aNode), "ERROR: Configuration: NodeRef does not match Tree");
- if (aNode.m_nDepth == 0)
- {
- CFG_TRACE_WARNING( "configuration: Querying node beyond available depth" );
- }
-
- if (this->isEmpty()) return false;
-
- view::ViewTreeAccess aView = this->getView();
-
- if (! aView.isGroupNode(aNode) ) return false;
-
- return aView.hasValue(aView.toGroupNode(aNode), aName);
-}
-//-----------------------------------------------------------------------------
-
-bool Tree::hasChild(NodeRef const& aNode, Name const& aName) const
-{
- OSL_PRECOND( !isEmpty(), "ERROR: Configuration: Tree operation requires a valid Tree");
- OSL_PRECOND( isValidNode(aNode), "ERROR: Configuration: NodeRef does not match Tree");
- if (aNode.m_nDepth == 0)
- {
- CFG_TRACE_WARNING( "configuration: Querying node beyond available depth" );
- }
-
- if (this->isEmpty()) return false;
- if (!aNode.isValid()) return false;
-
- view::ViewTreeAccess aView = this->getView();
-
- if ( !aView.isGroupNode(aNode) ) return false;
-
- view::GroupNode aGroupNode = aView.toGroupNode(aNode);
-
- if (aView.hasValue(aGroupNode, aName)) return true;
-
- return aGroupNode.findChild(aName).is();
-}
-//-----------------------------------------------------------------------------
-
-NodeRef Tree::getChildNode(NodeRef const& aNode, Name const& aName) const
-{
- OSL_PRECOND( !isEmpty(), "ERROR: Configuration: Tree operation requires a valid Tree");
- OSL_PRECOND( isValidNode(aNode), "ERROR: Configuration: NodeRef does not match Tree");
- // OSL_PRECOND(this->hasChild(aNode,aName),"ERROR: Configuration: Invalid node request.");
- if (aNode.m_nDepth == 0)
- {
- CFG_TRACE_WARNING( "configuration: Requesting node beyond available depth" );
- }
-
- view::ViewTreeAccess aView = this->getView();
-
- NodeOffset nOffset = 0;
-
- if ( aView.isGroupNode(aNode) )
- {
- nOffset = aView.toGroupNode(aNode).findChild(aName).get_offset();
- }
-
- return NodeRef(nOffset, childDepth(aNode.m_nDepth));
-}
-//-----------------------------------------------------------------------------
-
-ValueRef Tree::getChildValue(NodeRef const& aNode, Name const& aName) const
-{
- OSL_PRECOND( !isEmpty(), "ERROR: Configuration: Tree operation requires a valid Tree");
- OSL_PRECOND( isValidNode(aNode), "ERROR: Configuration: NodeRef does not match Tree");
- // OSL_PRECOND(this->hasChild(aNode,aName),"ERROR: Configuration: Invalid node request.");
- if (aNode.m_nDepth == 0)
- {
- CFG_TRACE_WARNING( "configuration: Requesting node beyond available depth" );
- }
-
- view::ViewTreeAccess aView = this->getView();
-
- if (! aView.isGroupNode(aNode) ) return ValueRef();
-
- if (!aView.hasValue(aView.toGroupNode(aNode), aName)) return ValueRef();
-
- return ValueRef(aName, aNode.m_nPos);
-}
-//-----------------------------------------------------------------------------
-
-AnyNodeRef Tree::getAnyChild(NodeRef const& aNode, Name const& aName) const
-{
- OSL_PRECOND( !isEmpty(), "ERROR: Configuration: Tree operation requires a valid Tree");
- OSL_PRECOND( isValidNode(aNode), "ERROR: Configuration: NodeRef does not match Tree");
- // OSL_PRECOND(this->hasChild(aNode,aName),"ERROR: Configuration: Invalid node request.");
- if (aNode.m_nDepth == 0)
- {
- CFG_TRACE_WARNING( "configuration: Requesting node beyond available depth" );
- }
-
- view::ViewTreeAccess aView = this->getView();
-
- NodeOffset nOffset = 0;
-
- if (aView.isGroupNode(aNode))
- {
- if (aView.hasValue(aView.toGroupNode(aNode), aName))
- {
- return AnyNodeRef(aName, aNode.m_nPos);
-
- }
-
- nOffset = aView.toGroupNode(aNode).findChild(aName).get_offset();
- }
-
- return AnyNodeRef(nOffset, childDepth(aNode.m_nDepth));
-}
-//-----------------------------------------------------------------------------
-
-NodeRef Tree::getParent(ValueRef const& aNode) const
-{
- OSL_PRECOND( !isEmpty(), "ERROR: Configuration: Tree operation requires a valid Tree");
- OSL_PRECOND( isValidNode(aNode), "ERROR: Configuration: NodeRef does not match Tree");
-
- NodeOffset nParent = aNode.m_nParentPos;
-
- OSL_ASSERT(nParent == 0 || !aNode.m_sNodeName.isEmpty());
-
- return TreeImplHelper::makeNode(*m_ref, nParent);
-}
-//-----------------------------------------------------------------------------
-
-NodeRef Tree::getParent(NodeRef const& aNode) const
-{
- OSL_PRECOND( !isEmpty(), "ERROR: Configuration: Tree operation requires a valid Tree");
- OSL_PRECOND( isValidNode(aNode), "ERROR: Configuration: NodeRef does not match Tree");
- OSL_ASSERT( getView().makeNode(getRootNode()).getParent().is() == false );
-
- view::Node aParent = getView().makeNode(aNode).getParent();
-
- OSL_ENSURE( m_ref->isValidNode(aParent.get_offset()), "ERROR: Configuration: NodeRef has invalid parent");
-
- return NodeRef(aParent.get_offset(), parentDepth(aNode.m_nDepth));
-}
-//-----------------------------------------------------------------------------
-
-UnoAny Tree::getNodeValue(ValueRef const& aNode) const
-{
- OSL_PRECOND( aNode.isValid(), "ERROR: Configuration: Value operation requires a valid Value Ref");
- if (!aNode.isValid()) return UnoAny();
-
- OSL_PRECOND( isValidNode(aNode), "ERROR: Configuration: Value Ref does not point to valid value");
-
- return TreeImplHelper::member_node(*this,aNode).getValue();
-}
-//-----------------------------------------------------------------------------
-
-AbsolutePath Tree::getAbsolutePath(NodeRef const& aNode) const
-{
- OSL_PRECOND( !isEmpty(), "ERROR: Configuration: Tree operation requires a valid Tree");
- OSL_PRECOND( !aNode.isValid() || isValidNode(aNode), "ERROR: Configuration: NodeRef does not match Tree");
-
- Path::Rep aNames;
-
- if (!this->isEmpty())
- {
- if ( aNode.isValid() )
- m_ref->prependLocalPathTo( aNode.m_nPos, aNames );
-
- aNames.prepend( m_ref->getRootPath().rep() );
- }
- return AbsolutePath(aNames);
+ return ValueRef(m_sNodeName, m_nUsedPos);
}
//-----------------------------------------------------------------------------
-NodeRef TreeRef::getRootNode() const
-{
- OSL_PRECOND( !isEmpty(), "ERROR: Configuration: Tree operation requires a valid Tree");
- if (isEmpty()) return NodeRef();
-
- return NodeRef( m_pImpl->root_(), m_pImpl->getAvailableDepth() );
-}
-//-----------------------------------------------------------------------------
-
-Path::Component Tree::getRootName() const
-{
- OSL_PRECOND( !isEmpty(), "ERROR: Configuration: Tree operation requires a valid Tree");
- if (isEmpty()) return Path::makeEmptyComponent();
-
- return m_ref->getExtendedRootName();
-}
-//-----------------------------------------------------------------------------
-
-bool TreeRef::isRootNode(NodeRef const& aNode) const
-{
- OSL_PRECOND( !isEmpty(), "ERROR: Configuration: Tree operation requires a valid Tree");
- OSL_PRECOND( !aNode.isValid() || isValidNode(aNode), "ERROR: Configuration: NodeRef does not match Tree");
- return !isEmpty() && aNode.isValid() && m_pImpl->root_() == aNode.m_nPos;
-}
-//-----------------------------------------------------------------------------
-
-bool Tree::hasNodeDefault(ValueRef const& aNode) const // only works for value nodes
-{
- OSL_PRECOND( !isEmpty(), "ERROR: Configuration: Tree operation requires a valid Tree");
- OSL_PRECOND( aNode.isValid(), "ERROR: Configuration: Value operation requires a valid ValueRef");
- OSL_PRECOND( isValidNode(aNode), "ERROR: Configuration: ValueRef does not point to valid value");
-
- bool bHasDefault = false;
- if (aNode.isValid())
- {
- ValueMemberNode aValueMember = TreeImplHelper::member_node(*this,aNode);
-
- bHasDefault = aValueMember.canGetDefaultValue();
- }
-
- return bHasDefault;
-}
-//-----------------------------------------------------------------------------
-
-bool Tree::isNodeDefault(ValueRef const& aNode) const // only works for value nodes
-{
- OSL_PRECOND( !isEmpty(), "ERROR: Configuration: Tree operation requires a valid Tree");
- OSL_PRECOND( aNode.isValid(), "ERROR: Configuration: Value operation requires a valid ValueRef");
- OSL_PRECOND( isValidNode(aNode), "ERROR: Configuration: ValueRef does not point to valid value");
-
- if (!hasNodeDefault(aNode)) return false;
-
- return TreeImplHelper::member_node(*this,aNode).isDefault();
-}
-//-----------------------------------------------------------------------------
-
-bool Tree::hasNodeDefault(NodeRef const& aNode) const
-{
- OSL_PRECOND( !isEmpty(), "ERROR: Configuration: Tree operation requires a valid Tree");
- OSL_PRECOND( aNode.isValid(), "ERROR: Configuration: Value operation requires a valid ValueRef");
- OSL_PRECOND( isValidNode(aNode), "ERROR: Configuration: ValueRef does not point to valid value");
-
- // not a set - then it has no default
- return this->getView().isSetNode(aNode);
-}
-//-----------------------------------------------------------------------------
-
-bool Tree::isNodeDefault(NodeRef const& aNode) const
-{
- OSL_PRECOND( !isEmpty(), "ERROR: Configuration: Tree operation requires a valid Tree");
- OSL_PRECOND( aNode.isValid(), "ERROR: Configuration: Node operation requires a valid Node");
- OSL_PRECOND( isValidNode(aNode), "ERROR: Configuration: Node does not match Tree");
-
- if (!hasNodeDefault(aNode)) return false;
-
- view::ViewTreeAccess aView = this->getView();
-
- // not a set - then it isn't default
- OSL_ASSERT(aView.isSetNode(aNode));
-
- // a set is defaults, if all its elements are default
- return !FindNonDefaultElement::hasNonDefaultElement(aView,aView.toSetNode(aNode));
-}
-//-----------------------------------------------------------------------------
-
-bool Tree::hasNodeDefault(AnyNodeRef const& aNode) const
-{
- OSL_PRECOND( !isEmpty(), "ERROR: Configuration: Tree operation requires a valid Tree");
- OSL_PRECOND( aNode.isValid(), "ERROR: Configuration: Node operation requires a valid Node");
- OSL_PRECOND( isValidNode(aNode), "ERROR: Configuration: Node does not match Tree");
-
- if (aNode.isNode())
- return this->hasNodeDefault( aNode.toNode() );
- else
- return this->hasNodeDefault( aNode.toValue() );
-}
-//-----------------------------------------------------------------------------
-
-bool Tree::isNodeDefault(AnyNodeRef const& aNode) const
-{
- OSL_PRECOND( !isEmpty(), "ERROR: Configuration: Tree operation requires a valid Tree");
- OSL_PRECOND( aNode.isValid(), "ERROR: Configuration: Node operation requires a valid Node");
- OSL_PRECOND( isValidNode(aNode), "ERROR: Configuration: Node does not match Tree");
-
- if (aNode.isNode())
- return this->isNodeDefault( aNode.toNode() );
- else
- return this->isNodeDefault( aNode.toValue() );
-}
-//-----------------------------------------------------------------------------
-
-bool Tree::areValueDefaultsAvailable(NodeRef const& aNode) const
-{
- OSL_PRECOND( !isEmpty(), "ERROR: Configuration: Tree operation requires a valid Tree");
- OSL_PRECOND( aNode.isValid(), "ERROR: Configuration: Node operation requires a valid Node");
- OSL_PRECOND( isValidNode(aNode), "ERROR: Configuration: Node does not match Tree");
-
- view::ViewTreeAccess aView = this->getView();
-
- OSL_PRECOND( aView.isGroupNode(aNode),
- "WARNING: Configuration: Group Node expected. Result is not meaningful");
-
- return aView.isGroupNode(aNode) &&
- aView.areValueDefaultsAvailable( aView.toGroupNode(aNode) );
-}
-//-----------------------------------------------------------------------------
-
-UnoAny Tree::getNodeDefaultValue(ValueRef const& aNode) const // only works for value nodes
-{
- OSL_PRECOND( !isEmpty(), "ERROR: Configuration: Tree operation requires a valid Tree");
- OSL_PRECOND( aNode.isValid(), "ERROR: Configuration: Value operation requires a valid ValueRef");
- OSL_PRECOND( isValidNode(aNode), "ERROR: Configuration: ValueRef does not point to valid value");
-
- if (aNode.isValid())
- {
- ValueMemberNode aValueMember = TreeImplHelper::member_node(*this,aNode);
-
- if (aValueMember.canGetDefaultValue())
- return aValueMember.getDefaultValue();
- }
-
- return UnoAny();
-}
-//-----------------------------------------------------------------------------
-
-TreeRef TreeRef::getContextTree() const
-{
- OSL_PRECOND( !isEmpty(), "ERROR: Configuration: Tree operation requires a valid Tree");
-
- TreeImpl* pContext = isValid() ? m_pImpl->getContextTree() : 0;
-
- return TreeRef(pContext);
-}
-//-----------------------------------------------------------------------------
-
-Tree Tree::getContextTree() const
-{
- return Tree(m_ref.getContextTree());
-}
-//-----------------------------------------------------------------------------
-
-NodeRef TreeRef::getContextNode() const
-{
- OSL_PRECOND( !isEmpty(), "ERROR: Configuration: Tree operation requires a valid Tree");
-
- if (!isValid()) return NodeRef();
-
- NodeOffset nOffset = m_pImpl->getContextNode();
- TreeImpl* pContext = m_pImpl->getContextTree();
-
- // if we have a context, we must have a (parent's) position in it
- OSL_ASSERT( pContext == 0 || nOffset != 0);
- if (pContext == 0) return NodeRef();
-
- return TreeImplHelper::makeNode(*pContext, nOffset);
-}
-//-----------------------------------------------------------------------------
-
-NodeRef Tree::getContextNode() const
-{
- return m_ref.getContextNode();
-}
-//-----------------------------------------------------------------------------
-
-AbsolutePath Tree::getRootPath() const
-{
- OSL_PRECOND( !isEmpty(), "ERROR: Configuration: Tree operation requires a valid Tree");
-
- return isEmpty() ? AbsolutePath::root() : m_ref->getRootPath();
-}
-//-----------------------------------------------------------------------------
-
-bool Tree::hasChanges() const
-{
- OSL_PRECOND( !isEmpty(), "ERROR: Configuration: Tree operation requires a valid Tree");
-
- return !isEmpty() && this->getView().hasChanges();
-}
-//-----------------------------------------------------------------------------
-
-bool Tree::collectChanges(NodeChanges& aChanges) const
-{
- OSL_PRECOND( !isEmpty(), "ERROR: Configuration: Tree operation requires a valid Tree");
-
- if (!isEmpty() && this->getView().hasChanges())
- {
- this->getView().collectChanges(aChanges);
- return true;
- }
- else
- return false;
-}
-//-----------------------------------------------------------------------------
-
-void Tree::integrate(NodeChange& aChange, NodeRef const& aNode, bool bLocal) const
-{
- OSL_PRECOND( !isEmpty(), "ERROR: Configuration: Tree operation requires a valid Tree");
- OSL_PRECOND( isValidNode(aNode), "ERROR: Configuration: NodeRef does not match Tree");
- if (aChange.test().isChange())
- {
- aChange.apply();
- if (bLocal)
- {
- this->getView().markChanged(aNode);
- }
- else
- {
- Tree aAffectedTree = aChange.getAffectedTree();
- NodeRef aAffectedNode = aChange.getAffectedNode();
- OSL_ASSERT(!aAffectedTree.isEmpty() && aAffectedTree.isValidNode(aAffectedNode));
-
- aAffectedTree.getView().markChanged(aAffectedNode);
-
- OSL_ASSERT(this->getView().hasChanges());
- }
- }
-}
-//-----------------------------------------------------------------------------
-
-void Tree::integrate(NodeChanges& aChanges, NodeRef const& aNode, bool bLocal) const
-{
- typedef NodeChanges::MutatingIterator Iter;
- for(Iter it = aChanges.begin(), end = aChanges.end(); it != end; ++it)
- this->integrate(*it, aNode, bLocal);
-}
-//-----------------------------------------------------------------------------
-
-NodeVisitor::Result Tree::dispatchToChildren(NodeRef const& aNode, NodeVisitor& aVisitor) const
-{
- OSL_PRECOND( !isEmpty(), "ERROR: Configuration: Tree operation requires a valid Tree");
- OSL_PRECOND( isValidNode(aNode), "ERROR: Configuration: NodeRef does not match Tree");
- if (aNode.m_nDepth == 0)
- {
- CFG_TRACE_WARNING("configuration: Dispatching Visitor to node beyond available depth" );
- }
-
- view::ViewTreeAccess aView = this->getView();
-
- typedef NodeVisitor::Result Result;
- Result aRet = NodeVisitor::CONTINUE;
-
- if (!aNode.isValid())
- OSL_TRACE("WARNING: Configuration: trying to iterate an invalid node !");
-
- else if (aView.isGroupNode(aNode))
- {
- GroupVisitorAdapter aAdapter(*this,aNode,aVisitor);
-
- OSL_ASSERT( NodeVisitor::DONE == Result(GroupMemberVisitor::DONE) );
- OSL_ASSERT( NodeVisitor::CONTINUE == Result(GroupMemberVisitor::CONTINUE) );
-
- view::GroupNode const aParent = aView.toGroupNode(aNode);
-
- aRet = Result( aView.dispatchToValues(aParent,aAdapter) );
-
- TreeDepth const nDepth = childDepth(aNode.m_nDepth);
-
- for( view::Node aChild = aParent.getFirstChild();
- aChild.is() && aRet != NodeVisitor::DONE;
- aChild = aParent.getNextChild(aChild))
- {
- aRet = visit( NodeRef( aChild.get_offset(), nDepth ), aVisitor);
- }
- }
-
- else if (aView.isSetNode(aNode))
- {
- SetVisitorAdapter aAdapter(aVisitor);
-
- OSL_ASSERT( NodeVisitor::DONE == Result(SetNodeVisitor::DONE) );
- OSL_ASSERT( NodeVisitor::CONTINUE == Result(SetNodeVisitor::CONTINUE) );
-
- aRet = Result(aView.dispatchToElements(aView.toSetNode(aNode),aAdapter));
- }
-
- else
- OSL_TRACE("WARNING: Configuration: trying to iterate a Value node !");
-
- return aRet;
-}
-
//-----------------------------------------------------------------------------
// hashing any pointer
//-----------------------------------------------------------------------------
@@ -1368,21 +327,14 @@ size_t hashAnyPointer(void* p)
// class NodeID
//-----------------------------------------------------------------------------
-NodeID::NodeID(Tree const& rTree, NodeRef const& rNode)
-: m_pTree( TreeImplHelper::impl(rTree) )
-, m_nNode( TreeImplHelper::offset(rNode) )
-{
-}
-//-----------------------------------------------------------------------------
-
-NodeID::NodeID(TreeRef const& rTree, NodeRef const& rNode)
-: m_pTree( TreeImplHelper::impl(rTree) )
-, m_nNode( TreeImplHelper::offset(rNode) )
+NodeID::NodeID(rtl::Reference< Tree > const& rTree, NodeRef const& rNode)
+: m_pTree( rTree.get() )
+, m_nNode( rNode.getOffset() )
{
}
//-----------------------------------------------------------------------------
-NodeID::NodeID(TreeImpl* pImpl, NodeOffset nNode)
+NodeID::NodeID(Tree* pImpl, unsigned int nNode)
: m_pTree( pImpl )
, m_nNode( nNode )
{
@@ -1409,26 +361,29 @@ size_t NodeID::hashCode() const
}
//-----------------------------------------------------------------------------
-NodeOffset NodeID::toIndex() const
+unsigned int NodeID::toIndex() const
{
- NodeOffset n = m_nNode;
+ unsigned int n = m_nNode;
if (m_pTree)
{
OSL_ENSURE(m_pTree->isValidNode(n),"Cannot produce valid Index for NodeID");
- n -= m_pTree->root_();
+ n -= Tree::ROOT;
}
return n;
}
+NodeRef NodeID::getNode() const {
+ return m_pTree == 0 ? NodeRef() : m_pTree->getNode(m_nNode);
+}
+
//-----------------------------------------------------------------------------
bool operator < (NodeID const& lhs, NodeID const& rhs)
{
- using std::less;
if (lhs.m_pTree == rhs.m_pTree)
return lhs.m_nNode < rhs.m_nNode;
else
- return less<TreeImpl*>()(lhs.m_pTree,rhs.m_pTree);
+ return std::less<Tree*>()(lhs.m_pTree,rhs.m_pTree);
}
//-----------------------------------------------------------------------------
@@ -1442,14 +397,14 @@ SubNodeID::SubNodeID()
}
//-----------------------------------------------------------------------------
-SubNodeID::SubNodeID(TreeRef const& rTree, NodeRef const& rParentNode, Name const& aName)
+SubNodeID::SubNodeID(rtl::Reference< Tree > const& rTree, NodeRef const& rParentNode, rtl::OUString const& aName)
: m_sNodeName(aName)
, m_aParentID(rTree,rParentNode)
{
}
//-----------------------------------------------------------------------------
-SubNodeID::SubNodeID(NodeID const& rParentNodeID, Name const& aName)
+SubNodeID::SubNodeID(NodeID const& rParentNodeID, rtl::OUString const& aName)
: m_sNodeName(aName)
, m_aParentID(rParentNodeID)
{
@@ -1460,10 +415,10 @@ bool SubNodeID::isValidNode() const
{
if (!m_aParentID.isValidNode()) return false;
- OSL_ENSURE(!m_sNodeName.isEmpty(),"Invalid subnode ID: Missing Name");
+ OSL_ENSURE(m_sNodeName.getLength() != 0,"Invalid subnode ID: Missing name");
- Tree aCheck( TreeImplHelper::tree(m_aParentID) );
- return aCheck.hasChild( TreeImplHelper::makeNode(m_aParentID),m_sNodeName );
+ rtl::Reference< Tree > aCheck( m_aParentID.getTree() );
+ return aCheck->hasChild( m_aParentID.getNode(), m_sNodeName );
}
//-----------------------------------------------------------------------------
@@ -1486,41 +441,41 @@ bool operator < (SubNodeID const& lhs, SubNodeID const& rhs)
// Free functions
//-----------------------------------------------------------------------------
-Name validateElementName(OUString const& sName, Tree const& aTree, NodeRef const& aNode )
+rtl::OUString validateElementName(rtl::OUString const& sName, rtl::Reference< Tree > const& aTree, NodeRef const& aNode )
{
{ (void)aTree; (void)aNode; }
- OSL_PRECOND( !aTree.isEmpty(), "ERROR: Configuration: Tree operation requires a valid Tree");
+ OSL_PRECOND( !isEmpty(aTree.get()), "ERROR: Configuration: Tree operation requires a valid Tree");
OSL_PRECOND( aNode.isValid(), "ERROR: Configuration: Node operation requires a valid NodeRef");
- OSL_PRECOND( aTree.isValidNode(aNode), "ERROR: Configuration: NodeRef does not match Tree");
+ OSL_PRECOND( aTree->isValidNode(aNode.getOffset()), "ERROR: Configuration: NodeRef does not match Tree");
- OSL_PRECOND( aTree.getView().isSetNode(aNode), "ERROR: Configuration: Set node expected.");
+ OSL_PRECOND( view::ViewTreeAccess(aTree.get()).isSetNode(aNode), "ERROR: Configuration: Set node expected.");
return validateElementName(sName);
}
//-----------------------------------------------------------------------------
-Name validateChildName(OUString const& sName, Tree const& aTree, NodeRef const& aNode )
+rtl::OUString validateChildName(rtl::OUString const& sName, rtl::Reference< Tree > const& aTree, NodeRef const& aNode )
{
{ (void)aTree; (void)aNode; }
- OSL_PRECOND( !aTree.isEmpty(), "ERROR: Configuration: Tree operation requires a valid Tree");
+ OSL_PRECOND( !isEmpty(aTree.get()), "ERROR: Configuration: Tree operation requires a valid Tree");
OSL_PRECOND( aNode.isValid(), "ERROR: Configuration: Node operation requires a valid NodeRef");
- OSL_PRECOND( aTree.isValidNode(aNode), "ERROR: Configuration: NodeRef does not match Tree");
+ OSL_PRECOND( aTree->isValidNode(aNode.getOffset()), "ERROR: Configuration: NodeRef does not match Tree");
- OSL_PRECOND( aTree.getView().isGroupNode(aNode), "ERROR: Configuration: Group node expected.");
+ OSL_PRECOND( view::ViewTreeAccess(aTree.get()).isGroupNode(aNode), "ERROR: Configuration: Group node expected.");
return validateNodeName(sName);
}
//-----------------------------------------------------------------------------
-Name validateChildOrElementName(OUString const& sName, Tree const& aTree, NodeRef const& aNode )
+rtl::OUString validateChildOrElementName(rtl::OUString const& sName, rtl::Reference< Tree > const& aTree, NodeRef const& aNode )
{
- OSL_PRECOND( !aTree.isEmpty(), "ERROR: Configuration: Tree operation requires a valid Tree");
+ OSL_PRECOND( !isEmpty(aTree.get()), "ERROR: Configuration: Tree operation requires a valid Tree");
OSL_PRECOND( aNode.isValid(), "ERROR: Configuration: Node operation requires a valid NodeRef");
- OSL_PRECOND( aTree.isValidNode(aNode), "ERROR: Configuration: NodeRef does not match Tree");
+ OSL_PRECOND( aTree->isValidNode(aNode.getOffset()), "ERROR: Configuration: NodeRef does not match Tree");
OSL_PRECOND( isStructuralNode(aTree,aNode), "ERROR: Configuration: Inner node expected.");
- if (aTree.getView().isSetNode(aNode))
+ if (view::ViewTreeAccess(aTree.get()).isSetNode(aNode))
return validateElementName(sName);
else
@@ -1528,11 +483,11 @@ Name validateChildOrElementName(OUString const& sName, Tree const& aTree, NodeRe
}
//-----------------------------------------------------------------------------
-Path::Component validateElementPathComponent(OUString const& sName, Tree const& aTree, NodeRef const& aNode )
+Path::Component validateElementPathComponent(rtl::OUString const& sName, rtl::Reference< Tree > const& aTree, NodeRef const& aNode )
{
- Name aElementName = validateElementName(sName,aTree,aNode);
+ rtl::OUString aElementName = validateElementName(sName,aTree,aNode);
- TemplateHolder aTemplate = SetElementInfo::extractElementInfo(aTree,aNode);
+ rtl::Reference<Template> aTemplate = aTree->extractElementInfo(aNode);
if (aTemplate.is())
{
return Path::makeCompositeName( aElementName, aTemplate->getName() );
@@ -1545,23 +500,23 @@ Path::Component validateElementPathComponent(OUString const& sName, Tree const&
}
//-----------------------------------------------------------------------------
-static void implValidateLocalPath(RelativePath& _rPath, Tree const& aTree, NodeRef const& aNode)
+static void implValidateLocalPath(RelativePath& _rPath, rtl::Reference< Tree > const& aTree, NodeRef const& aNode)
{
if (_rPath.isEmpty())
throw InvalidName(_rPath.toString(), "is an empty path.");
// FOR NOW: validate only the first component
- if (!aTree.getView().isSetNode(aNode))
+ if (!view::ViewTreeAccess(aTree.get()).isSetNode(aNode))
if (!_rPath.getFirstName().isSimpleName())
throw InvalidName(_rPath.toString(), "is not valid in this context. Predicate expression used to select group member.");
}
//-----------------------------------------------------------------------------
-RelativePath validateRelativePath(OUString const& _sPath, Tree const& aTree, NodeRef const& aNode)
+RelativePath validateRelativePath(rtl::OUString const& _sPath, rtl::Reference< Tree > const& aTree, NodeRef const& aNode)
{
- OSL_PRECOND( !aTree.isEmpty(), "ERROR: Configuration: Tree operation requires a valid Tree");
+ OSL_PRECOND( !isEmpty(aTree.get()), "ERROR: Configuration: Tree operation requires a valid Tree");
OSL_PRECOND( aNode.isValid(), "ERROR: Configuration: Node operation requires a valid NodeRef");
- OSL_PRECOND( aTree.isValidNode(aNode), "ERROR: Configuration: NodeRef does not match Tree");
+ OSL_PRECOND( aTree->isValidNode(aNode.getOffset()), "ERROR: Configuration: NodeRef does not match Tree");
OSL_PRECOND( isStructuralNode(aTree,aNode), "ERROR: Configuration: Inner node expected.");
@@ -1579,11 +534,11 @@ RelativePath validateRelativePath(OUString const& _sPath, Tree const& aTree, Nod
}
//-----------------------------------------------------------------------------
-RelativePath validateAndReducePath(OUString const& _sPath, Tree const& aTree, NodeRef const& aNode)
+RelativePath validateAndReducePath(rtl::OUString const& _sPath, rtl::Reference< Tree > const& aTree, NodeRef const& aNode)
{
- OSL_PRECOND( !aTree.isEmpty(), "ERROR: Configuration: Tree operation requires a valid Tree");
+ OSL_PRECOND( !isEmpty(aTree.get()), "ERROR: Configuration: Tree operation requires a valid Tree");
OSL_PRECOND( aNode.isValid(), "ERROR: Configuration: Node operation requires a valid NodeRef");
- OSL_PRECOND( aTree.isValidNode(aNode), "ERROR: Configuration: NodeRef does not match Tree");
+ OSL_PRECOND( aTree->isValidNode(aNode.getOffset()), "ERROR: Configuration: NodeRef does not match Tree");
OSL_PRECOND( isStructuralNode(aTree,aNode), "ERROR: Configuration: Inner node expected.");
@@ -1592,7 +547,7 @@ RelativePath validateAndReducePath(OUString const& _sPath, Tree const& aTree, No
AbsolutePath aInputPath = AbsolutePath::parse(_sPath);
- RelativePath aStrippedPath = Path::stripPrefix( aInputPath, aTree.getAbsolutePath(aNode) );
+ RelativePath aStrippedPath = Path::stripPrefix( aInputPath, aTree->getAbsolutePath(aNode) );
implValidateLocalPath(aStrippedPath,aTree,aNode);
@@ -1600,33 +555,33 @@ RelativePath validateAndReducePath(OUString const& _sPath, Tree const& aTree, No
}
//-----------------------------------------------------------------------------
-bool hasChildOrElement(Tree const& aTree, NodeRef const& aNode, Name const& aName)
+bool hasChildOrElement(rtl::Reference< Tree > const& aTree, NodeRef const& aNode, rtl::OUString const& aName)
{
- return aTree.getView().isSetNode(aNode) ? aTree.hasElement(aNode,aName) : aTree.hasChild(aNode,aName);
+ return view::ViewTreeAccess(aTree.get()).isSetNode(aNode) ? aTree->hasElement(aNode,aName) : aTree->hasChild(aNode,aName);
}
//-----------------------------------------------------------------------------
-bool hasChildOrElement(Tree const& aTree, NodeRef const& aNode, Path::Component const& aName)
+bool hasChildOrElement(rtl::Reference< Tree > const& aTree, NodeRef const& aNode, Path::Component const& aName)
{
- return aTree.getView().isSetNode(aNode) ? aTree.hasElement(aNode,aName) : aTree.hasChild(aNode,aName.getName());
+ return view::ViewTreeAccess(aTree.get()).isSetNode(aNode) ? aTree->hasElement(aNode,aName) : aTree->hasChild(aNode,aName.getName());
}
//-----------------------------------------------------------------------------
-bool findInnerChildOrAvailableElement(Tree& aTree, NodeRef& aNode, Name const& aName)
+bool findInnerChildOrAvailableElement(rtl::Reference< Tree > & aTree, NodeRef& aNode, rtl::OUString const& aName)
{
- if ( aTree.getView().isSetNode(aNode) )
+ if ( view::ViewTreeAccess(aTree.get()).isSetNode(aNode) )
{
- ElementRef aElement = aTree.getAvailableElement(aNode,aName);
- if (aElement.isValid())
+ rtl::Reference< ElementTree > aElement = aTree->getAvailableElement(aNode,aName);
+ if (aElement.is())
{
- aTree = aElement.getElementTree().getTree();
- aNode = aTree.getRootNode();
+ aTree = aElement.get();
+ aNode = aTree->getRootNode();
return true;
}
}
else
{
- NodeRef aChild = aTree.getChildNode(aNode,aName);
+ NodeRef aChild = aTree->getChildNode(aNode,aName);
if ( aChild.isValid() )
{
@@ -1639,26 +594,26 @@ bool findInnerChildOrAvailableElement(Tree& aTree, NodeRef& aNode, Name const& a
}
//-----------------------------------------------------------------------------
-AnyNodeRef getChildOrElement(Tree& aTree, NodeRef const& aParentNode, Name const& aName)
+AnyNodeRef getChildOrElement(rtl::Reference< Tree > & aTree, NodeRef const& aParentNode, rtl::OUString const& aName)
{
- if (aTree.hasChildValue(aParentNode,aName))
+ if (aTree->hasChildValue(aParentNode,aName))
{
- return AnyNodeRef(aTree.getChildValue(aParentNode,aName));
+ return AnyNodeRef(aTree->getChildValue(aParentNode,aName));
}
- else if ( aTree.getView().isSetNode(aParentNode) )
+ else if ( view::ViewTreeAccess(aTree.get()).isSetNode(aParentNode) )
{
- ElementRef aElement = aTree.getElement(aParentNode,aName);
- if (aElement.isValid())
+ rtl::Reference< ElementTree > aElement = aTree->getElement(aParentNode,aName);
+ if (aElement.is())
{
- aTree = aElement.getElementTree().getTree();
- return AnyNodeRef(aTree.getRootNode());
+ aTree = aElement.get();
+ return AnyNodeRef(aTree->getRootNode());
}
}
else
{
- NodeRef aChild = aTree.getChildNode(aParentNode,aName);
+ NodeRef aChild = aTree->getChildNode(aParentNode,aName);
if ( aChild.isValid() )
{
@@ -1672,9 +627,9 @@ AnyNodeRef getChildOrElement(Tree& aTree, NodeRef const& aParentNode, Name const
static
inline
-bool findLocalInnerChild(Tree const& aTree, NodeRef& aNode, Path::Component const& aName)
+bool findLocalInnerChild(rtl::Reference< Tree > const& aTree, NodeRef& aNode, Path::Component const& aName)
{
- NodeRef aChild = aTree.getChildNode(aNode,aName.getName());
+ NodeRef aChild = aTree->getChildNode(aNode,aName.getName());
if ( !aChild.isValid() ) return false;
@@ -1689,30 +644,30 @@ bool findLocalInnerChild(Tree const& aTree, NodeRef& aNode, Path::Component cons
static
inline
-bool findElement(Tree& aTree, NodeRef& aNode, Path::Component const& aName)
+bool findElement(rtl::Reference< Tree > & aTree, NodeRef& aNode, Path::Component const& aName)
{
- ElementRef aElement = aTree.getElement(aNode,aName.getName());
+ rtl::Reference< ElementTree > aElement = aTree->getElement(aNode,aName.getName());
- if (!aElement.isValid()) return false;
+ if (!aElement.is()) return false;
- Tree aFoundTree = aElement.getElementTree().getTree();
+ rtl::Reference< Tree > aFoundTree = aElement.get();
- OSL_ENSURE(matches(aFoundTree.getRootName(),aName), "Element found, but type prefix does not match - failing");
- if ( !matches(aFoundTree.getRootName(),aName) ) return false;
+ OSL_ENSURE(matches(aFoundTree->getExtendedRootName(),aName), "Element found, but type prefix does not match - failing");
+ if ( !matches(aFoundTree->getExtendedRootName(),aName) ) return false;
aTree = aFoundTree;
- aNode = aTree.getRootNode();
+ aNode = aTree->getRootNode();
return true;
}
//-----------------------------------------------------------------------------
static
-bool findLocalInnerDescendant(Tree const& aTree, NodeRef& aNode, RelativePath& rPath)
+bool findLocalInnerDescendant(rtl::Reference< Tree > const& aTree, NodeRef& aNode, RelativePath& rPath)
{
while ( !rPath.isEmpty() )
{
- if ( aTree.getView().isSetNode(aNode) ) return false;
+ if ( view::ViewTreeAccess(aTree.get()).isSetNode(aNode) ) return false;
if ( ! findLocalInnerChild(aTree,aNode,rPath.getFirstName()) ) return false;
@@ -1724,11 +679,11 @@ bool findLocalInnerDescendant(Tree const& aTree, NodeRef& aNode, RelativePath& r
//-----------------------------------------------------------------------------
static
-bool findDeepInnerDescendant(Tree& aTree, NodeRef& aNode, RelativePath& rPath)
+bool findDeepInnerDescendant(rtl::Reference< Tree > & aTree, NodeRef& aNode, RelativePath& rPath)
{
while ( !rPath.isEmpty() )
{
- if ( aTree.getView().isSetNode(aNode) )
+ if ( view::ViewTreeAccess(aTree.get()).isSetNode(aNode) )
{
if ( ! findElement(aTree,aNode,rPath.getFirstName()) ) return false;
}
@@ -1746,14 +701,14 @@ bool findDeepInnerDescendant(Tree& aTree, NodeRef& aNode, RelativePath& rPath)
static
inline
-bool identifiesLocalValue(Tree const& aTree, NodeRef const& aNode, RelativePath const& aPath)
+bool identifiesLocalValue(rtl::Reference< Tree > const& aTree, NodeRef const& aNode, RelativePath const& aPath)
{
if ( aPath.getDepth() == 1 )
{
Path::Component const & aLocalName = aPath.getLocalName();
- Name aName = aLocalName.getName();
+ rtl::OUString aName = aLocalName.getName();
- if (aTree.hasChildValue(aNode,aName))
+ if (aTree->hasChildValue(aNode,aName))
{
OSL_ENSURE( aLocalName.isSimpleName(), "Value in group was found by request using element name format");
if ( aLocalName.isSimpleName())
@@ -1764,21 +719,23 @@ bool identifiesLocalValue(Tree const& aTree, NodeRef const& aNode, RelativePath
}
//-----------------------------------------------------------------------------
-AnyNodeRef getLocalDescendant(Tree const& aTree, NodeRef const& aNode, RelativePath const& rPath)
+AnyNodeRef getLocalDescendant(rtl::Reference< Tree > const& aTree, NodeRef const& aNode, RelativePath const& rPath)
{
NodeRef aNestedNode( aNode );
RelativePath aRemainingPath(rPath);
if ( findLocalInnerDescendant(aTree,aNestedNode,aRemainingPath) )
{
- OSL_ASSERT(aTree.isValidNode(aNestedNode));
+ OSL_ASSERT(
+ aNestedNode.isValid() &&
+ aTree->isValidNode(aNestedNode.getOffset()));
return AnyNodeRef(aNestedNode);
}
if ( identifiesLocalValue(aTree,aNestedNode,aRemainingPath) )
{
- ValueRef aValue = aTree.getChildValue(aNestedNode,rPath.getLocalName().getName());
- OSL_ASSERT(aTree.isValidNode(aValue));
+ ValueRef aValue = aTree->getChildValue(aNestedNode,rPath.getLocalName().getName());
+ OSL_ASSERT(aTree->isValidValueNode(aValue));
return AnyNodeRef(aValue);
}
@@ -1786,18 +743,19 @@ AnyNodeRef getLocalDescendant(Tree const& aTree, NodeRef const& aNode, RelativeP
}
//-----------------------------------------------------------------------------
-AnyNodeRef getDeepDescendant(Tree& aTree, NodeRef& aNode, RelativePath& rPath)
+AnyNodeRef getDeepDescendant(rtl::Reference< Tree > & aTree, NodeRef& aNode, RelativePath& rPath)
{
if ( findDeepInnerDescendant(aTree,aNode,rPath) )
{
- OSL_ASSERT(aTree.isValidNode(aNode));
+ OSL_ASSERT(
+ aNode.isValid() && aTree->isValidNode(aNode.getOffset()));
return AnyNodeRef(aNode);
}
if ( identifiesLocalValue(aTree,aNode,rPath) )
{
- ValueRef aValue = aTree.getChildValue(aNode,rPath.getLocalName().getName());
- OSL_ASSERT(aTree.isValidNode(aValue));
+ ValueRef aValue = aTree->getChildValue(aNode,rPath.getLocalName().getName());
+ OSL_ASSERT(aTree->isValidValueNode(aValue));
return AnyNodeRef(aValue);
}
@@ -1805,18 +763,18 @@ AnyNodeRef getDeepDescendant(Tree& aTree, NodeRef& aNode, RelativePath& rPath)
}
//-----------------------------------------------------------------------------
-void getAllContainedNodes(Tree const& aTree, NodeIDList& aList)
+void getAllContainedNodes(rtl::Reference< Tree > const& aTree, std::vector<NodeID>& aList)
{
aList.clear();
- if (TreeImpl* pImpl = TreeImplHelper::impl(aTree))
+ if (Tree* pImpl = aTree.get())
{
- NodeOffset nCount = pImpl->nodeCount();
+ unsigned int nCount = pImpl->nodeCount();
aList.reserve(nCount);
- NodeOffset const nEnd = pImpl->root_() + nCount;
+ unsigned int const nEnd = Tree::ROOT + nCount;
- for(NodeOffset nOffset = pImpl->root_();
+ for(unsigned int nOffset = Tree::ROOT;
nOffset < nEnd;
++nOffset)
{
@@ -1829,15 +787,15 @@ void getAllContainedNodes(Tree const& aTree, NodeIDList& aList)
}
//-----------------------------------------------------------------------------
-void getAllChildrenHelper(NodeID const& aNode, SubNodeIDList& aList)
+void getAllChildrenHelper(NodeID const& aNode, std::vector<SubNodeID>& aList)
{
aList.clear();
- if (TreeImpl* pTreeImpl = TreeImplHelper::tree(aNode))
+ if (Tree* pTreeImpl = aNode.getTree())
{
- view::ViewTreeAccess aView(*pTreeImpl);
+ view::ViewTreeAccess aView(pTreeImpl);
- if (NodeOffset const nParent = TreeImplHelper::offset(aNode))
+ if (unsigned int const nParent = aNode.getOffset())
{
OSL_ASSERT( pTreeImpl->isValidNode(nParent) );
@@ -1863,11 +821,11 @@ void getAllChildrenHelper(NodeID const& aNode, SubNodeIDList& aList)
}
//-----------------------------------------------------------------------------
-NodeID findNodeFromIndex(TreeRef const& aTree, NodeOffset nIndex)
+NodeID findNodeFromIndex(rtl::Reference< Tree > const& aTree, unsigned int nIndex)
{
- if (TreeImpl* pImpl = TreeImplHelper::impl(aTree))
+ if (Tree* pImpl = aTree.get())
{
- NodeOffset nNode = nIndex + pImpl->root_();
+ unsigned int nNode = nIndex + Tree::ROOT;
if (pImpl->isValidNode(nNode))
{
return NodeID(pImpl,nNode);
@@ -1878,88 +836,88 @@ NodeID findNodeFromIndex(TreeRef const& aTree, NodeOffset nIndex)
//-----------------------------------------------------------------------------
-static inline bool isRootNode(Tree const& aTree, NodeRef const& aNode)
+static inline bool isRootNode(NodeRef const& aNode)
{
- return TreeImplHelper::offset(aNode) == TreeImplHelper::impl(aTree)->root_();
+ return aNode.getOffset() == Tree::ROOT;
}
//-----------------------------------------------------------------------------
#if OSL_DEBUG_LEVEL > 0
-bool isSimpleValueElement(Tree const& aTree, NodeRef const& aNode)
+bool isSimpleValueElement(rtl::Reference< Tree > const& aTree, NodeRef const& aNode)
{
- OSL_PRECOND( !aNode.isValid() || !aTree.isEmpty(), "ERROR: Configuration: Tree operation requires a valid Tree");
- OSL_PRECOND( !aNode.isValid() || aTree.isValidNode(aNode), "WARNING: Configuration: NodeRef does not match Tree");
+ OSL_PRECOND( !aNode.isValid() || !isEmpty(aTree.get()), "ERROR: Configuration: Tree operation requires a valid Tree");
+ OSL_PRECOND( !aNode.isValid() || aTree->isValidNode(aNode.getOffset()), "WARNING: Configuration: NodeRef does not match Tree");
- view::ViewTreeAccess aView = aTree.getView();
+ view::ViewTreeAccess aView = view::ViewTreeAccess(aTree.get());
OSL_ASSERT( !aNode.isValid() ||
aView.isGroupNode(aNode) ||
aView.isSetNode(aNode) ||
- (aView.isValueNode(aNode) && isRootNode(aTree,aNode)) );
+ (aView.isValueNode(aNode) && isRootNode(aNode)) );
- return aNode.isValid() && isRootNode(aTree,aNode) && aView.isValueNode(aNode);
+ return aNode.isValid() && isRootNode(aNode) && aView.isValueNode(aNode);
}
#endif
//-----------------------------------------------------------------------------
-bool isStructuralNode(Tree const& aTree, NodeRef const& aNode)
+bool isStructuralNode(rtl::Reference< Tree > const& aTree, NodeRef const& aNode)
{
- OSL_PRECOND( !aNode.isValid() || !aTree.isEmpty(), "ERROR: Configuration: Tree operation requires a valid Tree");
- OSL_PRECOND( !aNode.isValid() || aTree.isValidNode(aNode), "WARNING: Configuration: NodeRef does not match Tree");
+ OSL_PRECOND( !aNode.isValid() || !isEmpty(aTree.get()), "ERROR: Configuration: Tree operation requires a valid Tree");
+ OSL_PRECOND( !aNode.isValid() || aTree->isValidNode(aNode.getOffset()), "WARNING: Configuration: NodeRef does not match Tree");
- view::ViewTreeAccess aView = aTree.getView();
+ view::ViewTreeAccess aView = view::ViewTreeAccess(aTree.get());
OSL_ASSERT( !aNode.isValid() ||
aView.isGroupNode(aNode) ||
aView.isSetNode(aNode) ||
- (aView.isValueNode(aNode) && isRootNode(aTree,aNode)) );
+ (aView.isValueNode(aNode) && isRootNode(aNode)) );
return aNode.isValid() && ! aView.isValueNode(aNode);
}
//-----------------------------------------------------------------------------
-bool isGroupNode(Tree const& aTree, NodeRef const& aNode)
+bool isGroupNode(rtl::Reference< Tree > const& aTree, NodeRef const& aNode)
{
- OSL_PRECOND( !aNode.isValid() || !aTree.isEmpty(), "ERROR: Configuration: Tree operation requires a valid Tree");
- OSL_PRECOND( !aNode.isValid() || aTree.isValidNode(aNode), "WARNING: Configuration: NodeRef does not match Tree");
+ OSL_PRECOND( !aNode.isValid() || !isEmpty(aTree.get()), "ERROR: Configuration: Tree operation requires a valid Tree");
+ OSL_PRECOND( !aNode.isValid() || aTree->isValidNode(aNode.getOffset()), "WARNING: Configuration: NodeRef does not match Tree");
- view::ViewTreeAccess aView = aTree.getView();
+ view::ViewTreeAccess aView = view::ViewTreeAccess(aTree.get());
OSL_ASSERT( !aNode.isValid() ||
aView.isGroupNode(aNode) ||
aView.isSetNode(aNode) ||
- (aView.isValueNode(aNode) && isRootNode(aTree,aNode)) );
+ (aView.isValueNode(aNode) && isRootNode(aNode)) );
return aNode.isValid() && aView.isGroupNode(aNode);
}
//-----------------------------------------------------------------------------
-bool isSetNode(Tree const& aTree, NodeRef const& aNode)
+bool isSetNode(rtl::Reference< Tree > const& aTree, NodeRef const& aNode)
{
- OSL_PRECOND( !aNode.isValid() || !aTree.isEmpty(), "ERROR: Configuration: Tree operation requires a valid Tree");
- OSL_PRECOND( !aNode.isValid() || aTree.isValidNode(aNode), "WARNING: Configuration: NodeRef does not match Tree");
+ OSL_PRECOND( !aNode.isValid() || !isEmpty(aTree.get()), "ERROR: Configuration: Tree operation requires a valid Tree");
+ OSL_PRECOND( !aNode.isValid() || aTree->isValidNode(aNode.getOffset()), "WARNING: Configuration: NodeRef does not match Tree");
- view::ViewTreeAccess aView = aTree.getView();
+ view::ViewTreeAccess aView = view::ViewTreeAccess(aTree.get());
OSL_ASSERT( !aNode.isValid() ||
aView.isGroupNode(aNode) ||
aView.isSetNode(aNode) ||
- (aView.isValueNode(aNode) && isRootNode(aTree,aNode)) );
+ (aView.isValueNode(aNode) && isRootNode(aNode)) );
return aNode.isValid() && aView.isSetNode(aNode);
}
//-----------------------------------------------------------------------------
-UnoAny getSimpleElementValue(Tree const& aTree, NodeRef const& aNode)
+com::sun::star::uno::Any getSimpleElementValue(rtl::Reference< Tree > const& aTree, NodeRef const& aNode)
{
- OSL_PRECOND( !aTree.isEmpty(), "ERROR: Configuration: Tree operation requires a valid Tree");
+ OSL_PRECOND( !isEmpty(aTree.get()), "ERROR: Configuration: Tree operation requires a valid Tree");
OSL_PRECOND( aNode.isValid(), "ERROR: Configuration: Node operation requires a valid Node");
- OSL_PRECOND( aTree.isValidNode(aNode), "WARNING: Configuration: NodeRef does not match Tree");
+ OSL_PRECOND( aTree->isValidNode(aNode.getOffset()), "WARNING: Configuration: NodeRef does not match Tree");
- if (!aNode.isValid()) return UnoAny();
+ if (!aNode.isValid()) return com::sun::star::uno::Any();
OSL_PRECOND( isSimpleValueElement(aTree, aNode), "ERROR: Configuration: Getting value is supported only for value nodes");
- view::ViewTreeAccess aView = aTree.getView();
+ view::ViewTreeAccess aView = view::ViewTreeAccess(aTree.get());
return aView.getValue(aView.toValueNode(aNode));
}
diff --git a/configmgr/source/treemgr/readonlyview.cxx b/configmgr/source/treemgr/readonlyview.cxx
index 79f109a1a7..ad06141ad0 100644
--- a/configmgr/source/treemgr/readonlyview.cxx
+++ b/configmgr/source/treemgr/readonlyview.cxx
@@ -68,7 +68,7 @@ node::Attributes ReadOnlyViewStrategy::doAdjustAttributes(node::Attributes const
}
//-----------------------------------------------------------------------------
-configuration::ValueMemberNode ReadOnlyViewStrategy::doGetValueMember(GroupNode const& _aNode, Name const& _aName, bool _bForUpdate) const
+configuration::ValueMemberNode ReadOnlyViewStrategy::doGetValueMember(GroupNode const& _aNode, rtl::OUString const& _aName, bool _bForUpdate) const
{
if (_bForUpdate) failReadOnly();
@@ -76,13 +76,13 @@ configuration::ValueMemberNode ReadOnlyViewStrategy::doGetValueMember(GroupNode
}
//-----------------------------------------------------------------------------
-void ReadOnlyViewStrategy::doInsertElement(SetNode const& , Name const& , SetNodeEntry const& )
+void ReadOnlyViewStrategy::doInsertElement(SetNode const& , rtl::OUString const& , configuration::SetEntry const& )
{
failReadOnly();
}
//-----------------------------------------------------------------------------
-void ReadOnlyViewStrategy::doRemoveElement(SetNode const& /*_aNode*/, Name const& /*_aName*/)
+void ReadOnlyViewStrategy::doRemoveElement(SetNode const& /*_aNode*/, rtl::OUString const& /*_aName*/)
{
failReadOnly();
}
@@ -97,7 +97,7 @@ NodeFactory& ReadOnlyViewStrategy::doGetNodeFactory()
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
-ViewStrategyRef createReadOnlyStrategy()
+rtl::Reference<ViewStrategy> createReadOnlyStrategy()
{
return new ReadOnlyViewStrategy();
}
diff --git a/configmgr/source/treemgr/readonlyview.hxx b/configmgr/source/treemgr/readonlyview.hxx
index 36791bcbbc..271a192286 100644
--- a/configmgr/source/treemgr/readonlyview.hxx
+++ b/configmgr/source/treemgr/readonlyview.hxx
@@ -57,11 +57,11 @@ namespace configmgr
virtual node::Attributes doAdjustAttributes(node::Attributes const& _aAttributes) const;
// group member access
- virtual ValueMemberNode doGetValueMember(GroupNode const& _aNode, Name const& _aName, bool _bForUpdate) const;
+ virtual configuration::ValueMemberNode doGetValueMember(GroupNode const& _aNode, rtl::OUString const& _aName, bool _bForUpdate) const;
// set element access
- virtual void doInsertElement(SetNode const& _aNode, Name const& aName, SetNodeEntry const& aNewEntry);
- virtual void doRemoveElement(SetNode const& _aNode, Name const& aName);
+ virtual void doInsertElement(SetNode const& _aNode, rtl::OUString const& aName, configuration::SetEntry const& aNewEntry);
+ virtual void doRemoveElement(SetNode const& _aNode, rtl::OUString const& aName);
virtual NodeFactory& doGetNodeFactory();
private:
diff --git a/configmgr/source/treemgr/roottree.cxx b/configmgr/source/treemgr/roottree.cxx
index cad4baf74f..0b8e895cb0 100644
--- a/configmgr/source/treemgr/roottree.cxx
+++ b/configmgr/source/treemgr/roottree.cxx
@@ -35,7 +35,6 @@
#include "roottree.hxx"
#include "roottreeimpl.hxx"
#include "viewaccess.hxx"
-#include "nodeaccess.hxx"
#include "viewfactory.hxx"
#include "noderef.hxx"
#include "nodechangeinfo.hxx"
@@ -49,44 +48,44 @@ namespace configmgr
// factory methods
//-----------------------------------------------------------------------------
-RootTree createReadOnlyTree( AbsolutePath const& aRootPath,
- data::NodeAccess const& _aCacheNode,
- TreeDepth nDepth,
+rtl::Reference< Tree > createReadOnlyTree( AbsolutePath const& aRootPath,
+ sharable::Node * cacheNode,
+ unsigned int nDepth,
TemplateProvider const& aTemplateProvider)
{
- return RootTree( new RootTreeImpl(view::createReadOnlyStrategy(),
- aRootPath, _aCacheNode, nDepth,
+ return new RootTree(view::createReadOnlyStrategy(),
+ aRootPath, cacheNode, nDepth,
aTemplateProvider
- ));
+ );
}
//-----------------------------------------------------------------------------
-RootTree createUpdatableTree( AbsolutePath const& aRootPath,
- data::NodeAccess const& _aCacheNode,
- TreeDepth nDepth,
+rtl::Reference< Tree > createUpdatableTree( AbsolutePath const& aRootPath,
+ sharable::Node * cacheNode,
+ unsigned int nDepth,
TemplateProvider const& aTemplateProvider)
{
- return RootTree(new RootTreeImpl(view::createDeferredChangeStrategy(),
- aRootPath, _aCacheNode, nDepth,
+ return new RootTree(view::createDeferredChangeStrategy(),
+ aRootPath, cacheNode, nDepth,
aTemplateProvider
- ));
+ );
}
//-----------------------------------------------------------------------------
// update on notify method
//-----------------------------------------------------------------------------
bool adjustToChanges( NodeChangesInformation& rLocalChanges,
- Tree const& aBaseTree, NodeRef const& aBaseNode,
+ rtl::Reference< Tree > const& aBaseTree, NodeRef const& aBaseNode,
SubtreeChange const& aExternalChange)
{
- OSL_PRECOND( !aBaseTree.isEmpty(), "ERROR: Configuration: Tree operation requires a valid Tree");
- OSL_PRECOND( aBaseTree.isValidNode(aBaseNode), "ERROR: Configuration: NodeRef does not match Tree");
+ OSL_PRECOND( !isEmpty(aBaseTree.get()), "ERROR: Configuration: Tree operation requires a valid Tree");
+ OSL_PRECOND( aBaseNode.isValid() && aBaseTree->isValidNode(aBaseNode.getOffset()), "ERROR: Configuration: NodeRef does not match Tree");
- if (!aBaseTree.isEmpty())
+ if (!isEmpty(aBaseTree.get()))
{
OSL_ENSURE(rLocalChanges.empty(), "Should pass empty container to adjustToChanges(...)");
- aBaseTree.getView().adjustToChanges(rLocalChanges, aBaseNode, aExternalChange);
+ view::ViewTreeAccess(aBaseTree.get()).adjustToChanges(rLocalChanges, aBaseNode, aExternalChange);
return !rLocalChanges.empty();
}
@@ -100,13 +99,13 @@ bool adjustToChanges( NodeChangesInformation& rLocalChanges,
//-----------------------------------------------------------------------------
struct CommitHelper::Data
{
- ElementList m_aRemovedElements; // filled to keep the elements alive 'till after notification
+ std::vector< rtl::Reference<ElementTree> > m_aRemovedElements; // filled to keep the elements alive 'till after notification
};
//-----------------------------------------------------------------------------
-CommitHelper::CommitHelper(TreeRef const& aTree)
+CommitHelper::CommitHelper(rtl::Reference< Tree > const& aTree)
: m_pData( )
-, m_pTree( TreeImplHelper::impl(aTree) )
+, m_pTree( aTree.get() )
{
OSL_ENSURE(m_pTree, "INTERNAL ERROR: Unexpected NULL tree in commit helper");
}
@@ -126,12 +125,12 @@ bool CommitHelper::prepareCommit(TreeChangeList& rChangeList)
m_pData.reset( new Data() );
// get and check the changes
- std::auto_ptr<SubtreeChange> pTreeChange(view::ViewTreeAccess(*m_pTree).preCommitChanges(m_pData->m_aRemovedElements));
+ std::auto_ptr<SubtreeChange> pTreeChange(view::ViewTreeAccess(m_pTree).preCommitChanges(m_pData->m_aRemovedElements));
if (pTreeChange.get() == NULL)
return false;
// find the name and path of the change
- OSL_ENSURE(m_pTree->getSimpleRootName().toString() == pTreeChange->getNodeName(), "ERROR in Commit: Change Name Mismatch");
+ OSL_ENSURE(m_pTree->getSimpleRootName() == pTreeChange->getNodeName(), "ERROR in Commit: Change name mismatch");
// now fill the TreeChangeList
rChangeList.setRootPath( m_pTree->getRootPath() );
@@ -152,7 +151,7 @@ void CommitHelper::finishCommit(TreeChangeList& rChangeList)
if ( !matches(rChangeList.getRootNodePath(), aPath) )
throw configuration::Exception("INTERNAL ERROR: FinishCommit cannot handle rebased changes trees");
- view::ViewTreeAccess(*m_pTree).finishCommit(rChangeList.root);
+ view::ViewTreeAccess(m_pTree).finishCommit(rChangeList.root);
}
//-----------------------------------------------------------------------------
@@ -166,7 +165,7 @@ void CommitHelper::failedCommit(TreeChangeList& rChangeList)
if ( !matches(rChangeList.getRootNodePath(), aPath) )
throw configuration::Exception("INTERNAL ERROR: FinishCommit cannot handle rebased changes trees");
- view::ViewTreeAccess(*m_pTree).recoverFailedCommit(rChangeList.root);
+ view::ViewTreeAccess(m_pTree).recoverFailedCommit(rChangeList.root);
}
//-----------------------------------------------------------------------------
diff --git a/configmgr/source/treemgr/roottreeimpl.hxx b/configmgr/source/treemgr/roottreeimpl.hxx
index edb1e99f0c..f9466b0255 100644
--- a/configmgr/source/treemgr/roottreeimpl.hxx
+++ b/configmgr/source/treemgr/roottreeimpl.hxx
@@ -31,38 +31,33 @@
#ifndef CONFIGMGR_ROOTTREEIMPL_HXX_
#define CONFIGMGR_ROOTTREEIMPL_HXX_
-#include "treeimpl.hxx"
+#include "tree.hxx"
namespace configmgr
{
//-----------------------------------------------------------------------------
- namespace data { class NodeAccess; }
-//-----------------------------------------------------------------------------
namespace configuration
{
//-----------------------------------------------------------------------------
/** is the Implementation class for class <type>Tree</type>.
<p> Holds a list of <type>Node</type> which it allows to access by
- <type>NodeOffset</type> (which is basically a one-based index).
+ <type>unsigned int</type> (which is basically a one-based index).
</p>
<p> Also provides for navigation to the context this tree is located in
</p>
*/
- class RootTreeImpl : public TreeImpl
+ class RootTree : public Tree
{
public:
// Construction
- /// creates a TreeImpl without a parent tree
- RootTreeImpl( rtl::Reference<view::ViewStrategy> const& _xStrategy,
+ /// creates a Tree without a parent tree
+ RootTree( rtl::Reference<view::ViewStrategy> const& _xStrategy,
AbsolutePath const& aRootPath,
- data::NodeAccess const& _aCacheNode, TreeDepth nDepth,
+ sharable::Node * cacheNode, unsigned int nDepth,
TemplateProvider const& aTemplateProvider);
// make it public
private:
- virtual RootTreeImpl const* doCastToRootTree() const;
- virtual ElementTreeImpl const* doCastToElementTree() const;
-
virtual Path::Component doGetRootName() const;
virtual void doFinishRootPath(Path::Rep& rPath) const;
diff --git a/configmgr/source/treemgr/setnodeimpl.cxx b/configmgr/source/treemgr/setnodeimpl.cxx
index 10b37a7b38..91dabe58a5 100644
--- a/configmgr/source/treemgr/setnodeimpl.cxx
+++ b/configmgr/source/treemgr/setnodeimpl.cxx
@@ -32,17 +32,15 @@
#include "precompiled_configmgr.hxx"
#include <stdio.h>
+#include "builddata.hxx"
#include "setnodeimpl.hxx"
+#include "treefragment.hxx"
#include "viewfactory.hxx"
#include "configpath.hxx"
-#include "treeimpl.hxx"
+#include "tree.hxx"
#include "valuenodeimpl.hxx"
#include "nodechange.hxx"
#include "nodechangeimpl.hxx"
-#include "nodeaccess.hxx"
-#include "valuenodeaccess.hxx"
-#include "groupnodeaccess.hxx"
-#include "setnodeaccess.hxx"
#include "nodevisitor.hxx"
#include "change.hxx"
#include "viewaccess.hxx"
@@ -66,17 +64,13 @@ namespace configmgr
//-------------------------------------------------------------------------
namespace
{
- using namespace data;
-
- typedef SetNodeImpl::Element Element;
-
- class CollectElementTrees : SetVisitor
+ class CollectElementTrees : data::SetVisitor
{
public:
- CollectElementTrees(view::ViewStrategyRef const& _xStrategy,
- TreeImpl* pParentTree, NodeOffset nPos,
- TreeDepth nDepth,
- TemplateHolder const& aTemplate,
+ CollectElementTrees(rtl::Reference<view::ViewStrategy> const& _xStrategy,
+ Tree* pParentTree, unsigned int nPos,
+ unsigned int nDepth,
+ rtl::Reference<Template> const& aTemplate,
TemplateProvider const& aTemplateProvider)
: m_aTemplate(aTemplate)
, m_aTemplateProvider(aTemplateProvider)
@@ -88,52 +82,52 @@ namespace
OSL_ENSURE(m_aTemplate.is(),"WARNING: Collecting a set without a template");
}
- void collect(SetNodeAccess const& _aNode)
+ void collect(sharable::SetNode * node)
{
- this->visitElements(_aNode);
+ visitElements(node);
}
- Element create(TreeAccessor const & _aElementTree)
+ ElementTreeData create(sharable::TreeFragment * elementTree)
{
OSL_ENSURE(collection.empty(),"warning: trying to reuse a full collection");
collection.resize(1); // make an empty one for case of failure
- this->visitTree(_aElementTree);
+ this->visitTree(elementTree);
OSL_ENSURE(collection.size()==2,"warning: could not create an element");
return collection.back();
}
- typedef std::vector<Element> Collection;
- Collection collection;
- protected:
- using NodeVisitor::handle;
+ std::vector<ElementTreeData> collection;
private:
- Result handle(TreeAccessor const& _aElement);
+ using SetVisitor::handle;
+
+ virtual bool handle(sharable::Node * node);
- Result handle(NodeAccess const& _aNonValue);
- Result handle(ValueNodeAccess const& _aValue);
+ virtual bool handle(sharable::ValueNode * node);
- void add(TreeAccessor const& _aNode);
+ virtual bool handle(sharable::TreeFragment * tree);
- TemplateHolder m_aTemplate;
+ void add(sharable::TreeFragment * node);
+
+ rtl::Reference<Template> m_aTemplate;
TemplateProvider m_aTemplateProvider;
- view::ViewStrategyRef m_xStrategy;
- TreeImpl* m_pParentTree;
- NodeOffset m_nPos;
- TreeDepth m_nDepth;
+ rtl::Reference<view::ViewStrategy> m_xStrategy;
+ Tree* m_pParentTree;
+ unsigned int m_nPos;
+ unsigned int m_nDepth;
};
//-------------------------------------------------------------------------
static
- Name validatedName(Element const& aTree)
+ rtl::OUString validatedName(ElementTreeData const& aTree)
{
OSL_ENSURE(aTree.isValid(), "INTERNAL ERROR: Unexpected null tree constructed in set node");
if (!aTree.isValid()) throw Exception("INTERNAL ERROR: Unexpected null tree in set node");
OSL_ENSURE(aTree->nodeCount(), "INTERNAL ERROR: Unexpected empty (!) tree constructed in set node");
- OSL_ENSURE(aTree->isValidNode(aTree->root_()), "INTERNAL ERROR: Corrupt tree constructed in set node");
+ OSL_ENSURE(aTree->isValidNode(Tree::ROOT), "INTERNAL ERROR: Corrupt tree constructed in set node");
return aTree->getSimpleRootName();
}
@@ -151,7 +145,7 @@ namespace
return !bReplaced;
}
//-------------------------------------------------------------------------
- CollectElementTrees::Result CollectElementTrees::handle(ValueNodeAccess const& _aValue)
+ bool CollectElementTrees::handle(sharable::ValueNode * node)
{
if (m_aTemplate.is())
{
@@ -161,8 +155,8 @@ namespace
if (!m_aTemplate->isInstanceValue())
throw Exception("INTERNAL ERROR: Corrupt tree contains a value node within a template-set");
- UnoType aValueType = _aValue.getValueType();
- UnoType aExpectedType = m_aTemplate->getInstanceType();
+ com::sun::star::uno::Type aValueType = node->getValueType();
+ com::sun::star::uno::Type aExpectedType = m_aTemplate->getInstanceType();
if (aValueType.getTypeClass() != aExpectedType.getTypeClass() &&
aExpectedType.getTypeClass() != uno::TypeClass_ANY &&
@@ -172,13 +166,13 @@ namespace
// throw TypeMismatch(aValueType.getTypeName(),aExpectedType.getTypeName(), "INTERNAL ERROR: - Corrupt tree contains mistyped value node within a value-set")));
}
}
- return CONTINUE;
+ return false;
}
//-------------------------------------------------------------------------
- CollectElementTrees::Result CollectElementTrees::handle(NodeAccess const& _aNonValue)
+ bool CollectElementTrees::handle(sharable::Node * node)
{
- { (void)_aNonValue; }
- OSL_ENSURE(!ValueNodeAccess::isInstance(_aNonValue),"Unexpected: Value-node dispatched to wrong handler");
+ (void) node; // avoid warnings
+ OSL_ENSURE(!node->isValue(), "Unexpected: Value-node dispatched to wrong handler");
if (m_aTemplate.is())
{
OSL_ENSURE(m_aTemplate->isInstanceTypeKnown(),"ERROR: Template must have a validated type when building a set.");
@@ -188,36 +182,35 @@ namespace
throw Exception("INTERNAL ERROR: Corrupt tree contains a non-leaf node within a value-set");
}
- return CONTINUE;
+ return false;
}
//-------------------------------------------------------------------------
- CollectElementTrees::Result CollectElementTrees::handle(TreeAccessor const& _aTree)
+ bool CollectElementTrees::handle(sharable::TreeFragment * tree)
{
- // check the node type
- Result aResult = this->visitNode( _aTree.getRootNode() );
-
- if (aResult == CONTINUE) this->add(_aTree);
-
- return aResult;
+ bool done = visitNode(tree->getRootNode());
+ if (!done) {
+ add(tree);
+ }
+ return done;
}
//-------------------------------------------------------------------------
- void CollectElementTrees::add(TreeAccessor const& _aTree)
+ void CollectElementTrees::add(sharable::TreeFragment * tree)
{
- node::Attributes const aAttributes = _aTree->getAttributes();
+ node::Attributes const aAttributes = tree->getAttributes();
bool bReadonly = aAttributes.isReadonly();
bool bInDefault = !aAttributes.isReplacedForUser();
- view::ViewStrategyRef xStrategy = !bReadonly ? m_xStrategy : view::createReadOnlyStrategy();
+ rtl::Reference<view::ViewStrategy> xStrategy = !bReadonly ? m_xStrategy : view::createReadOnlyStrategy();
- ElementTreeImpl * pNewTree;
+ ElementTree * pNewTree;
if (m_pParentTree)
- pNewTree = new ElementTreeImpl(xStrategy, *m_pParentTree, m_nPos, _aTree,m_nDepth, m_aTemplate, m_aTemplateProvider);
+ pNewTree = new ElementTree(xStrategy, *m_pParentTree, m_nPos, tree, m_nDepth, m_aTemplate, m_aTemplateProvider);
else
- pNewTree = new ElementTreeImpl(xStrategy, _aTree, m_nDepth, m_aTemplate, m_aTemplateProvider);
+ pNewTree = new ElementTree(xStrategy, tree, m_nDepth, m_aTemplate, m_aTemplateProvider);
- collection.push_back( Element(pNewTree,bInDefault));
+ collection.push_back( ElementTreeData(pNewTree,bInDefault));
}
}
@@ -225,13 +218,13 @@ namespace
// class ElementSet
//-------------------------------------------------------------------------
-bool ElementSet::hasElement(Name const& aName) const
+bool ElementSet::hasElement(rtl::OUString const& aName) const
{
return m_aData.find(aName) != m_aData.end();
}
//-------------------------------------------------------------------------
-ElementTreeData* ElementSet::getElement(Name const& aName)
+ElementTreeData* ElementSet::getElement(rtl::OUString const& aName)
{
Data::iterator it = m_aData.find(aName);
if (it != m_aData.end())
@@ -242,7 +235,7 @@ ElementTreeData* ElementSet::getElement(Name const& aName)
//-------------------------------------------------------------------------
-ElementTreeData const* ElementSet::getElement(Name const& aName) const
+ElementTreeData const* ElementSet::getElement(rtl::OUString const& aName) const
{
Data::const_iterator it = m_aData.find(aName);
if (it != m_aData.end())
@@ -252,9 +245,9 @@ ElementTreeData const* ElementSet::getElement(Name const& aName) const
}
//-------------------------------------------------------------------------
-ElementTreeData ElementSet::findElement(Name const& aName)
+ElementTreeData ElementSet::findElement(rtl::OUString const& aName)
{
- Element aRet;
+ ElementTreeData aRet;
Data::iterator it = m_aData.find(aName);
if (it != m_aData.end())
@@ -264,7 +257,7 @@ ElementTreeData ElementSet::findElement(Name const& aName)
}
//-------------------------------------------------------------------------
-void ElementSet::insertElement(Name const& aName, Element const& aNewEntry)
+void ElementSet::insertElement(rtl::OUString const& aName, ElementTreeData const& aNewEntry)
{
bool bInserted = m_aData.insert(Data::value_type(aName, aNewEntry)).second;
@@ -273,25 +266,25 @@ void ElementSet::insertElement(Name const& aName, Element const& aNewEntry)
}
//-------------------------------------------------------------------------
-ElementTreeData ElementSet::replaceElement(Name const& aName, Element const& aNewEntry)
+ElementTreeData ElementSet::replaceElement(rtl::OUString const& aName, ElementTreeData const& aNewEntry)
{
OSL_ENSURE(m_aData.find(aName) != m_aData.end(),"INTERNAL ERROR: Replaced set Element is not present");
- Element& rElement = m_aData[aName];
+ ElementTreeData& rElement = m_aData[aName];
- Element aOld = rElement;
+ ElementTreeData aOld = rElement;
rElement = aNewEntry;
return aOld;
}
//-------------------------------------------------------------------------
-ElementTreeData ElementSet::removeElement(Name const& aName)
+ElementTreeData ElementSet::removeElement(rtl::OUString const& aName)
{
Data::iterator it = m_aData.find(aName);
OSL_ENSURE(it != m_aData.end(),"INTERNAL ERROR: Removed set Element is not present");
- Element aOld;
+ ElementTreeData aOld;
if (it != m_aData.end())
{
aOld = it->second;
@@ -305,10 +298,10 @@ ElementTreeData ElementSet::removeElement(Name const& aName)
// class SetEntry
//-----------------------------------------------------------------------------
-SetEntry::SetEntry(ElementTreeImpl* pTree_)
+SetEntry::SetEntry(ElementTree* pTree_)
: m_pTree(pTree_)
{
- OSL_ENSURE(pTree_ == 0 || pTree_->isValidNode(pTree_->root_()),
+ OSL_ENSURE(pTree_ == 0 || pTree_->isValidNode(Tree::ROOT),
"INTERNAL ERROR: Invalid empty tree used for SetEntry ");
}
@@ -317,7 +310,7 @@ SetEntry::SetEntry(ElementTreeImpl* pTree_)
view::ViewTreeAccess SetEntry::getTreeView() const
{
OSL_ENSURE(isValid(), "Cannot get View Access for NULL SetEntry");
- return view::ViewTreeAccess(*m_pTree);
+ return view::ViewTreeAccess(m_pTree);
}
//-----------------------------------------------------------------------------
@@ -327,8 +320,8 @@ view::ViewTreeAccess SetEntry::getTreeView() const
// class SetNodeImpl
//-------------------------------------------------------------------------
-SetNodeImpl::SetNodeImpl(data::SetNodeAddress _pNodeRef,Template* pTemplate)
-: NodeImpl(reinterpret_cast<NodeAddress>(_pNodeRef))
+SetNodeImpl::SetNodeImpl(sharable::SetNode * _pNodeRef,Template* pTemplate)
+: NodeImpl(reinterpret_cast<sharable::Node *>(_pNodeRef))
,m_aTemplate(pTemplate)
,m_aTemplateProvider()
,m_pParentTree(0)
@@ -344,7 +337,7 @@ SetNodeImpl::~SetNodeImpl()
}
//-----------------------------------------------------------------------------
-void SetNodeImpl::rebuildFrom(SetNodeImpl& rOldData,data::SetNodeAccess const& _aNewNode)
+void SetNodeImpl::rebuildFrom(SetNodeImpl& rOldData, sharable::SetNode * newNode)
{
m_aTemplate = rOldData.m_aTemplate;
m_aTemplateProvider = rOldData.m_aTemplateProvider;
@@ -355,7 +348,7 @@ void SetNodeImpl::rebuildFrom(SetNodeImpl& rOldData,data::SetNodeAccess const& _
if (rOldData.implHasLoadedElements())
{
rOldData.doTransferElements(m_aDataSet);
- implRebuildElements(_aNewNode);
+ implRebuildElements(newNode);
OSL_ASSERT(this->implHasLoadedElements());
}
else
@@ -375,7 +368,7 @@ void SetNodeImpl::doTransferElements(ElementSet& rReplacement)
}
//-----------------------------------------------------------------------------
-void SetNodeImpl::implRebuildElements(data::SetNodeAccess const& _aNewNode)
+void SetNodeImpl::implRebuildElements(sharable::SetNode * newNode)
{
OSL_ENSURE(m_pParentTree,"Cannot rebuild set without context tree");
rtl::Reference<view::ViewStrategy> xNewStrategy = m_pParentTree->getViewBehavior();
@@ -387,43 +380,34 @@ void SetNodeImpl::implRebuildElements(data::SetNodeAccess const& _aNewNode)
OSL_ASSERT(it->isValid());
if (!it->isValid()) continue;
- Element aElement = *it;
- Name aName = aElement->getSimpleRootName();
+ ElementTreeData aElement = *it;
+ rtl::OUString aName = aElement->getSimpleRootName();
- data::TreeAccessor const& aNewElementAccess = _aNewNode.getElementTree(aName);
- OSL_ASSERT(aNewElementAccess != NULL);
-#ifdef DEBUG
- data::TreeAccessor const& aOldElementAccess = aElement->getOriginalTreeAccess();
- OSL_ASSERT(aOldElementAccess != NULL);
-#endif
+ sharable::TreeFragment * aNewElementAccess = newNode->getElement(aName);
+ OSL_ASSERT(
+ aNewElementAccess != 0 && aElement->getOriginalTreeAccess() != 0);
aElement->rebuild(xNewStrategy,aNewElementAccess);
}
}
//-----------------------------------------------------------------------------
-data::SetNodeAccess SetNodeImpl::getDataAccess() const
+sharable::SetNode * SetNodeImpl::getDataAccess() const
{
- using namespace data;
-
- NodeAccess aNodeAccess = getOriginalNodeAccess();
- OSL_ASSERT(SetNodeAccess::isInstance(aNodeAccess));
-
- SetNodeAccess aSetAccess(aNodeAccess);
- OSL_ASSERT(aSetAccess.isValid());
-
- return aSetAccess;
+ sharable::Node * node = getOriginalNodeAccess();
+ OSL_ASSERT(node != 0 && node->isSet());
+ return &node->set;
}
//-----------------------------------------------------------------------------
-TreeImpl* SetNodeImpl::getParentTree() const
+Tree* SetNodeImpl::getParentTree() const
{
OSL_ENSURE(m_pParentTree,"Set Node: Parent tree not set !");
return m_pParentTree;
}
//-----------------------------------------------------------------------------
-NodeOffset SetNodeImpl::getContextOffset() const
+unsigned int SetNodeImpl::getContextOffset() const
{
OSL_ENSURE(m_nContextPos,"Set Node: Position within parent tree not set !");
return m_nContextPos;
@@ -446,7 +430,7 @@ bool SetNodeImpl::doIsEmpty() const
}
//-------------------------------------------------------------------------
-ElementTreeImpl* SetNodeImpl::doFindElement(Name const& aName)
+ElementTree* SetNodeImpl::doFindElement(rtl::OUString const& aName)
{
return m_aDataSet.findElement(aName).get();
}
@@ -458,22 +442,22 @@ void SetNodeImpl::doDifferenceToDefaultState(SubtreeChange& _rChangeToDefault, I
}
//-----------------------------------------------------------------------------
-SetElementChangeImpl* SetNodeImpl::doAdjustToAddedElement(Name const& aName, AddNode const& aAddNodeChange, Element const & aNewElement)
+SetElementChangeImpl* SetNodeImpl::doAdjustToAddedElement(rtl::OUString const& aName, AddNode const& aAddNodeChange, ElementTreeData const & aNewElement)
{
return implAdjustToAddedElement(aName,aNewElement,aAddNodeChange.isReplacing());
}
//-------------------------------------------------------------------------
-SetElementChangeImpl* SetNodeImpl::implAdjustToAddedElement(Name const& aName, Element const & aNewElement, bool _bReplacing)
+SetElementChangeImpl* SetNodeImpl::implAdjustToAddedElement(rtl::OUString const& aName, ElementTreeData const & aNewElement, bool _bReplacing)
{
{ (void)_bReplacing; }
- OSL_ENSURE( validatedName(aNewElement) == aName, "Unexpected Name on new element" );
+ OSL_ENSURE( validatedName(aNewElement) == aName, "Unexpected name on new element" );
if (hasStoredElement(aName))
{
OSL_ENSURE( _bReplacing, "Added Element already exists - replacing" );
- Element aOldElement = this->replaceElement(aName,aNewElement);
+ ElementTreeData aOldElement = this->replaceElement(aName,aNewElement);
return implCreateReplace(aName,aNewElement,aOldElement);
}
@@ -487,17 +471,17 @@ SetElementChangeImpl* SetNodeImpl::implAdjustToAddedElement(Name const& aName, E
}
//-------------------------------------------------------------------------
-SetElementChangeImpl* SetNodeImpl::doAdjustToRemovedElement(Name const& aName, RemoveNode const& /*aRemoveNodeChange*/)
+SetElementChangeImpl* SetNodeImpl::doAdjustToRemovedElement(rtl::OUString const& aName, RemoveNode const& /*aRemoveNodeChange*/)
{
return implAdjustToRemovedElement(aName);
}
//-------------------------------------------------------------------------
-SetElementChangeImpl* SetNodeImpl::implAdjustToRemovedElement(Name const& aName)
+SetElementChangeImpl* SetNodeImpl::implAdjustToRemovedElement(rtl::OUString const& aName)
{
- if (Element* pOriginal = getStoredElement(aName))
+ if (ElementTreeData* pOriginal = getStoredElement(aName))
{
- Element aOldElement = *pOriginal;
+ ElementTreeData aOldElement = *pOriginal;
this->removeElement(aName);
return implCreateRemove(aName,aOldElement);
@@ -510,7 +494,7 @@ SetElementChangeImpl* SetNodeImpl::implAdjustToRemovedElement(Name const& aName)
}
//-------------------------------------------------------------------------
-SetElementChangeImpl* SetNodeImpl::implCreateInsert(Name const& aName, Element const& aNewElement) const
+SetElementChangeImpl* SetNodeImpl::implCreateInsert(rtl::OUString const& aName, ElementTreeData const& aNewElement) const
{
Path::Component aFullName = Path::makeCompositeName(aName, this->getElementTemplate()->getName());
@@ -520,7 +504,7 @@ SetElementChangeImpl* SetNodeImpl::implCreateInsert(Name const& aName, Element c
}
//-------------------------------------------------------------------------
-SetElementChangeImpl* SetNodeImpl::implCreateReplace(Name const& aName, Element const& aNewElement, Element const& aOldElement) const
+SetElementChangeImpl* SetNodeImpl::implCreateReplace(rtl::OUString const& aName, ElementTreeData const& aNewElement, ElementTreeData const& aOldElement) const
{
Path::Component aFullName = Path::makeCompositeName(aName, this->getElementTemplate()->getName());
@@ -530,7 +514,7 @@ SetElementChangeImpl* SetNodeImpl::implCreateReplace(Name const& aName, Element
}
//-------------------------------------------------------------------------
-SetElementChangeImpl* SetNodeImpl::implCreateRemove(Name const& aName, Element const& aOldElement) const
+SetElementChangeImpl* SetNodeImpl::implCreateRemove(rtl::OUString const& aName, ElementTreeData const& aOldElement) const
{
Path::Component aFullName = Path::makeCompositeName(aName, this->getElementTemplate()->getName());
@@ -540,7 +524,7 @@ SetElementChangeImpl* SetNodeImpl::implCreateRemove(Name const& aName, Element c
}
//-------------------------------------------------------------------------
-void SetNodeImpl::insertElement(Name const& aName, Element const& aNewElement)
+void SetNodeImpl::insertElement(rtl::OUString const& aName, ElementTreeData const& aNewElement)
{
attach(aNewElement,aName);
try
@@ -555,12 +539,12 @@ void SetNodeImpl::insertElement(Name const& aName, Element const& aNewElement)
}
//-------------------------------------------------------------------------
-Element SetNodeImpl::replaceElement(Name const& aName, Element const& aNewElement)
+ElementTreeData SetNodeImpl::replaceElement(rtl::OUString const& aName, ElementTreeData const& aNewElement)
{
attach(aNewElement,aName);
try
{
- Element aOldElement = m_aDataSet.replaceElement(aName,aNewElement);
+ ElementTreeData aOldElement = m_aDataSet.replaceElement(aName,aNewElement);
detach(aOldElement);
return aOldElement;
}
@@ -572,9 +556,9 @@ Element SetNodeImpl::replaceElement(Name const& aName, Element const& aNewElemen
}
//-------------------------------------------------------------------------
-Element SetNodeImpl::removeElement(Name const& aName)
+ElementTreeData SetNodeImpl::removeElement(rtl::OUString const& aName)
{
- Element aOldElement = m_aDataSet.removeElement(aName);
+ ElementTreeData aOldElement = m_aDataSet.removeElement(aName);
detach(aOldElement);
return aOldElement;
}
@@ -592,13 +576,13 @@ SetNodeVisitor::Result SetNodeImpl::doDispatchToElements(SetNodeVisitor& aVisito
}
//-----------------------------------------------------------------------------
-void SetNodeImpl::attach(Element const& aNewElement, Name const& aName)
+void SetNodeImpl::attach(ElementTreeData const& aNewElement, rtl::OUString const& aName)
{
// check for name (this also reject NULLs, therefore it should go first)
- Name aActualName = validatedName(aNewElement);
+ rtl::OUString aActualName = validatedName(aNewElement);
- TreeImpl* pParentContext = getParentTree();
- NodeOffset nParentOffset = getContextOffset();
+ Tree* pParentContext = getParentTree();
+ unsigned int nParentOffset = getContextOffset();
OSL_ENSURE(nParentOffset != 0 && pParentContext != 0,"INTERNAL ERROR: Set has no context");
@@ -636,69 +620,59 @@ void SetNodeImpl::attach(Element const& aNewElement, Name const& aName)
throw Exception("INTERNAL ERROR: Cannot rename tree for insertion into set node");
}
}
-
-// if (bCommit) aNewElement->attachTo( directSetAccess_hack(getOriginalNodeAddress()), aName );
}
//-------------------------------------------------------------------------
-void SetNodeImpl::detach(Element const& aOldElement)
+void SetNodeImpl::detach(ElementTreeData const& aOldElement)
{
if (aOldElement.isValid())
{
aOldElement->detachTree();
-// if (bCommit) aOldElement->detachFrom( directSetAccess_hack(getOriginalNodeAddress()), validatedName(aOldElement));
}
}
//-------------------------------------------------------------------------
-Element SetNodeImpl::entryToElement(SetEntry const& _anEntry)
+ElementTreeData SetNodeImpl::entryToElement(SetEntry const& _anEntry)
{
- ElementTreeImpl * pTree = _anEntry.tree();
- return Element(pTree, isInDefault(_anEntry));
+ ElementTree * pTree = _anEntry.tree();
+ return ElementTreeData(pTree, isInDefault(_anEntry));
}
//-------------------------------------------------------------------------
-SetElementChangeImpl* SetNodeImpl::doAdjustChangedElement(NodeChangesInformation& rLocalChanges, Name const& aName, Change const& _aElementChange)
+SetElementChangeImpl* SetNodeImpl::doAdjustChangedElement(NodeChangesInformation& rLocalChanges, rtl::OUString const& aName, Change const& _aElementChange)
{
SetElementChangeImpl* pThisChange = NULL;
- if (Element* pElement = getStoredElement(aName))
+ if (ElementTreeData* pElement = getStoredElement(aName))
{
OSL_ASSERT(pElement->isValid());
- if (_aElementChange.ISA(SubtreeChange))
+ if (SubtreeChange const * subtreeChange = dynamic_cast< SubtreeChange const * >(&_aElementChange))
{
- //OSL_ENSURE( !containsValues(), "Unexpected kind of change: Tree change applied to value set element" );
-
- SubtreeChange const& aSubtreeChange = static_cast<SubtreeChange const&>(_aElementChange);
// recurse to element tree
- view::Tree aElementTree(**pElement);
+ Tree * elementTree = pElement->get();
- view::getViewBehavior(aElementTree)->adjustToChanges(rLocalChanges, view::getRootNode(aElementTree), aSubtreeChange);
+ view::getViewBehavior(elementTree)->adjustToChanges(rLocalChanges, view::getRootNode(elementTree), *subtreeChange);
}
- else if ( _aElementChange.ISA(ValueChange) )
+ else if (ValueChange const * valueChange = dynamic_cast< ValueChange const * >(&_aElementChange))
{
- //OSL_ENSURE( containsValues(), "Unexpected kind of change: Value change applied to tree set element" );
-
- ValueChange const& aValueChange = static_cast<ValueChange const&>(_aElementChange);
-
// make an element for the old element
- std::auto_ptr<ValueNode> aOldNode = OTreeNodeConverter().createCorrespondingNode(aValueChange);
- aOldNode->setValue(aValueChange.getOldValue());
+ std::auto_ptr<ValueNode> aOldNode = OTreeNodeConverter().createCorrespondingNode(*valueChange);
+ aOldNode->setValue(valueChange->getOldValue());
- bool bWasDefault = (aValueChange.getMode() == ValueChange::wasDefault);
+ bool bWasDefault = (valueChange->getMode() == ValueChange::wasDefault);
std::auto_ptr<INode> aBasePtr(aOldNode.release());
- Name aElementTypeName = getElementTemplate()->getName();
- data::TreeSegment aOldBaseTree = data::TreeSegment::createNew( aBasePtr, aElementTypeName.toString() );
+ rtl::OUString aElementTypeName = getElementTemplate()->getName();
+ rtl::Reference< data::TreeSegment > aOldBaseTree = data::TreeSegment::create( aBasePtr, aElementTypeName );
- ElementTreeHolder aOldElement = new ElementTreeImpl(aOldBaseTree, getElementTemplate(), getTemplateProvider());
+ rtl::Reference<ElementTree> aOldElement = new ElementTree(aOldBaseTree, getElementTemplate(), getTemplateProvider());
OSL_ASSERT(aOldBaseTree.is()); // the tree took ownership
OSL_ASSERT(aOldElement->isFree()); // the tree is free-floating
- pThisChange = implCreateReplace(aName,*pElement,Element(aOldElement,bWasDefault));
+ pThisChange = implCreateReplace(aName,*pElement,ElementTreeData(aOldElement,bWasDefault));
}
else
OSL_ENSURE( false, "Unexpected kind of change to set element" );
@@ -719,7 +693,7 @@ bool SetNodeImpl::implHasLoadedElements() const
}
//-----------------------------------------------------------------------------
-void SetNodeImpl::initElements(TemplateProvider const& aTemplateProvider,TreeImpl& rParentTree,NodeOffset nPos,TreeDepth nDepth)
+void SetNodeImpl::initElements(TemplateProvider const& aTemplateProvider,Tree& rParentTree,unsigned int nPos,unsigned int nDepth)
{
OSL_ENSURE(m_pParentTree == 0 || m_pParentTree == &rParentTree, "WARNING: Set Node: Changing parent");
OSL_ENSURE(m_nContextPos == 0 || m_nContextPos == nPos, "WARNING: Set Node: Changing location within parent");
@@ -747,7 +721,7 @@ bool SetNodeImpl::implLoadElements()
OSL_ENSURE(!getElementTemplate().is() || getElementTemplate()->isInstanceTypeKnown(),"ERROR: Need a type-validated template to fill a set");
OSL_ENSURE(getTemplateProvider().isValid() || getElementTemplate()->isInstanceValue(), "ERROR: Need a template provider to fill a non-primitive set");
- TreeDepth nDepth = m_aInit;
+ unsigned int nDepth = m_aInit;
implInitElements(this->getDataAccess(),nDepth);
m_aInit = 0;
}
@@ -764,18 +738,17 @@ void SetNodeImpl::implEnsureElementsLoaded()
}
//-----------------------------------------------------------------------------
-void SetNodeImpl::implInitElements( data::SetNodeAccess const& _aNode, TreeDepth nDepth)
+void SetNodeImpl::implInitElements(sharable::SetNode * node, unsigned int nDepth)
{
- TreeImpl* pThisTree = getParentTree();
+ Tree* pThisTree = getParentTree();
OSL_ENSURE(pThisTree,"Cannot load elements of a set that has no parent tree");
CollectElementTrees aCollector( pThisTree->getViewBehavior(), pThisTree, getContextOffset(),
nDepth, getElementTemplate(), getTemplateProvider() );
- aCollector.collect(_aNode);
+ aCollector.collect(node);
- typedef CollectElementTrees::Collection::const_iterator Iter;
- for(Iter it = aCollector.collection.begin(), stop = aCollector.collection.end();
+ for(std::vector<ElementTreeData>::const_iterator it = aCollector.collection.begin(), stop = aCollector.collection.end();
it != stop; ++it)
{
implInitElement(implValidateElement(*it));
@@ -783,7 +756,7 @@ void SetNodeImpl::implInitElements( data::SetNodeAccess const& _aNode, TreeDepth
}
//-------------------------------------------------------------------------
-void SetNodeImpl::implInitElement(Element const& aNewElement)
+void SetNodeImpl::implInitElement(ElementTreeData const& aNewElement)
{
OSL_PRECOND(aNewElement.isValid(),"INTERNAL ERROR: Set element is NULL");
OSL_ENSURE(!aNewElement->isFree(),"INTERNAL ERROR: Set element is free-floating");
@@ -791,40 +764,36 @@ void SetNodeImpl::implInitElement(Element const& aNewElement)
OSL_ENSURE(aNewElement->getContextTree() == getParentTree(),"INTERNAL ERROR: Set element has wrong context tree");
OSL_ENSURE(aNewElement->getContextNode() == getContextOffset(),"INTERNAL ERROR: Set element has wrong context node");
- Name aName = validatedName(aNewElement);
+ rtl::OUString aName = validatedName(aNewElement);
- OSL_ENSURE(!aName.isEmpty(),"INTERNAL ERROR: Unnamed element in set");
+ OSL_ENSURE(aName.getLength() != 0,"INTERNAL ERROR: Unnamed element in set");
OSL_ENSURE(m_aDataSet.getElement(aName) == 0,"INTERNAL ERROR: Duplicate element name in set");
m_aDataSet.insertElement(aName,aNewElement);
}
//-------------------------------------------------------------------------
-Element SetNodeImpl::makeAdditionalElement(rtl::Reference<view::ViewStrategy> const& _xStrategy, AddNode const& aAddNodeChange, TreeDepth nDepth)
+ElementTreeData SetNodeImpl::makeAdditionalElement(rtl::Reference<view::ViewStrategy> const& _xStrategy, AddNode const& aAddNodeChange, unsigned int nDepth)
{
OSL_ENSURE(aAddNodeChange.wasInserted(), "Cannot integrate element that is not in tree yet");
- data::TreeAddress aAddedTree = aAddNodeChange.getInsertedTree();
+ sharable::TreeFragment * aAddedTree = aAddNodeChange.getInsertedTree();
// need 'unsafe', because ownership would be gone when notifications are sent
if (aAddedTree != NULL)
{
- // OSL_ENSURE( pNode->ISA(ISubtree), "Type mismatch when adjusting to update: value element found in tree set");
-
CollectElementTrees aCollector( _xStrategy, getParentTree(), getContextOffset(),
nDepth, getElementTemplate(), getTemplateProvider() );
- data::TreeAccessor aElementAccess(aAddedTree);
-
- return implValidateElement(aCollector.create(aElementAccess));
+ return implValidateElement(aCollector.create(aAddedTree));
}
- return Element();
+ return ElementTreeData();
}
//-------------------------------------------------------------------------
-Element SetNodeImpl::implValidateElement(Element const& aNewElement)
+ElementTreeData SetNodeImpl::implValidateElement(ElementTreeData const& aNewElement)
{
- TemplateHolder aTemplate = getElementTemplate();
+ rtl::Reference<Template> aTemplate = getElementTemplate();
OSL_ENSURE(aTemplate.is(),"INTERNAL ERROR: No template in set node");
OSL_ENSURE(aTemplate->isInstanceTypeKnown(),"INTERNAL ERROR: Unspecifed template in set node");
@@ -844,17 +813,17 @@ Element SetNodeImpl::implValidateElement(Element const& aNewElement)
throw Exception("INTERNAL ERROR: Complex element tree in value set");
}
- view::Node aElementRoot = view::getRootNode( view::Tree(*aNewElement) );
+ view::Node aElementRoot = view::getRootNode(aNewElement.get());
OSL_ENSURE(aElementRoot.isValueNode(),"INTERNAL ERROR: Inserting complex type into value set node");
view::ValueNode aValueNode(aElementRoot);
- UnoType aValueType = aValueNode.get_impl()->getValueType();
+ com::sun::star::uno::Type aValueType = aValueNode.get_impl()->getValueType();
OSL_ENSURE( aValueType.getTypeClass() != uno::TypeClass_INTERFACE,
"INTERNAL ERROR: Inserting complex type into value set node");
- UnoType aElementType = aTemplate->getInstanceType();
+ com::sun::star::uno::Type aElementType = aTemplate->getInstanceType();
if (aValueType != aElementType)
{
@@ -872,8 +841,8 @@ Element SetNodeImpl::implValidateElement(Element const& aNewElement)
// TODO: add some validation here
if (!aNewElement->isTemplateInstance())
{
- throw TypeMismatch( OUString(RTL_CONSTASCII_USTRINGPARAM("<Unknown> [Missing Template]")),
- aTemplate->getName().toString(),
+ throw TypeMismatch( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("<Unknown> [Missing Template]")),
+ aTemplate->getName(),
" - Trying to insert element without template into set");
}
if (!aNewElement->isInstanceOf(aTemplate))
@@ -905,54 +874,50 @@ namespace
{
}
- void diff(data::SetNodeAccess const& _aActualTree)
+ void diff(sharable::SetNode * actualTree)
{
translate(m_rDefaultTree);
- visitElements(_aActualTree);
+ visitElements(actualTree);
}
- protected:
- using NodeVisitor::handle;
private:
void translate(ISubtree& _rDefaultTree);
- void handleDefault(data::TreeSegment const & _pDefaultElement);
- void handleActual(data::TreeAccessor const& _aElement);
+ void handleDefault(rtl::Reference< data::TreeSegment > const & _pDefaultElement);
+ void handleActual(sharable::TreeFragment * element);
- virtual Result handle(data::TreeAccessor const& _aElement)
- { handleActual(_aElement); return CONTINUE; }
+ using SetVisitor::handle;
+ virtual bool handle(sharable::TreeFragment * tree)
+ { handleActual(tree); return false; }
};
//-------------------------------------------------------------------------
void DiffToDefault::translate(ISubtree& _rDefaultTree)
{
- typedef CollectNames::NameList::const_iterator NameIter;
-
- OUString aTypeName = _rDefaultTree.getElementTemplateName();
+ rtl::OUString aTypeName = _rDefaultTree.getElementTemplateName();
OSL_ENSURE(aTypeName.getLength(),"Cannot get element type for default set");
CollectNames aCollector;
aCollector.applyToChildren(_rDefaultTree);
- CollectNames::NameList const& aNames = aCollector.list();
+ std::vector<rtl::OUString> const& aNames = aCollector.list();
- for(NameIter it = aNames.begin(); it != aNames.end(); ++it)
+ for(std::vector<rtl::OUString>::const_iterator it = aNames.begin(); it != aNames.end(); ++it)
{
std::auto_ptr<INode> aChild = _rDefaultTree.removeChild(*it);
- handleDefault( data::TreeSegment::createNew(aChild,aTypeName) );
+ handleDefault( data::TreeSegment::create(aChild,aTypeName) );
}
}
//-------------------------------------------------------------------------
- void DiffToDefault::handleDefault(data::TreeSegment const &_pDefaultElement)
+ void DiffToDefault::handleDefault(rtl::Reference< data::TreeSegment > const &_pDefaultElement)
{
OSL_PRECOND(_pDefaultElement.is(), "Unexpected NULL default node");
- if (!_pDefaultElement.is()) return;
- OUString sName = _pDefaultElement.getName().toString();
+ rtl::OUString sName = _pDefaultElement->fragment->getName();
- OSL_ENSURE(_pDefaultElement.getTreeData()->getAttributes().isDefault(), "Missing default state on default element tree");
- OSL_ENSURE(_pDefaultElement.getSegmentRootNode()->isDefault(), "Missing default attribute on default node");
+ OSL_ENSURE(_pDefaultElement->fragment->getAttributes().isDefault(), "Missing default state on default element tree");
+ OSL_ENSURE(_pDefaultElement->fragment->nodes[0].isDefault(), "Missing default attribute on default node");
std::auto_ptr<AddNode> pAddIt( m_rChangeFactory.createAddNodeChange(_pDefaultElement, sName,true) );
@@ -961,39 +926,30 @@ namespace
//-------------------------------------------------------------------------
// -----------------------------------------------------------------------------
- void DiffToDefault::handleActual(data::TreeAccessor const& _aElement)
+ void DiffToDefault::handleActual(sharable::TreeFragment * element)
{
- bool bDefaultElement = _aElement.getRootNode()->isDefault();
+ bool bDefaultElement = element->getRootNode()->isDefault();
- OUString sName = _aElement.getName().toString();
+ rtl::OUString sName = element->getName();
if (Change* pDefaultNode = m_rChange.getChange(sName) )
{
- if (pDefaultNode->ISA(AddNode))
+ if (AddNode * addNode = dynamic_cast< AddNode * >(pDefaultNode))
{
- AddNode* pAddIt = static_cast<AddNode*>(pDefaultNode);
if (bDefaultElement)
{
- data::TreeSegment aDefaultTree = pAddIt->getNewTree();
- m_rDefaultTree.addChild( aDefaultTree.cloneData(true) );
+ rtl::Reference< data::TreeSegment > aDefaultTree = addNode->getNewTree();
+ m_rDefaultTree.addChild(data::convertTree(aDefaultTree.is() ? aDefaultTree->fragment : 0, true));
// no change needed - remove the change and recover the default
m_rChange.removeChange(sName);
}
- else
- {
- // OSL_ENSURE(!pAddIt->getReplacedNode().is(), "Duplicate node name in actual tree");
-
- // pAddIt->expectReplacedNode(pActualNode);
- }
}
else
{
// should never happen
- OSL_ENSURE(pDefaultNode->ISA(RemoveNode), "Unexpected node type found in translated default tree");
- OSL_ENSURE(!pDefaultNode->ISA(RemoveNode), "Duplicate node name in actual tree");
-
+ OSL_ASSERT(false);
if (bDefaultElement) m_rChange.removeChange(sName);
}
}
@@ -1015,16 +971,16 @@ void SetNodeImpl::implDifferenceToDefaultState(SubtreeChange& _rChangeToDefault,
}
//-----------------------------------------------------------------------------
void SetNodeImpl::convertChanges(NodeChangesInformation& rLocalChanges, SubtreeChange const& rExternalChange,
- TreeDepth nDepth)
+ unsigned int nDepth)
{
OSL_ASSERT(nDepth > 0);
- if (TreeImpl* pParentTree = this->getParentTree())
+ if (Tree* pParentTree = this->getParentTree())
{
- NodeOffset nNode = getContextOffset();
+ unsigned int nNode = getContextOffset();
OSL_ENSURE(pParentTree->isValidNode(nNode), "Invalid context node in Set");
- OSL_ENSURE(view::Node(*pParentTree, nNode).get_impl() == this,
+ OSL_ENSURE(view::Node(pParentTree, nNode).get_impl() == this,
"Wrong context node in Set");
CollectChanges aCollector(rLocalChanges, *pParentTree, nNode, getElementTemplate(), nDepth);
diff --git a/configmgr/source/treemgr/setnodeimpl.hxx b/configmgr/source/treemgr/setnodeimpl.hxx
index 98f04b83b8..3134b7826a 100644
--- a/configmgr/source/treemgr/setnodeimpl.hxx
+++ b/configmgr/source/treemgr/setnodeimpl.hxx
@@ -32,7 +32,7 @@
#define CONFIGMGR_SETNODEBEHAVIOR_HXX_
#include "nodeimpl.hxx"
-#include "treeimpl.hxx"
+#include "tree.hxx"
#include "template.hxx"
#include <rtl/ref.hxx>
@@ -51,6 +51,7 @@ namespace configmgr
class SubtreeChange;
class AddNode;
class RemoveNode;
+ namespace view { class ViewTreeAccess; }
//-----------------------------------------------------------------------------
namespace configuration
@@ -59,21 +60,18 @@ namespace configmgr
class SetElementChangeImpl;
//-----------------------------------------------------------------------------
- typedef rtl::Reference<ElementTreeImpl> ElementTreeHolder; // also in configset.hxx
- typedef std::vector< ElementTreeHolder > ElementList; // also in treeimpl.hxx
-//-----------------------------------------------------------------------------
struct SetEntry
{
- SetEntry(ElementTreeImpl* _pTree);
+ SetEntry(ElementTree* _pTree);
bool isValid() const { return m_pTree != 0; }
- ElementTreeImpl* tree() const { return m_pTree; };
+ ElementTree* tree() const { return m_pTree; };
view::ViewTreeAccess getTreeView() const;
private:
- ElementTreeImpl* m_pTree;
+ ElementTree* m_pTree;
};
//-------------------------------------------------------------------------
@@ -90,22 +88,20 @@ namespace configmgr
struct ElementTreeData
{
- typedef rtl::Reference<ElementTreeImpl> ElementTreeHolder;
-
// construction
ElementTreeData() : tree(), inDefault(false) {}
- ElementTreeData(ElementTreeHolder const& _tree, bool _bDefault)
+ ElementTreeData(rtl::Reference<ElementTree> const& _tree, bool _bDefault)
: tree(_tree), inDefault(_bDefault) {}
// ORef compatibility
sal_Bool isValid() const { return this->tree.is(); }
- ElementTreeImpl* get() const { return this->tree.get(); }
- ElementTreeHolder const& operator->() const { return this->tree; }
- ElementTreeImpl& operator*() const { return *get(); }
+ ElementTree* get() const { return this->tree.get(); }
+ rtl::Reference<ElementTree> const& operator->() const { return this->tree; }
+ ElementTree& operator*() const { return *get(); }
// data
- ElementTreeHolder tree;
+ rtl::Reference<ElementTree> tree;
bool inDefault;
};
//-----------------------------------------------------------------------------
@@ -113,19 +109,19 @@ namespace configmgr
class ElementSet
{
public:
- typedef std::map<Name, ElementTreeData> Data;
+ typedef std::map<rtl::OUString, ElementTreeData> Data;
// the following must be implemented by derived classes
bool isEmpty() const { return m_aData.empty(); }
- bool hasElement(Name const& aName) const;
- ElementTreeData* getElement(Name const& aName);
- ElementTreeData const* getElement(Name const& aName) const;
- ElementTreeData findElement(Name const& aName);
+ bool hasElement(rtl::OUString const& aName) const;
+ ElementTreeData* getElement(rtl::OUString const& aName);
+ ElementTreeData const* getElement(rtl::OUString const& aName) const;
+ ElementTreeData findElement(rtl::OUString const& aName);
- void insertElement(Name const& aName, ElementTreeData const& aNewEntry);
- ElementTreeData replaceElement(Name const& aName, ElementTreeData const& aNewEntry);
- ElementTreeData removeElement(Name const& aName);
+ void insertElement(rtl::OUString const& aName, ElementTreeData const& aNewEntry);
+ ElementTreeData replaceElement(rtl::OUString const& aName, ElementTreeData const& aNewEntry);
+ ElementTreeData removeElement(rtl::OUString const& aName);
void clearElements() { m_aData.clear(); }
@@ -134,9 +130,8 @@ namespace configmgr
// STL style iteration
class ConstIterator
{
- typedef Data::const_iterator It;
public:
- ConstIterator(It const& it) : m_base(it) {}
+ ConstIterator(Data::const_iterator const& it) : m_base(it) {}
ElementTreeData const& operator* () const { return m_base->second; }
ElementTreeData const* operator->() const { return &m_base->second; }
@@ -152,16 +147,15 @@ namespace configmgr
friend bool operator !=(ConstIterator const& lhs, ConstIterator const& rhs)
{ return lhs.m_base != rhs.m_base; }
private:
- It m_base;
+ Data::const_iterator m_base;
};
ConstIterator begin() const { return ConstIterator(m_aData.begin()); }
ConstIterator end() const { return ConstIterator(m_aData.end()); }
class Iterator
{
- typedef Data::iterator It;
public:
- Iterator(It const& it) : m_base(it) {}
+ Iterator(Data::iterator const& it) : m_base(it) {}
ElementTreeData& operator* () const { return m_base->second; }
ElementTreeData* operator->() const { return &m_base->second; }
@@ -179,14 +173,13 @@ namespace configmgr
operator ConstIterator() const { return ConstIterator(m_base); }
private:
- It m_base;
+ Data::iterator m_base;
};
Iterator begin() { return Iterator(m_aData.begin()); }
Iterator end() { return Iterator(m_aData.end()); }
- typedef Data::const_iterator PairIterator;
- PairIterator beginNative() const { return m_aData.begin(); }
- PairIterator endNative() const { return m_aData.end(); }
+ Data::const_iterator beginNative() const { return m_aData.begin(); }
+ Data::const_iterator endNative() const { return m_aData.end(); }
private:
Data m_aData;
};
@@ -199,34 +192,31 @@ namespace configmgr
{
friend class view::ViewStrategy;
ElementSet m_aDataSet;
- TemplateHolder m_aTemplate;
+ rtl::Reference<Template> m_aTemplate;
TemplateProvider m_aTemplateProvider;
- TreeImpl* m_pParentTree;
- NodeOffset m_nContextPos;
+ Tree* m_pParentTree;
+ unsigned int m_nContextPos;
- typedef NodeOffset InitHelper;
- InitHelper m_aInit;
+ unsigned int m_aInit;
public:
- typedef ElementTreeData Element;
-
- SetNodeImpl(data::SetNodeAddress _pNodeRef, Template* pTemplate);
+ SetNodeImpl(sharable::SetNode * _pNodeRef, Template* pTemplate);
- data::SetNodeAccess getDataAccess() const;
+ sharable::SetNode * getDataAccess() const;
/// Get the template that describes elements of this set
- TemplateHolder getElementTemplate() const { return m_aTemplate; }
+ rtl::Reference<Template> getElementTemplate() const { return m_aTemplate; }
/// Get a template provider that can create new elements for this set
TemplateProvider getTemplateProvider() const { return m_aTemplateProvider; }
- void convertChanges(NodeChangesInformation& rLocalChanges, SubtreeChange const& rExternalChange, TreeDepth nDepth);
+ void convertChanges(NodeChangesInformation& rLocalChanges, SubtreeChange const& rExternalChange, unsigned int nDepth);
- void insertElement(Name const& aName, Element const& aNewElement);
- Element replaceElement(Name const& aName, Element const& aNewElement);
- Element removeElement(Name const& aName);
+ void insertElement(rtl::OUString const& aName, ElementTreeData const& aNewElement);
+ ElementTreeData replaceElement(rtl::OUString const& aName, ElementTreeData const& aNewElement);
+ ElementTreeData removeElement(rtl::OUString const& aName);
- void rebuildFrom(SetNodeImpl& rOldData,data::SetNodeAccess const& _aNewNode);
+ void rebuildFrom(SetNodeImpl& rOldData, sharable::SetNode * newNode);
protected:
~SetNodeImpl();
@@ -234,66 +224,66 @@ namespace configmgr
protected:
// new overrideables
virtual bool doIsEmpty() const;
- virtual ElementTreeImpl* doFindElement(Name const& aName) ;
+ virtual ElementTree* doFindElement(rtl::OUString const& aName) ;
virtual SetNodeVisitor::Result doDispatchToElements( SetNodeVisitor& aVisitor);
virtual void doDifferenceToDefaultState( SubtreeChange& _rChangeToDefault, ISubtree& _rDefaultTree);
- virtual SetElementChangeImpl* doAdjustToAddedElement( Name const& aName, AddNode const& aAddNodeChange, Element const & aNewElement);
- virtual SetElementChangeImpl* doAdjustToRemovedElement( Name const& aName, RemoveNode const& aRemoveNodeChange);
- virtual SetElementChangeImpl* doAdjustChangedElement( NodeChangesInformation& rLocalChanges, Name const& aName, Change const& aChange);
+ virtual SetElementChangeImpl* doAdjustToAddedElement( rtl::OUString const& aName, AddNode const& aAddNodeChange, ElementTreeData const & aNewElement);
+ virtual SetElementChangeImpl* doAdjustToRemovedElement( rtl::OUString const& aName, RemoveNode const& aRemoveNodeChange);
+ virtual SetElementChangeImpl* doAdjustChangedElement( NodeChangesInformation& rLocalChanges, rtl::OUString const& aName, Change const& aChange);
virtual void doTransferElements(ElementSet& rReplacement);
protected:
// helpers
- TreeImpl* getParentTree() const;
- NodeOffset getContextOffset() const;
+ Tree* getParentTree() const;
+ unsigned int getContextOffset() const;
- Element makeElement( SetEntry const & _anEntry);
- static Element entryToElement(SetEntry const& _anEntry);
+ ElementTreeData makeElement( SetEntry const & _anEntry);
+ static ElementTreeData entryToElement(SetEntry const& _anEntry);
view::ViewTreeAccess getElementView();
/// Initialize the set data: Set context information, and build the view (actually loading the elements may be deferred)
friend class TreeImplBuilder;
- void initElements(TemplateProvider const& aTemplateProvider, TreeImpl& rParentTree, NodeOffset nPos, TreeDepth nDepth);
+ void initElements(TemplateProvider const& aTemplateProvider, Tree& rParentTree, unsigned int nPos, unsigned int nDepth);
protected:
/// does this set contain any elements (loads elements if needed)
bool implHasLoadedElements() const;
bool implLoadElements();
void implEnsureElementsLoaded();
- void implInitElements(data::SetNodeAccess const& _aNode, TreeDepth nDepth);
- void implInitElement(Element const& aNewElement);
+ void implInitElements(sharable::SetNode * node, unsigned int nDepth);
+ void implInitElement(ElementTreeData const& aNewElement);
- void implRebuildElements(data::SetNodeAccess const& _aNewNode);
+ void implRebuildElements(sharable::SetNode * newNode);
protected:
- SetElementChangeImpl* implCreateInsert ( Name const& aName, Element const& aNewElement) const;
- SetElementChangeImpl* implCreateReplace ( Name const& aName, Element const& aNewElement, Element const& aOldElement) const;
- SetElementChangeImpl* implCreateRemove ( Name const& aName, Element const& aOldElement) const;
+ SetElementChangeImpl* implCreateInsert ( rtl::OUString const& aName, ElementTreeData const& aNewElement) const;
+ SetElementChangeImpl* implCreateReplace ( rtl::OUString const& aName, ElementTreeData const& aNewElement, ElementTreeData const& aOldElement) const;
+ SetElementChangeImpl* implCreateRemove ( rtl::OUString const& aName, ElementTreeData const& aOldElement) const;
- SetElementChangeImpl* implAdjustToAddedElement( Name const& aName, Element const& aNewElement, bool _bReplacing);
- SetElementChangeImpl* implAdjustToRemovedElement( Name const& aName);
+ SetElementChangeImpl* implAdjustToAddedElement( rtl::OUString const& aName, ElementTreeData const& aNewElement, bool _bReplacing);
+ SetElementChangeImpl* implAdjustToRemovedElement( rtl::OUString const& aName);
- Element makeAdditionalElement( rtl::Reference<view::ViewStrategy> const& _xStrategy, AddNode const& aAddNodeChange, TreeDepth nDepth);
+ ElementTreeData makeAdditionalElement( rtl::Reference<view::ViewStrategy> const& _xStrategy, AddNode const& aAddNodeChange, unsigned int nDepth);
- Element implValidateElement(Element const& aNewElement);
+ ElementTreeData implValidateElement(ElementTreeData const& aNewElement);
void implDifferenceToDefaultState( SubtreeChange& _rChangeToDefault, ISubtree& _rDefaultTree) const;
protected:
- bool hasStoredElement(Name const& aName) const
+ bool hasStoredElement(rtl::OUString const& aName) const
{ return m_aDataSet.hasElement(aName); }
- Element* getStoredElement(Name const& aName)
+ ElementTreeData* getStoredElement(rtl::OUString const& aName)
{ return m_aDataSet.getElement(aName); }
- Element const* getStoredElement(Name const& aName) const
+ ElementTreeData const* getStoredElement(rtl::OUString const& aName) const
{ return m_aDataSet.getElement(aName); }
- ElementSet::PairIterator beginElementSet() const
+ ElementSet::Data::const_iterator beginElementSet() const
{ return m_aDataSet.beginNative(); }
- ElementSet::PairIterator endElementSet() const
+ ElementSet::Data::const_iterator endElementSet() const
{ return m_aDataSet.endNative(); }
- void attach(Element const& aNewElement, Name const& aName);
- void detach(Element const& aNewElement);
+ void attach(ElementTreeData const& aNewElement, rtl::OUString const& aName);
+ void detach(ElementTreeData const& aNewElement);
};
//-----------------------------------------------------------------------------
diff --git a/configmgr/source/treemgr/template.cxx b/configmgr/source/treemgr/template.cxx
index 3dd5fc99ed..1f8249c63f 100644
--- a/configmgr/source/treemgr/template.cxx
+++ b/configmgr/source/treemgr/template.cxx
@@ -31,9 +31,9 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_configmgr.hxx"
+#include "node.hxx"
#include "template.hxx"
#include "templateimpl.hxx"
-#include "setnodeaccess.hxx"
#include "apitypes.hxx"
namespace configmgr
@@ -51,7 +51,7 @@ TemplateProvider::TemplateProvider()
}
//-----------------------------------------------------------------------------
-TemplateProvider::TemplateProvider(TemplateManagerRef const & xProvider, RequestOptions const& aOptions)
+TemplateProvider::TemplateProvider(rtl::Reference< TreeManager > const & xProvider, RequestOptions const& aOptions)
: m_aImpl( new TemplateProvider_Impl(xProvider,aOptions) )
{
}
@@ -78,7 +78,7 @@ TemplateProvider::~TemplateProvider()
// class Template
//-----------------------------------------------------------------------------
-Template::Template(Name const& aName, Name const& aModule,UnoType const& aType)
+Template::Template(rtl::OUString const& aName, rtl::OUString const& aModule,com::sun::star::uno::Type const& aType)
: m_aName(aName)
, m_aModule(aModule)
, m_aInstanceType(aType)
@@ -101,7 +101,7 @@ bool Template::isInstanceValue() const
}
//-----------------------------------------------------------------------------
-UnoType Template::getInstanceType() const
+com::sun::star::uno::Type Template::getInstanceType() const
{
OSL_ENSURE( isInstanceTypeKnown(), "Template instance type unknown - returning invalid (VOID) type");
return m_aInstanceType;
@@ -109,17 +109,17 @@ UnoType Template::getInstanceType() const
//-----------------------------------------------------------------------------
/// get the path where the template is located
-OUString Template::getPathString() const
+rtl::OUString Template::getPathString() const
{
TemplateName aNames(m_aName,m_aModule);
return aNames.makePathString( );
}
//-----------------------------------------------------------------------------
-TemplateHolder makeSetElementTemplate(data::SetNodeAccess const& _aSet, TemplateProvider const& _aProvider)
+rtl::Reference<Template> makeSetElementTemplate(sharable::SetNode * set, TemplateProvider const& _aProvider)
{
- TemplateName aNames( _aSet.getElementTemplateName(), _aSet.getElementTemplateModule() );
- return TemplateImplHelper::makeElementTemplateWithType(aNames, _aProvider, _aSet);
+ TemplateName aNames( set->getElementTemplateName(), set->getElementTemplateModule() );
+ return TemplateImplHelper::makeElementTemplateWithType(aNames, _aProvider, set);
}
//-----------------------------------------------------------------------------
}
diff --git a/configmgr/source/treemgr/templateimpl.cxx b/configmgr/source/treemgr/templateimpl.cxx
index 6cc4ded991..87bccef5d2 100644
--- a/configmgr/source/treemgr/templateimpl.cxx
+++ b/configmgr/source/treemgr/templateimpl.cxx
@@ -33,12 +33,9 @@
#include <stdio.h>
#include "templateimpl.hxx"
-#include "treeprovider.hxx"
+#include "treemanager.hxx"
+#include "node.hxx"
#include "nodevisitor.hxx"
-#include "treeaccessor.hxx"
-#include "nodeaccess.hxx"
-#include "valuenodeaccess.hxx"
-#include "setnodeaccess.hxx"
#include "strdecl.hxx"
#include "typeconverter.hxx"
#include "localizedtreeactions.hxx"
@@ -56,30 +53,28 @@ namespace configmgr
{
//-----------------------------------------------------------------------------
-UnoType TemplateName::resolveSimpleTypeName(Name const& aName)
+com::sun::star::uno::Type TemplateName::resolveSimpleTypeName(rtl::OUString const& aName)
{
- OUString sTypeName = aName.toString();
+ rtl::OUString sTypeName = aName;
return parseTemplateName(sTypeName);
}
//-----------------------------------------------------------------------------
#if OSL_DEBUG_LEVEL > 0
-Name TemplateName::makeNativeTypeModuleName()
+rtl::OUString TemplateName::makeNativeTypeModuleName()
{
- OUString aModuleName( TEMPLATE_MODULE_NATIVE_VALUE );
- return makeName(aModuleName, Name::NoValidate());
+ return rtl::OUString( TEMPLATE_MODULE_NATIVE_VALUE );
}
//-----------------------------------------------------------------------------
-Name TemplateName::makeLocalizedTypeModuleName()
+rtl::OUString TemplateName::makeLocalizedTypeModuleName()
{
- OUString aModuleName( TEMPLATE_MODULE_LOCALIZED_VALUE );
- return makeName(aModuleName, Name::NoValidate());
+ return rtl::OUString( TEMPLATE_MODULE_LOCALIZED_VALUE );
}
#endif
//-----------------------------------------------------------------------------
bool TemplateName::isSimpleTypeName() const
{
- bool bIsSimple = (aModule.toString().compareToAscii(TEMPLATE_MODULE_NATIVE_PREFIX,
+ bool bIsSimple = (aModule.compareToAscii(TEMPLATE_MODULE_NATIVE_PREFIX,
TEMPLATE_MODULE_NATIVE_PREFIX.getLength()) == 0);
OSL_ENSURE(!bIsSimple ||
@@ -91,9 +86,9 @@ bool TemplateName::isSimpleTypeName() const
}
//-----------------------------------------------------------------------------
-UnoType TemplateName::resolveToSimpleType() const
+com::sun::star::uno::Type TemplateName::resolveToSimpleType() const
{
- UnoType aType;
+ com::sun::star::uno::Type aType;
if ( isSimpleTypeName() )
{
aType = resolveSimpleTypeName( aName );
@@ -106,25 +101,25 @@ UnoType TemplateName::resolveToSimpleType() const
// class TemplateImplHelper
//-----------------------------------------------------------------------------
-TemplateHolder TemplateImplHelper::createNew (TemplateName const& aNames,UnoType const& aType)
+rtl::Reference<Template> TemplateImplHelper::createNew (TemplateName const& aNames,com::sun::star::uno::Type const& aType)
{
return new Template(aNames.aName, aNames.aModule, aType);
}
//-----------------------------------------------------------------------------
-TemplateHolder TemplateImplHelper::makeElementTemplateWithType(TemplateName const& _aNames, TemplateProvider const& _aProvider, data::SetNodeAccess const& _aSet)
+rtl::Reference<Template> TemplateImplHelper::makeElementTemplateWithType(TemplateName const& _aNames, TemplateProvider const& _aProvider, sharable::SetNode * set)
{
OSL_ENSURE(_aProvider.m_aImpl.is(), "ERROR: Cannot find a template without a provider");
if (_aProvider.m_aImpl.is())
- return _aProvider.m_aImpl->makeElementTemplateWithType(_aNames,_aSet);
+ return _aProvider.m_aImpl->makeElementTemplateWithType(_aNames, set);
else
- return TemplateHolder(0);
+ return rtl::Reference<Template>(0);
}
//-----------------------------------------------------------------------------
-void TemplateImplHelper::assignActualType (Template& aTemplate,UnoType const& aType)
+void TemplateImplHelper::assignActualType (Template& aTemplate,com::sun::star::uno::Type const& aType)
{
OSL_PRECOND( aType != getNoTypeAvailable(), "ERROR: Assigning NO type to a template" );
@@ -140,7 +135,7 @@ void TemplateImplHelper::assignActualType (Template& aTemplate,UnoType const& aT
// class TemplateProvider_Impl
//-----------------------------------------------------------------------------
-TemplateProvider_Impl::TemplateProvider_Impl(TemplateManagerRef const & xProvider, RequestOptions const& aOptions)
+TemplateProvider_Impl::TemplateProvider_Impl(rtl::Reference< TreeManager > const & xProvider, RequestOptions const& aOptions)
: m_xProvider(xProvider)
, m_aOptions(aOptions)
, m_aRepository()
@@ -148,25 +143,24 @@ TemplateProvider_Impl::TemplateProvider_Impl(TemplateManagerRef const & xProvide
}
//-----------------------------------------------------------------------------
-data::TreeSegment TemplateProvider_Impl::instantiate(TemplateHolder const& aTemplate)
+rtl::Reference< data::TreeSegment > TemplateProvider_Impl::instantiate(rtl::Reference<Template> const& aTemplate)
{
- data::TreeSegment pRet;
if (aTemplate.is())
{
- data::TreeAccessor aTemplateData = m_xProvider->requestTemplate(aTemplate->getName(), aTemplate->getModule());
+ sharable::TreeFragment * aTemplateData = m_xProvider->requestTemplate(aTemplate->getName(), aTemplate->getModule());
- pRet = cloneExpandedForLocale(aTemplateData, m_aOptions.getLocale());
+ return cloneExpandedForLocale(aTemplateData, m_aOptions.getLocale());
+ } else {
+ return rtl::Reference< data::TreeSegment >();
}
- return pRet;
}
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
namespace
{
- using namespace data;
//-----------------------------------------------------------------------------
- struct TypeDetector : SetVisitor
+ struct TypeDetector : data::SetVisitor
{
enum State
{
@@ -178,25 +172,23 @@ namespace
};
State result;
- UnoType type;
+ com::sun::star::uno::Type type;
TypeDetector() : result(NotFound), type() {}
- protected:
- using SetVisitor::handle;
-
- private: // NodeAction implementation
- Result handle(ValueNodeAccess const& _aValueNode);
- Result handle(NodeAccess const& _aNonValueNode);
+ private:
+ using SetVisitor::handle;
+ virtual bool handle(sharable::Node * node);
+ virtual bool handle(sharable::ValueNode * node);
};
//-----------------------------------------------------------------------------
- static UnoType detectNodeType(TreeAccessor const& _aElement)
+ static com::sun::star::uno::Type detectNodeType(sharable::TreeFragment * element)
{
- if (_aElement == NULL)
+ if (element == 0)
throw configuration::Exception("Could not load required template to detect set elements");
TypeDetector aDetector;
- aDetector.visitTree( _aElement );
+ aDetector.visitTree(element);
switch(aDetector.result)
{
@@ -217,10 +209,10 @@ namespace
}
//-------------------------------------------------------------------------
- static bool detectElementType(UnoType& aType, data::SetNodeAccess const& _aSet)
+ static bool detectElementType(com::sun::star::uno::Type& aType, sharable::SetNode * set)
{
TypeDetector aDetector;
- aDetector.visitElements( _aSet );
+ aDetector.visitElements(set);
bool bResult = false;
switch(aDetector.result)
@@ -247,15 +239,13 @@ namespace
}
//-----------------------------------------------------------------------------
-TemplateHolder TemplateProvider_Impl::makeElementTemplateWithType(TemplateName const& _aNames, data::SetNodeAccess const& _aSet)
+rtl::Reference<Template> TemplateProvider_Impl::makeElementTemplateWithType(TemplateName const& _aNames, sharable::SetNode * set)
{
- typedef TemplateRepository::value_type Entry;
-
TemplateRepository::iterator it = m_aRepository.find(_aNames);
if (it == m_aRepository.end() || !it->second->isInstanceTypeKnown())
{
- UnoType aType;
+ com::sun::star::uno::Type aType;
if (_aNames.isSimpleTypeName()) // native type found
{
aType = _aNames.resolveToSimpleType();
@@ -264,19 +254,19 @@ TemplateHolder TemplateProvider_Impl::makeElementTemplateWithType(TemplateName c
throw configuration::Exception("INTERNAL ERROR: Could not resolve native type");
}
- else if (!detectElementType(aType,_aSet))
+ else if (!detectElementType(aType, set))
{
- OSL_ASSERT(_aNames.aName == _aSet.getElementTemplateName());
- OSL_ASSERT(_aNames.aModule == _aSet.getElementTemplateModule());
+ OSL_ASSERT(_aNames.aName == set->getElementTemplateName());
+ OSL_ASSERT(_aNames.aModule == set->getElementTemplateModule());
- data::TreeAccessor aTemplateData = m_xProvider->requestTemplate(_aNames.aName, _aNames.aModule);
+ sharable::TreeFragment * aTemplateData = m_xProvider->requestTemplate(_aNames.aName, _aNames.aModule);
aType = detectNodeType(aTemplateData); // throws if necessary
}
OSL_ASSERT( aType != TemplateImplHelper::getNoTypeAvailable() );
if (it == m_aRepository.end())
- it = m_aRepository.insert( Entry( _aNames, TemplateImplHelper::createNew(_aNames,aType) ) ).first;
+ it = m_aRepository.insert( TemplateRepository::value_type( _aNames, TemplateImplHelper::createNew(_aNames,aType) ) ).first;
else
TemplateImplHelper::assignActualType(*it->second, aType);
@@ -289,8 +279,8 @@ TemplateHolder TemplateProvider_Impl::makeElementTemplateWithType(TemplateName c
else
{
OSL_ENSURE(it->second->isInstanceTypeKnown(), "No type assigned to Template");
- UnoType aTestType;
- if (detectElementType(aTestType,_aSet))
+ com::sun::star::uno::Type aTestType;
+ if (detectElementType(aTestType, set))
OSL_ENSURE(it->second->getInstanceType() == aTestType, "Inconsistent type found for Template");
}
#endif // DBG_UTIL
@@ -303,9 +293,9 @@ TemplateHolder TemplateProvider_Impl::makeElementTemplateWithType(TemplateName c
namespace
{
//-----------------------------------------------------------------------------
- TypeDetector::Result TypeDetector::handle(ValueNodeAccess const& _aValueNode)
+ bool TypeDetector::handle(sharable::ValueNode * node)
{
- UnoType aFoundType = _aValueNode.getValueType();
+ com::sun::star::uno::Type aFoundType = node->getValueType();
bool isNullType = (aFoundType.getTypeClass() == uno::TypeClass_VOID);
bool isAnyType = (aFoundType.getTypeClass() == uno::TypeClass_ANY);
@@ -340,13 +330,13 @@ namespace
this->result = Contradicting;
break;
}
- return CONTINUE; // always continue to detect errors in data
+ return false; // always continue to detect errors in data
}
//-----------------------------------------------------------------------------
- TypeDetector::Result TypeDetector::handle(NodeAccess const& _aNonValueNode)
+ bool TypeDetector::handle(sharable::Node * node)
{
- { (void)_aNonValueNode; }
- OSL_ENSURE(!ValueNodeAccess::isInstance(_aNonValueNode),"Value node dipatched to wrong handler");
+ (void) node; // avoid warnings
+ OSL_ENSURE(!node->isValue(), "Value node dipatched to wrong handler");
switch (this->result) // transition depends on previous state
{
case NotFound:
@@ -363,7 +353,7 @@ namespace
this->result = Contradicting;
break;
}
- return CONTINUE; // always continue to detect errors in data
+ return false; // always continue to detect errors in data
}
//-----------------------------------------------------------------------------
diff --git a/configmgr/source/treemgr/templateimpl.hxx b/configmgr/source/treemgr/templateimpl.hxx
index 507d22737d..1142c59f02 100644
--- a/configmgr/source/treemgr/templateimpl.hxx
+++ b/configmgr/source/treemgr/templateimpl.hxx
@@ -36,6 +36,7 @@
#include "requestoptions.hxx"
#include <rtl/ustrbuf.hxx>
#include <rtl/ref.hxx>
+#include <salhelper/simplereferenceobject.hxx>
#include "utility.hxx"
#ifndef INCLUDED_MAP
@@ -46,19 +47,13 @@
namespace configmgr
{
//-----------------------------------------------------------------------------
- struct ITemplateProvider;
-//-----------------------------------------------------------------------------
- namespace data { class SetNodeAccess; class TreeSegment; }
+ namespace data { class TreeSegment; }
//-----------------------------------------------------------------------------
namespace configuration
{
//-----------------------------------------------------------------------------
- typedef com::sun::star::uno::Type UnoType;
-
-//-----------------------------------------------------------------------------
-
//-----------------------------------------------------------------------------
// class TemplateName
@@ -66,7 +61,7 @@ namespace configmgr
struct TemplateName
{
//-----------------------------------------------------------------
- Name aName, aModule;
+ rtl::OUString aName, aModule;
//-----------------------------------------------------------------
TemplateName()
@@ -74,43 +69,39 @@ namespace configmgr
, aModule()
{}
- TemplateName(Name const& aName_)
+ TemplateName(rtl::OUString const& aName_)
: aName(aName_)
, aModule()
{}
- TemplateName(Name const& aName_, Name const& aModule_)
+ TemplateName(rtl::OUString const& aName_, rtl::OUString const& aModule_)
: aName(aName_)
, aModule(aModule_)
{}
- TemplateName(OUString const& sName_, OUString const& sModule_)
- : aName( makeName(sName_, Name::NoValidate()) )
- , aModule( makeName(sModule_, Name::NoValidate()) )
- {}
//-----------------------------------------------------------------
/// compose the path where the template is located
- OUString makePathString() const
+ rtl::OUString makePathString() const
{
rtl::OUStringBuffer aBuffer;
- if (!aModule.isEmpty())
- aBuffer.append( this->aModule.toString() ).append(sal_Unicode('/'));
+ if (aModule.getLength() != 0)
+ aBuffer.append( this->aModule ).append(sal_Unicode('/'));
- aBuffer.append( this->aName.toString() );
+ aBuffer.append( this->aName );
return aBuffer.makeStringAndClear();
}
//-----------------------------------------------------------------
bool isEmpty() const
{
- return aName.isEmpty();
+ return aName.getLength() == 0;
}
bool isSimpleTypeName() const;
- UnoType resolveToSimpleType() const;
+ com::sun::star::uno::Type resolveToSimpleType() const;
//-----------------------------------------------------------------
bool operator<(TemplateName const& aOther) const
@@ -119,12 +110,12 @@ namespace configmgr
}
//-----------------------------------------------------------------
- static UnoType resolveSimpleTypeName(Name const& aName);
+ static com::sun::star::uno::Type resolveSimpleTypeName(rtl::OUString const& aName);
//-----------------------------------------------------------------
#if OSL_DEBUG_LEVEL > 0
- static Name makeNativeTypeModuleName();
+ static rtl::OUString makeNativeTypeModuleName();
//-----------------------------------------------------------------
- static Name makeLocalizedTypeModuleName();
+ static rtl::OUString makeLocalizedTypeModuleName();
#endif
//-----------------------------------------------------------------
};
@@ -139,41 +130,39 @@ namespace configmgr
public:
//-----------------------------------------------------------------
- static UnoType getNoTypeAvailable()
+ static com::sun::star::uno::Type getNoTypeAvailable()
{
return getVoidCppuType();
}
//-----------------------------------------------------------------
- static void assignActualType (Template& aTemplate,UnoType const& aType);
+ static void assignActualType (Template& aTemplate,com::sun::star::uno::Type const& aType);
//-----------------------------------------------------------------
- static TemplateHolder makeElementTemplateWithType(TemplateName const& aNames, TemplateProvider const& _aProvider, data::SetNodeAccess const& _aSet);
+ static rtl::Reference<Template> makeElementTemplateWithType(TemplateName const& aNames, TemplateProvider const& _aProvider, sharable::SetNode * set);
//-----------------------------------------------------------------
- static TemplateHolder createNew (TemplateName const& aNames,UnoType const& aType);
+ static rtl::Reference<Template> createNew (TemplateName const& aNames,com::sun::star::uno::Type const& aType);
//-----------------------------------------------------------------
};
//-------------------------------------------------------------------------
- typedef std::map<TemplateName, TemplateHolder> TemplateRepository;
+ typedef std::map< TemplateName, rtl::Reference<Template> > TemplateRepository;
//-------------------------------------------------------------------------
//---------------------------------------------------------------------
// class TemplateProvider_Impl
//---------------------------------------------------------------------
- struct TemplateProvider_Impl : configmgr::SimpleReferenceObject
+ struct TemplateProvider_Impl : salhelper::SimpleReferenceObject
{
- typedef TemplateProvider::TemplateManagerRef TemplateManagerRef;
-
- TemplateProvider_Impl(TemplateManagerRef const & xProvider, RequestOptions const& aOptions);
+ TemplateProvider_Impl(rtl::Reference< TreeManager > const & xProvider, RequestOptions const& aOptions);
- data::TreeSegment instantiate(TemplateHolder const& aTemplate);
+ rtl::Reference< data::TreeSegment > instantiate(rtl::Reference<Template> const& aTemplate);
- TemplateHolder makeElementTemplateWithType(TemplateName const& _aNames, data::SetNodeAccess const& _aSet);
+ rtl::Reference<Template> makeElementTemplateWithType(TemplateName const& _aNames, sharable::SetNode * set);
private:
- TemplateManagerRef m_xProvider;
+ rtl::Reference< TreeManager > m_xProvider;
RequestOptions m_aOptions;
TemplateRepository m_aRepository;
diff --git a/configmgr/source/treemgr/treeimpl.cxx b/configmgr/source/treemgr/treeimpl.cxx
index 296350ac93..3520e525ee 100644
--- a/configmgr/source/treemgr/treeimpl.cxx
+++ b/configmgr/source/treemgr/treeimpl.cxx
@@ -31,15 +31,19 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_configmgr.hxx"
#include <stdio.h>
-#include "treeimpl.hxx"
+#include "anynoderef.hxx"
+#include "builddata.hxx"
+#include "configset.hxx"
+#include "tracer.hxx"
+#include "tree.hxx"
#include "roottreeimpl.hxx"
#include "nodeimpl.hxx"
+#include "nodechange.hxx"
#include "nodechangeimpl.hxx"
+#include "noderef.hxx"
#include "template.hxx"
#include "nodevisitor.hxx"
-#include "valuenodeaccess.hxx"
-#include "groupnodeaccess.hxx"
-#include "setnodeaccess.hxx"
+#include "valueref.hxx"
#include "valuenode.hxx"
#include "change.hxx"
#include "valuenodeimpl.hxx"
@@ -55,12 +59,11 @@ namespace configmgr
//-----------------------------------------------------------------------------
namespace configuration
{
- using view::NodeFactory;
//-----------------------------------------------------------------------------
-// class TreeImplBuilder - friend of TreeImpl
+// class TreeImplBuilder - friend of Tree
//-----------------------------------------------------------------------------
-/** is a visitor-style algorithm to construct a <type>TreeImpl::NodeList</type>
+/** is a visitor-style algorithm to construct a <type>Tree::NodeList</type>
representing a configuration hierarchy
*/
class TreeImplBuilder : public data::NodeVisitor
@@ -72,7 +75,7 @@ public:
TreeImplBuilder(
TemplateProvider const& aTemplateProvider,
rtl::Reference<view::ViewStrategy> const& _xStrategy,
- TreeImpl& rTree
+ Tree& rTree
)
: m_xStrategy(_xStrategy)
, m_aTemplateProvider(aTemplateProvider)
@@ -85,103 +88,100 @@ public:
OSL_DEBUG_ONLY(m_bMemberCheck = false);
m_rTree.m_xStrategy = _xStrategy;
}
-protected:
- using NodeVisitor::handle;
private:
- /// implements the NodeVisitor handler for Value Nodes
- virtual Result handle(data::ValueNodeAccess const& _aValue);
- /// implements the NodeVisitor member for Group Nodes
- virtual Result handle(data::GroupNodeAccess const& _aGroup);
- /// implements the NodeVisitor member for Set Nodes
- virtual Result handle(data::SetNodeAccess const& _aSet);
+ using NodeVisitor::handle;
+
+ virtual bool handle(sharable::ValueNode * node);
+
+ virtual bool handle(sharable::GroupNode * node);
+
+ virtual bool handle(sharable::SetNode * node);
/// add a Node for group node <var>_aGroup</var> to the list
- void addGroup(data::GroupNodeAccess const& _aGroup);
+ void addGroup(sharable::GroupNode * group);
/// add a Node for set node <var>_aSet</var> to the list
- void addSet(data::SetNodeAccess const& _aSet);
+ void addSet(sharable::SetNode * set);
/// add a Node for value node <var>rValue</var> to the list
- void addValueElement(data::ValueNodeAccess const& _aValue);
+ void addValueElement(sharable::ValueNode * value);
/// add a Member for value node <var>rValue</var> to the list
- void addValueMember(data::ValueNodeAccess const& _aValue);
+ void addValueMember(sharable::ValueNode * value);
rtl::Reference<view::ViewStrategy> m_xStrategy;
TemplateProvider m_aTemplateProvider;
- NodeFactory& m_rFactory;
- TreeImpl& m_rTree;
- NodeOffset m_nParent;
- TreeDepth m_nDepthLeft;
+ view::NodeFactory& m_rFactory;
+ Tree& m_rTree;
+ unsigned int m_nParent;
+ unsigned int m_nDepthLeft;
#if OSL_DEBUG_LEVEL > 0
bool m_bMemberCheck;
#endif
};
//-----------------------------------------------------------------------------
-typedef TreeImplBuilder::Result VisitorStatus;
-//-----------------------------------------------------------------------------
-VisitorStatus TreeImplBuilder::handle(data::ValueNodeAccess const& _aValue)
+bool TreeImplBuilder::handle(sharable::ValueNode * node)
{
if (m_nParent == 0)
- addValueElement(_aValue); // if it is the root it is a value set element
+ addValueElement(node); // if it is the root it is a value set element
else
- addValueMember(_aValue); // if it is not the root it is a group member
+ addValueMember(node); // if it is not the root it is a group member
- return CONTINUE;
+ return false;
}
//-----------------------------------------------------------------------------
-VisitorStatus TreeImplBuilder::handle(data::GroupNodeAccess const& _aGroup)
+bool TreeImplBuilder::handle(sharable::GroupNode * node)
{
- addGroup(_aGroup);
- return CONTINUE;
+ addGroup(node);
+ return false;
}
//-----------------------------------------------------------------------------
-VisitorStatus TreeImplBuilder::handle(data::SetNodeAccess const& _aSet)
+bool TreeImplBuilder::handle(sharable::SetNode * node)
{
- addSet(_aSet);
- return CONTINUE;
+ addSet(node);
+ return false;
}
//-----------------------------------------------------------------------------
-void TreeImplBuilder::addValueElement(data::ValueNodeAccess const& _aValue)
+void TreeImplBuilder::addValueElement(sharable::ValueNode * value)
{
- rtl::Reference<NodeImpl> aValueNode( m_rFactory.makeValueNode(_aValue) );
+ rtl::Reference<NodeImpl> aValueNode( m_rFactory.makeValueNode(value) );
OSL_ENSURE( aValueNode.is(), "could not make value node wrapper" );
OSL_ENSURE( m_nParent == 0, "Adding value element that is not root of its fragment" );
// TODO:!isValid() => maybe substitute a SimpleValueNodeImpl if possible
if( aValueNode.is() )
{
- m_rTree.m_aNodes.push_back( NodeData(aValueNode,_aValue.getName(),m_nParent) );
+ m_rTree.m_aNodes.push_back( NodeData(aValueNode, value->info.getName(), m_nParent) );
}
}
//-----------------------------------------------------------------------------
-void TreeImplBuilder::addValueMember(data::ValueNodeAccess const& )
+void TreeImplBuilder::addValueMember(sharable::ValueNode *)
{
// nothing to do
OSL_DEBUG_ONLY(m_bMemberCheck = true);
}
//-----------------------------------------------------------------------------
-void TreeImplBuilder::addGroup(data::GroupNodeAccess const& _aTree)
+void TreeImplBuilder::addGroup(sharable::GroupNode * group)
{
- rtl::Reference<NodeImpl> aGroupNode( m_rFactory.makeGroupNode(_aTree) );
+ rtl::Reference<NodeImpl> aGroupNode( m_rFactory.makeGroupNode(group) );
OSL_ENSURE( aGroupNode.is(), "could not make group node wrapper" );
// TODO:!isValid() => maybe substitute a SimpleValueNodeImpl if possible
if( aGroupNode.is() )
{
- m_rTree.m_aNodes.push_back( NodeData(aGroupNode,_aTree.getName(),m_nParent) );
+ m_rTree.m_aNodes.push_back( NodeData(aGroupNode,group->info.getName(),m_nParent) );
// now fill in group members
if (m_nDepthLeft > 0)
{
- NodeOffset nSaveParent = m_nParent;
+ unsigned int nSaveParent = m_nParent;
decDepth(m_nDepthLeft);
- m_nParent = m_rTree.m_aNodes.size() + m_rTree.root_() - 1;
+ m_nParent = m_rTree.m_aNodes.size() + Tree::ROOT - 1;
#if OSL_DEBUG_LEVEL > 0
bool bSaveMemberCheck = m_bMemberCheck;
@@ -189,7 +189,7 @@ void TreeImplBuilder::addGroup(data::GroupNodeAccess const& _aTree)
#endif
// now recurse:
- this->visitChildren(_aTree);
+ this->visitChildren(group);
OSL_ENSURE(m_nParent < m_rTree.m_aNodes.size() || m_bMemberCheck,
"WARNING: Configuration: Group within requested depth has no members");
@@ -203,33 +203,108 @@ void TreeImplBuilder::addGroup(data::GroupNodeAccess const& _aTree)
}
//-----------------------------------------------------------------------------
-void TreeImplBuilder::addSet(data::SetNodeAccess const& _aSet)
+void TreeImplBuilder::addSet(sharable::SetNode * set)
{
- TemplateHolder aTemplate = makeSetElementTemplate(_aSet, m_aTemplateProvider);
+ rtl::Reference<Template> aTemplate = makeSetElementTemplate(set, m_aTemplateProvider);
OSL_ASSERT(aTemplate.is());
OSL_ENSURE(aTemplate->isInstanceTypeKnown(),"ERROR: Cannor create set instance without knowing the instance type");
- rtl::Reference<NodeImpl> aSetNode( m_rFactory.makeSetNode(_aSet,aTemplate.get()) );
+ rtl::Reference<NodeImpl> aSetNode( m_rFactory.makeSetNode(set, aTemplate.get()) );
OSL_ENSURE( aSetNode.is(), "could not make set node wrapper" );
// TODO:!isValid() => maybe substitute a SimpleValueNodeImpl if possible
if( aSetNode.is() )
{
- m_rTree.m_aNodes.push_back( NodeData(aSetNode,_aSet.getName(),m_nParent) );
+ m_rTree.m_aNodes.push_back( NodeData(aSetNode, set->info.getName(), m_nParent) );
// this also relies on one based offsets
- NodeOffset nNodeAdded = m_rTree.m_aNodes.size() + m_rTree.root_() - 1;
+ unsigned int nNodeAdded = m_rTree.m_aNodes.size() + Tree::ROOT - 1;
OSL_ASSERT(&m_rTree.m_aNodes.back().nodeImpl() == aSetNode.get());
static_cast<SetNodeImpl&>(*aSetNode).initElements(m_aTemplateProvider, m_rTree, nNodeAdded, m_nDepthLeft);
}
}
+namespace {
+ class FindNonDefaultElement: public SetNodeVisitor {
+ public:
+ static bool hasNonDefaultElement(
+ view::ViewTreeAccess const & view, view::SetNode const & set)
+ {
+ FindNonDefaultElement visitor;
+ return view.dispatchToElements(set, visitor) == DONE;
+ }
+
+ protected:
+ virtual Result visit(SetEntry const & entry) {
+ OSL_ASSERT(entry.isValid());
+ rtl::Reference< Tree > tree(entry.tree());
+ OSL_ASSERT(tree.is());
+ node::Attributes atts(tree->getAttributes(tree->getRootNode()));
+ // A set element is considered default iff it is not replaced/added:
+ bool dflt = !atts.isReplacedForUser();
+ return dflt ? CONTINUE : DONE;
+ }
+ };
+
+ class SetVisitorAdapter: public SetNodeVisitor {
+ public:
+ explicit SetVisitorAdapter(NodeVisitor & visitor): m_visitor(visitor) {}
+
+ protected:
+ virtual Result visit(SetEntry const & entry) {
+ OSL_ASSERT(entry.isValid());
+ rtl::Reference< Tree > tree(entry.tree());
+ if (tree.is()) {
+ OSL_ASSERT(
+ Result(NodeVisitor::DONE) == SetNodeVisitor::DONE &&
+ Result(NodeVisitor::CONTINUE) == SetNodeVisitor::CONTINUE);
+ return Result(tree->visit(tree->getRootNode(), m_visitor));
+ } else {
+ return CONTINUE;
+ }
+ }
+
+ private:
+ NodeVisitor & m_visitor;
+ };
+
+ class GroupVisitorAdapter: public GroupMemberVisitor {
+ public:
+ GroupVisitorAdapter(
+ rtl::Reference< Tree > const & parentTree,
+ NodeRef const & parentNode, NodeVisitor & visitor):
+ m_parentTree(parentTree), m_parentPos(parentNode.getOffset()),
+ m_visitor(visitor)
+ {
+ OSL_ASSERT(
+ !isEmpty(parentTree.get()) && parentNode.isValid() &&
+ parentTree->isValidNode(parentNode.getOffset()));
+ }
+
+ protected:
+ virtual Result visit(ValueMemberNode const & value) {
+ OSL_ASSERT(
+ value.isValid() &&
+ Result(NodeVisitor::DONE) == GroupMemberVisitor::DONE &&
+ Result(NodeVisitor::CONTINUE) == GroupMemberVisitor::CONTINUE);
+ return Result(
+ m_parentTree->visit(
+ ValueRef(value.getNodeName(), m_parentPos), m_visitor));
+ }
+
+ private:
+ rtl::Reference< Tree > m_parentTree;
+ unsigned int m_parentPos;
+ NodeVisitor & m_visitor;
+ };
+}
+
//-----------------------------------------------------------------------------
// class NodeData
//-----------------------------------------------------------------------------
-NodeData::NodeData(rtl::Reference<NodeImpl> const& aSpecificNode, Name const& aName, NodeOffset nParent)
+NodeData::NodeData(rtl::Reference<NodeImpl> const& aSpecificNode, rtl::OUString const& aName, unsigned int nParent)
: m_pSpecificNode(aSpecificNode)
, m_aName_(aName)
, m_nParent(nParent)
@@ -238,28 +313,24 @@ NodeData::NodeData(rtl::Reference<NodeImpl> const& aSpecificNode, Name const& aN
//-----------------------------------------------------------------------------
-void NodeData::rebuild(rtl::Reference<view::ViewStrategy> const & _xNewStrategy, data::NodeAccess const & _aNewData)
+void NodeData::rebuild(rtl::Reference<view::ViewStrategy> const & _xNewStrategy, sharable::Node * newData)
{
- using namespace data;
-
rtl::Reference<NodeImpl> aNewImpl;
if (this->isSetNode())
{
- SetNodeAccess aNewSet(_aNewData);
- aNewImpl = _xNewStrategy->getNodeFactory().makeSetNode(aNewSet,NULL);
+ sharable::SetNode * newSet = newData == 0 ? 0 : newData->setData();
+ aNewImpl = _xNewStrategy->getNodeFactory().makeSetNode(newSet, 0);
SetNodeImpl & rOldSetData = this->setImpl();
SetNodeImpl & rNewSetData = static_cast<SetNodeImpl &>(*aNewImpl);
- SetNodeAccess aOldSet = rOldSetData.getDataAccess();
-
- rNewSetData.rebuildFrom(rOldSetData,aNewSet);
+ rNewSetData.rebuildFrom(rOldSetData, newSet);
}
else if (this->isGroupNode())
- aNewImpl = _xNewStrategy->getNodeFactory().makeGroupNode(GroupNodeAccess(_aNewData));
+ aNewImpl = _xNewStrategy->getNodeFactory().makeGroupNode(newData == 0 ? 0 : newData->groupData());
else if (this->isValueElementNode())
- aNewImpl = _xNewStrategy->getNodeFactory().makeValueNode(ValueNodeAccess(_aNewData));
+ aNewImpl = _xNewStrategy->getNodeFactory().makeValueNode(newData == 0 ? 0 : newData->valueData());
m_pSpecificNode = aNewImpl;
}
@@ -268,19 +339,22 @@ void NodeData::rebuild(rtl::Reference<view::ViewStrategy> const & _xNewStrategy,
bool NodeData::isSetNode() const
{
- return data::SetNodeAccess::isInstance(getOriginalNodeAccess());
+ sharable::Node * node = getOriginalNodeAccess();
+ return node != 0 && node->isSet();
}
//-----------------------------------------------------------------------------
bool NodeData::isValueElementNode() const
{
- return data::ValueNodeAccess::isInstance(getOriginalNodeAccess());
+ sharable::Node * node = getOriginalNodeAccess();
+ return node != 0 && node->isValue();
}
//-----------------------------------------------------------------------------
bool NodeData::isGroupNode() const
{
- return data::GroupNodeAccess::isInstance(getOriginalNodeAccess());
+ sharable::Node * node = getOriginalNodeAccess();
+ return node != 0 && node->isGroup();
}
//-----------------------------------------------------------------------------
@@ -318,88 +392,522 @@ ValueElementNodeImpl& NodeData::implGetValueImpl() const
return static_cast<ValueElementNodeImpl&>(*m_pSpecificNode);
}
+
+sharable::Node * NodeData::getOriginalNodeAccess() const
+{
+ return m_pSpecificNode->getOriginalNodeAccess();
+}
+
+NodeImpl & NodeData::implGetNodeImpl() const
+{
+ OSL_ASSERT(m_pSpecificNode != 0);
+ return *m_pSpecificNode;
+}
+
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
-// class TreeImpl
+// class Tree
//-----------------------------------------------------------------------------
-/// creates a TreeImpl for a detached, virgin instance of <var>aTemplate</var>
-TreeImpl::TreeImpl( )
+/// creates a Tree for a detached, virgin instance of <var>aTemplate</var>
+Tree::Tree( )
: m_aNodes()
, m_pParentTree(0)
, m_nParentNode(0)
, m_nDepth(0)
-//, m_nRoot(nRoot)
{
}
//-----------------------------------------------------------------------------
-TreeImpl::TreeImpl( TreeImpl& rParentTree, NodeOffset nParentNode )
+Tree::Tree( Tree& rParentTree, unsigned int nParentNode )
: m_aNodes()
, m_pParentTree(&rParentTree)
, m_nParentNode(nParentNode)
, m_nDepth(0)
-//, m_nRoot(1)
{
}
//-----------------------------------------------------------------------------
-TreeImpl::~TreeImpl()
+Tree::~Tree()
{
}
//-----------------------------------------------------------------------------
-void TreeImpl::disposeData()
+void Tree::disposeData()
{
m_aNodes.clear();
}
+bool Tree::isRootNode(NodeRef const & node) const {
+ OSL_ASSERT(
+ nodeCount() != 0 && (!node.isValid() || isValidNode(node.getOffset())));
+ return node.isValid() && node.getOffset() == ROOT;
+}
+
+NodeRef Tree::getRootNode() const {
+ OSL_ASSERT(nodeCount() != 0);
+ return NodeRef(ROOT, m_nDepth);
+}
+
+NodeRef Tree::getContextNodeRef() const {
+ OSL_ASSERT(nodeCount() != 0 && (m_pParentTree == 0 || m_nParentNode != 0));
+ return m_pParentTree == 0
+ ? NodeRef() : m_pParentTree->getNode(m_nParentNode);
+}
+
+bool Tree::isValidValueNode(ValueRef const & value) {
+ OSL_ASSERT(nodeCount() != 0);
+ if (!(value.isValid() &&
+ value.checkValidState() &&
+ isValidNode(value.m_nParentPos) &&
+ view::ViewTreeAccess(this).isGroupNodeAt(value.m_nParentPos) &&
+ getMemberNode(value).isValid()))
+ {
+ return false;
+ }
+ OSL_ASSERT(value.m_sNodeName.getLength() != 0); // old value handling?
+ return true;
+}
+
+bool Tree::isValidAnyNode(AnyNodeRef const & node) {
+ OSL_ASSERT(nodeCount() != 0);
+ return node.isValid() && isValidNode(node.m_nUsedPos) &&
+ (node.isNode() ||
+ (view::ViewTreeAccess(this).isGroupNodeAt(node.m_nUsedPos) &&
+ getMemberNode(node.toValue()).isValid()));
+}
+
+bool Tree::hasElements(NodeRef const & node) {
+ OSL_ASSERT(
+ nodeCount() != 0 && node.isValid() && isValidNode(node.getOffset()));
+ if (node.getDepth() == 0) {
+ CFG_TRACE_WARNING(
+ "configuration: Querying node beyond available depth" );
+ }
+ view::ViewTreeAccess v(this);
+ return v.isSetNode(node) && !v.isEmpty(v.toSetNode(node));
+}
+
+bool Tree::hasElement(NodeRef const & node, rtl::OUString const & name) {
+ OSL_ASSERT(
+ nodeCount() != 0 && node.isValid() && isValidNode(node.getOffset()));
+ if (node.getDepth() == 0) {
+ CFG_TRACE_WARNING(
+ "configuration: Querying node beyond available depth");
+ }
+ view::ViewTreeAccess v(this);
+ return v.isSetNode(node) &&
+ v.findElement(v.toSetNode(node), name).isValid();
+}
+
+bool Tree::hasElement(NodeRef const & node, Path::Component const & name) {
+ OSL_ASSERT(
+ nodeCount() != 0 && node.isValid() && isValidNode(node.getOffset()));
+ if (node.getDepth() == 0) {
+ CFG_TRACE_WARNING(
+ "configuration: Querying node beyond available depth");
+ }
+ view::ViewTreeAccess v(this);
+ if (v.isSetNode(node)) {
+ SetEntry e(v.findElement(v.toSetNode(node), name.getName()));
+ // Check if types match:
+ return e.isValid() &&
+ Path::matches(e.tree()->getExtendedRootName(), name);
+ } else {
+ return false;
+ }
+}
+
+rtl::Reference< ElementTree > Tree::getElement(NodeRef const & node, rtl::OUString const & name) {
+ OSL_ASSERT(
+ nodeCount() != 0 && node.isValid() && isValidNode(node.getOffset()));
+ if (node.getDepth() == 0) {
+ CFG_TRACE_WARNING(
+ "configuration: Querying node beyond available depth");
+ }
+ view::ViewTreeAccess v(this);
+ if (v.isSetNode(node)) {
+ SetEntry e(v.findElement(v.toSetNode(node), name));
+ return rtl::Reference< ElementTree >(e.tree());
+ } else {
+ return rtl::Reference< ElementTree >();
+ }
+}
+
+rtl::Reference< ElementTree > Tree::getAvailableElement(
+ NodeRef const & node, rtl::OUString const & name)
+{
+ OSL_ASSERT(
+ nodeCount() != 0 && node.isValid() && isValidNode(node.getOffset()));
+ view::ViewTreeAccess v(this);
+ if (v.isSetNode(node)) {
+ SetEntry e(v.findAvailableElement(v.toSetNode(node), name));
+ return rtl::Reference< ElementTree >(e.tree());
+ } else {
+ return rtl::Reference< ElementTree >();
+ }
+}
+
+bool Tree::hasChildren(NodeRef const & node) {
+ OSL_ASSERT(
+ nodeCount() != 0 && node.isValid() && isValidNode(node.getOffset()));
+ if (node.getDepth() == 0) {
+ CFG_TRACE_WARNING(
+ "configuration: Querying node beyond available depth");
+ }
+ view::ViewTreeAccess v(this);
+ if (v.isGroupNode(node)) {
+ view::GroupNode g(v.toGroupNode(node));
+ return v.hasValue(g) || g.getFirstChild().is();
+ } else {
+ return false;
+ }
+}
+
+bool Tree::hasChildValue(NodeRef const & node, rtl::OUString const & name) {
+ OSL_ASSERT(
+ nodeCount() != 0 && node.isValid() && isValidNode(node.getOffset()));
+ if (node.getDepth() == 0) {
+ CFG_TRACE_WARNING(
+ "configuration: Querying node beyond available depth");
+ }
+ view::ViewTreeAccess v(this);
+ return v.isGroupNode(node) && v.hasValue(v.toGroupNode(node), name);
+}
+
+bool Tree::hasChildNode(NodeRef const & node, rtl::OUString const & name) {
+ OSL_ASSERT(
+ nodeCount() != 0 && node.isValid() && isValidNode(node.getOffset()));
+ if (node.getDepth() == 0) {
+ CFG_TRACE_WARNING(
+ "configuration: Querying node beyond available depth");
+ }
+ view::ViewTreeAccess v(this);
+ return v.isGroupNode(node) && v.toGroupNode(node).findChild(name).is();
+}
+
+bool Tree::hasChild(NodeRef const & node, rtl::OUString const & name) {
+ OSL_ASSERT(
+ nodeCount() != 0 && node.isValid() && isValidNode(node.getOffset()));
+ if (node.getDepth() == 0) {
+ CFG_TRACE_WARNING(
+ "configuration: Querying node beyond available depth");
+ }
+ view::ViewTreeAccess v(this);
+ if (v.isGroupNode(node)) {
+ view::GroupNode g(v.toGroupNode(node));
+ return v.hasValue(g, name) || g.findChild(name).is();
+ } else {
+ return false;
+ }
+}
+
+ValueRef Tree::getChildValue(NodeRef const & node, rtl::OUString const & name) {
+ OSL_ASSERT(
+ nodeCount() != 0 && node.isValid() && isValidNode(node.getOffset()));
+ if (node.getDepth() == 0) {
+ CFG_TRACE_WARNING(
+ "configuration: Querying node beyond available depth");
+ }
+ view::ViewTreeAccess v(this);
+ return v.isGroupNode(node) && v.hasValue(v.toGroupNode(node), name)
+ ? ValueRef(name, node.getOffset()) : ValueRef();
+}
+
+NodeRef Tree::getChildNode(NodeRef const & node, rtl::OUString const & name)
+{
+ OSL_ASSERT(
+ nodeCount() != 0 && node.isValid() && isValidNode(node.getOffset()));
+ if (node.getDepth() == 0) {
+ CFG_TRACE_WARNING(
+ "configuration: Querying node beyond available depth");
+ }
+ view::ViewTreeAccess v(this);
+ return NodeRef(
+ (v.isGroupNode(node)
+ ? v.toGroupNode(node).findChild(name).get_offset() : 0),
+ childDepth(node.getDepth()));
+}
+
+AnyNodeRef Tree::getAnyChild(NodeRef const & node, rtl::OUString const & name) {
+ OSL_ASSERT(
+ nodeCount() != 0 && node.isValid() && isValidNode(node.getOffset()));
+ if (node.getDepth() == 0) {
+ CFG_TRACE_WARNING(
+ "configuration: Querying node beyond available depth");
+ }
+ view::ViewTreeAccess v(this);
+ unsigned int n = 0;
+ if (v.isGroupNode(node)) {
+ if (v.hasValue(v.toGroupNode(node), name)) {
+ return AnyNodeRef(name, node.getOffset());
+ }
+ n = v.toGroupNode(node).findChild(name).get_offset();
+ }
+ return AnyNodeRef(n, childDepth(node.getDepth()));
+}
+
+node::Attributes Tree::getAttributes(NodeRef const & node) {
+ OSL_ASSERT(
+ nodeCount() != 0 && node.isValid() && isValidNode(node.getOffset()));
+ return view::ViewTreeAccess(this).getAttributes(node);
+}
+
+node::Attributes Tree::getAttributes(AnyNodeRef const & node) {
+ OSL_ASSERT(nodeCount() != 0 && isValidAnyNode(node));
+ if (node.isNode()) {
+ return view::ViewTreeAccess(this).getAttributes(node.toNode());
+ } else {
+ return getMemberNode(node.toValue()).getAttributes();
+ }
+}
+
+node::Attributes Tree::getAttributes(ValueRef const & value) {
+ OSL_ASSERT(nodeCount() != 0 && isValidValueNode(value));
+ return getMemberNode(value).getAttributes();
+}
+
+com::sun::star::uno::Type Tree::getUnoType(ValueRef const & value) {
+ OSL_ASSERT(nodeCount() != 0 && isValidValueNode(value));
+ return getMemberNode(value).getValueType();
+}
+
+NodeRef Tree::getParent(NodeRef const & node) {
+ OSL_ASSERT(
+ nodeCount() != 0 && node.isValid() && isValidNode(node.getOffset()));
+ view::ViewTreeAccess v(this);
+ OSL_ASSERT(!v.makeNode(getRootNode()).getParent().is());
+ view::Node p(v.makeNode(node).getParent());
+ OSL_ASSERT(isValidNode(p.get_offset()));
+ return NodeRef(p.get_offset(), parentDepth(node.getDepth()));
+}
+
+NodeRef Tree::getParent(ValueRef const & value) {
+ OSL_ASSERT(nodeCount() != 0 && isValidValueNode(value));
+ unsigned int n = value.m_nParentPos;
+ OSL_ASSERT(n == 0 || value.m_sNodeName.getLength() != 0);
+ return getNode(n);
+}
+
+AbsolutePath Tree::getAbsolutePath(NodeRef const & node) {
+ OSL_ASSERT(
+ nodeCount() != 0 && node.isValid() && isValidNode(node.getOffset()));
+ Path::Rep r;
+ prependLocalPathTo(node.getOffset(), r);
+ r.prepend(getRootPath().rep());
+ return AbsolutePath(r);
+}
+
+com::sun::star::uno::Any Tree::getNodeValue(ValueRef const & value) {
+ OSL_ASSERT(isValidValueNode(value));
+ return getMemberNode(value).getValue();
+}
+
+bool Tree::hasNodeDefault(ValueRef const & value) {
+ OSL_ASSERT(nodeCount() != 0 && isValidValueNode(value));
+ return getMemberNode(value).canGetDefaultValue();
+}
+
+bool Tree::isNodeDefault(ValueRef const & value) {
+ OSL_ASSERT(nodeCount() != 0 && isValidValueNode(value));
+ return hasNodeDefault(value) && getMemberNode(value).isDefault();
+}
+
+bool Tree::hasNodeDefault(NodeRef const & node) {
+ OSL_ASSERT(
+ nodeCount() != 0 && node.isValid() && isValidNode(node.getOffset()));
+ // Not a set, then it has no default:
+ return view::ViewTreeAccess(this).isSetNode(node);
+}
+
+bool Tree::isNodeDefault(NodeRef const & node) {
+ OSL_ASSERT(
+ nodeCount() != 0 && node.isValid() && isValidNode(node.getOffset()));
+ if (!hasNodeDefault(node)) {
+ return false;
+ }
+ view::ViewTreeAccess v(this);
+ OSL_ASSERT(v.isSetNode(node)); // not a set, then it has no default
+ // A set is default if all its elements are default:
+ return !FindNonDefaultElement::hasNonDefaultElement(v, v.toSetNode(node));
+}
+
+bool Tree::hasNodeDefault(AnyNodeRef const & node) {
+ OSL_ASSERT(nodeCount() != 0 && isValidAnyNode(node));
+ return node.isNode()
+ ? hasNodeDefault(node.toNode()) : hasNodeDefault(node.toValue());
+}
+
+bool Tree::isNodeDefault(AnyNodeRef const & node) {
+ OSL_ASSERT(nodeCount() != 0 && isValidAnyNode(node));
+ return node.isNode()
+ ? isNodeDefault(node.toNode()) : isNodeDefault(node.toValue());
+}
+
+bool Tree::areValueDefaultsAvailable(NodeRef const & node) {
+ OSL_ASSERT(
+ nodeCount() != 0 && node.isValid() && isValidNode(node.getOffset()));
+ view::ViewTreeAccess v(this);
+ OSL_ASSERT(v.isGroupNode(node));
+ return v.isGroupNode(node) &&
+ v.areValueDefaultsAvailable(v.toGroupNode(node));
+}
+
+com::sun::star::uno::Any Tree::getNodeDefaultValue(ValueRef const & value) {
+ OSL_ASSERT(nodeCount() != 0 && isValidValueNode(value));
+ ValueMemberNode m(getMemberNode(value));
+ return m.canGetDefaultValue() ?
+ m.getDefaultValue() : com::sun::star::uno::Any();
+}
+
+bool Tree::hasChanges() {
+ return view::ViewTreeAccess(this).hasChanges();
+}
+
+bool Tree::collectChanges(NodeChanges & changes) {
+ OSL_ASSERT(nodeCount() != 0);
+ view::ViewTreeAccess v(this);
+ if (v.hasChanges()) {
+ v.collectChanges(changes);
+ return true;
+ } else {
+ return false;
+ }
+}
+
+void Tree::integrate(NodeChange & change, NodeRef const & node, bool local)
+{
+ OSL_ASSERT(
+ nodeCount() != 0 && node.isValid() && isValidNode(node.getOffset()));
+ if (change.test().isChange()) {
+ change.apply();
+ if (local) {
+ view::ViewTreeAccess(this).markChanged(node);
+ } else {
+ rtl::Reference< Tree > at(change.getAffectedTree());
+ NodeRef an(change.getAffectedNode());
+ OSL_ASSERT(
+ !isEmpty(at.get()) && an.isValid() &&
+ at->isValidNode(an.getOffset()));
+ view::ViewTreeAccess(at.get()).markChanged(an);
+ OSL_ASSERT(view::ViewTreeAccess(this).hasChanges());
+ }
+ }
+}
+
+void Tree::integrate(NodeChanges& changes, NodeRef const & node, bool local)
+{
+ for (std::vector< NodeChange >::iterator it(changes.begin());
+ it != changes.end(); ++it)
+ {
+ integrate(*it, node, local);
+ }
+}
+
+NodeVisitor::Result Tree::dispatchToChildren(
+ NodeRef const & node, NodeVisitor & visitor)
+{
+ OSL_ASSERT(
+ nodeCount() != 0 && node.isValid() && isValidNode(node.getOffset()));
+ if (node.getDepth() == 0) {
+ CFG_TRACE_WARNING(
+ "configuration: Querying node beyond available depth");
+ }
+ view::ViewTreeAccess v(this);
+ if (v.isGroupNode(node)) {
+ view::GroupNode const p(v.toGroupNode(node));
+ OSL_ASSERT(
+ (NodeVisitor::Result(GroupMemberVisitor::DONE) ==
+ NodeVisitor::DONE) &&
+ (NodeVisitor::Result(GroupMemberVisitor::CONTINUE) ==
+ NodeVisitor::CONTINUE));
+ GroupVisitorAdapter adapter(this, node, visitor);
+ NodeVisitor::Result ret = NodeVisitor::Result(
+ v.dispatchToValues(p, adapter));
+ unsigned int n = childDepth(node.getDepth());
+ for (view::Node c(p.getFirstChild());
+ c.is() && ret != NodeVisitor::DONE; c = p.getNextChild(c))
+ {
+ ret = visit(NodeRef(c.get_offset(), n), visitor);
+ }
+ return ret;
+ } else if (v.isSetNode(node)) {
+ OSL_ASSERT(
+ NodeVisitor::Result(SetNodeVisitor::DONE) == NodeVisitor::DONE &&
+ (NodeVisitor::Result(SetNodeVisitor::CONTINUE) ==
+ NodeVisitor::CONTINUE));
+ SetVisitorAdapter adapter(visitor);
+ return NodeVisitor::Result(
+ v.dispatchToElements(v.toSetNode(node), adapter));
+ } else {
+ OSL_TRACE("configuration: Trying to iterate a value node");
+ return NodeVisitor::CONTINUE;
+ }
+}
+
+NodeRef Tree::getNode(unsigned int offset) const {
+ if (offset == 0) {
+ return NodeRef();
+ } else {
+ OSL_ASSERT(isValidNode(offset));
+ return NodeRef(
+ offset, remainingDepth(getAvailableDepth(), depthTo(offset)));
+ }
+}
+
+rtl::Reference< Template > Tree::extractElementInfo(NodeRef const & node) {
+ OSL_ASSERT(node.isValid() && isValidNode(node.getOffset()));
+ view::ViewTreeAccess v(this);
+ OSL_ASSERT(v.isSetNode(node));
+ return v.getElementTemplate(v.toSetNode(node));
+}
+
//-----------------------------------------------------------------------------
-void TreeImpl::rebuild(rtl::Reference<view::ViewStrategy> const & _xNewStrategy, data::NodeAccess const & _aNewData)
+void Tree::rebuild(rtl::Reference<view::ViewStrategy> const & _xNewStrategy, sharable::Node * newData)
{
m_xStrategy = _xNewStrategy;
- this->implRebuild( this->root_(), _aNewData);
+ this->implRebuild(ROOT, newData);
}
//-----------------------------------------------------------------------------
-void TreeImpl::implRebuild(NodeOffset nNode, data::NodeAccess const & _aNewData)
+void Tree::implRebuild(unsigned int nNode, sharable::Node * newData)
{
NodeData * pNode = nodeData(nNode);
if (pNode->isGroupNode())
{
// first rebuild the children
- data::GroupNodeAccess aNewGroupAccess(_aNewData);
- OSL_ASSERT(aNewGroupAccess.isValid());
+ OSL_ASSERT(newData != 0 && newData->isGroup());
+ sharable::GroupNode * newGroup = &newData->group;
- for (NodeOffset nChild = firstChild_(nNode); isValidNode(nChild); nChild = findNextChild_(nNode,nChild))
+ for (unsigned int nChild = firstChild_(nNode); isValidNode(nChild); nChild = findNextChild_(nNode,nChild))
{
- data::NodeAccess aChildAccess = aNewGroupAccess.getChildNode(implGetOriginalName(nChild));
- OSL_ASSERT(aChildAccess.isValid());
- implRebuild(nChild,aChildAccess);
+ sharable::Node * childAccess = newGroup->getChild(implGetOriginalName(nChild));
+ OSL_ASSERT(childAccess != 0);
+ implRebuild(nChild, childAccess);
}
}
- pNode->rebuild(m_xStrategy,_aNewData);
+ pNode->rebuild(m_xStrategy, newData);
}
//-----------------------------------------------------------------------------
-void ElementTreeImpl::doFinishRootPath(Path::Rep& rPath) const
+void ElementTree::doFinishRootPath(Path::Rep& rPath) const
{
rPath.prepend( doGetRootName() );
rPath.prepend( AbsolutePath::detachedRoot().rep() );
}
//-----------------------------------------------------------------------------
-void RootTreeImpl::doFinishRootPath(Path::Rep& rPath) const
+void RootTree::doFinishRootPath(Path::Rep& rPath) const
{
rPath.prepend( m_aRootPath.rep() );
}
//-----------------------------------------------------------------------------
-void TreeImpl::implPrependRootPath(Path::Rep& rPath) const
+void Tree::implPrependRootPath(Path::Rep& rPath) const
{
if (m_pParentTree)
{
@@ -415,23 +923,23 @@ void TreeImpl::implPrependRootPath(Path::Rep& rPath) const
}
//-----------------------------------------------------------------------------
-AbsolutePath TreeImpl::getRootPath() const
+AbsolutePath Tree::getRootPath() const
{
Path::Rep aPath;
implPrependRootPath(aPath);
return AbsolutePath(aPath);
}
//-----------------------------------------------------------------------------
-void TreeImpl::build(rtl::Reference<view::ViewStrategy> const& _xStrategy, data::NodeAccess const& _aRootNode, TreeDepth nDepth, TemplateProvider const& aTemplateProvider)
+void Tree::build(rtl::Reference<view::ViewStrategy> const& _xStrategy, sharable::Node * rootNode, unsigned int nDepth, TemplateProvider const& aTemplateProvider)
{
OSL_ASSERT(m_aNodes.empty());
m_nDepth = nDepth;
TreeImplBuilder a(aTemplateProvider, _xStrategy,*this);
- a.visitNode(_aRootNode);
+ a.visitNode(rootNode);
}
//-----------------------------------------------------------------------------
-rtl::Reference< view::ViewStrategy > TreeImpl::getViewBehavior() const
+rtl::Reference< view::ViewStrategy > Tree::getViewBehavior() const
{
return m_xStrategy;
}
@@ -439,7 +947,7 @@ rtl::Reference< view::ViewStrategy > TreeImpl::getViewBehavior() const
// context handling
//-----------------------------------------------------------------------------
-void TreeImpl::setContext(TreeImpl* pParentTree, NodeOffset nParentNode)
+void Tree::setContext(Tree* pParentTree, unsigned int nParentNode)
{
OSL_ENSURE(pParentTree,"ERROR: Moving tree to nowhere");
@@ -462,7 +970,7 @@ void TreeImpl::setContext(TreeImpl* pParentTree, NodeOffset nParentNode)
}
//-----------------------------------------------------------------------------
-void TreeImpl::clearContext()
+void Tree::clearContext()
{
m_pParentTree = 0;
m_nParentNode = 0;
@@ -473,14 +981,14 @@ void TreeImpl::clearContext()
// Node Collection navigation
//-----------------------------------------------------------------------------
-NodeOffset TreeImpl::parent_(NodeOffset nNode) const
+unsigned int Tree::parent_(unsigned int nNode) const
{
OSL_ASSERT(isValidNode(nNode));
return nodeData(nNode)->getParent();
}
//-----------------------------------------------------------------------------
inline // is protected and should be used only here
-Name TreeImpl::implGetOriginalName(NodeOffset nNode) const
+rtl::OUString Tree::implGetOriginalName(unsigned int nNode) const
{
OSL_ASSERT(isValidNode(nNode));
@@ -488,55 +996,55 @@ Name TreeImpl::implGetOriginalName(NodeOffset nNode) const
}
//-----------------------------------------------------------------------------
-Path::Component ElementTreeImpl::doGetRootName() const
+Path::Component ElementTree::doGetRootName() const
{
return makeExtendedName( m_aElementName );
}
//-----------------------------------------------------------------------------
-Name ElementTreeImpl::getSimpleRootName() const
+rtl::OUString ElementTree::getSimpleRootName() const
{
- // TreeImpl::getSimpleRootName tends to parse &
+ // Tree::getSimpleRootName tends to parse &
// then split the same name, burning CPU L&R
- return Name( m_aElementName );
+ return m_aElementName;
}
//-----------------------------------------------------------------------------
-Path::Component RootTreeImpl::doGetRootName() const
+Path::Component RootTree::doGetRootName() const
{
return m_aRootPath.getLocalName();
}
//-----------------------------------------------------------------------------
-Name TreeImpl::getSimpleNodeName(NodeOffset nNode) const
+rtl::OUString Tree::getSimpleNodeName(unsigned int nNode) const
{
- if (nNode == root_()) return getSimpleRootName();
+ if (nNode == ROOT) return getSimpleRootName();
return implGetOriginalName(nNode);
}
//-----------------------------------------------------------------------------
-Name TreeImpl::getSimpleRootName() const
+rtl::OUString Tree::getSimpleRootName() const
{
return doGetRootName().getName();
}
//-----------------------------------------------------------------------------
-Path::Component TreeImpl::getExtendedRootName() const
+Path::Component Tree::getExtendedRootName() const
{
return doGetRootName();
}
//-----------------------------------------------------------------------------
-TreeDepth TreeImpl::depthTo(NodeOffset nNode) const
+unsigned int Tree::depthTo(unsigned int nNode) const
{
OSL_ASSERT(isValidNode(nNode));
- TreeDepth nDepth = 0;
+ unsigned int nDepth = 0;
while( 0 != (nNode=parent_(nNode)) )
{
++nDepth;
@@ -546,34 +1054,34 @@ TreeDepth TreeImpl::depthTo(NodeOffset nNode) const
}
//-----------------------------------------------------------------------------
-void TreeImpl::prependLocalPathTo(NodeOffset nNode, Path::Rep& rNames)
+void Tree::prependLocalPathTo(unsigned int nNode, Path::Rep& rNames)
{
OSL_ASSERT(isValidNode(nNode));
- for (; nNode != root_(); nNode = parent_(nNode) )
+ for (; nNode != ROOT; nNode = parent_(nNode) )
{
OSL_ENSURE( isValidNode(nNode), "ERROR: Configuration: node has invalid parent");
rNames.prepend( Path::wrapSimpleName( implGetOriginalName(nNode) ) );
}
- OSL_ASSERT(nNode == root_());
+ OSL_ASSERT(nNode == ROOT);
}
//-----------------------------------------------------------------------------
// Node iteration and access
-NodeOffset TreeImpl::firstChild_ (NodeOffset nParent) const
+unsigned int Tree::firstChild_ (unsigned int nParent) const
{
return findNextChild_(nParent,nParent);
}
//-----------------------------------------------------------------------------
-NodeOffset TreeImpl::findNextChild_(NodeOffset nParent, NodeOffset nStartAfter) const
+unsigned int Tree::findNextChild_(unsigned int nParent, unsigned int nStartAfter) const
{
OSL_ASSERT(isValidNode(nParent));
OSL_ASSERT(nStartAfter == 0 || isValidNode(nStartAfter));
- NodeOffset nPos = nStartAfter ? nStartAfter : root_()-1;
- NodeOffset const nAfterLast = nodeCount() + root_();
+ unsigned int nPos = nStartAfter ? nStartAfter : ROOT - 1;
+ unsigned int const nAfterLast = nodeCount() + ROOT;
while (++nPos < nAfterLast)
{
if(parent_(nPos) == nParent) return nPos;
@@ -582,12 +1090,12 @@ NodeOffset TreeImpl::findNextChild_(NodeOffset nParent, NodeOffset nStartAfter)
}
//-----------------------------------------------------------------------------
-NodeOffset TreeImpl::findChild_(NodeOffset nParent, Name const& aName) const
+unsigned int Tree::findChild_(unsigned int nParent, rtl::OUString const& aName) const
{
OSL_ASSERT(isValidNode(nParent));
- NodeOffset nPos = nParent;
- NodeOffset const nAfterLast = nodeCount() + root_();
+ unsigned int nPos = nParent;
+ unsigned int const nAfterLast = nodeCount() + ROOT;
while (++nPos < nAfterLast)
{
if(parent_(nPos) == nParent && implGetOriginalName(nPos) == aName)
@@ -596,129 +1104,93 @@ NodeOffset TreeImpl::findChild_(NodeOffset nParent, Name const& aName) const
return 0;
}
-//-----------------------------------------------------------------------------
-// dynamic-casting
-//-----------------------------------------------------------------------------
-
-ElementTreeImpl * TreeImpl::asElementTree()
-{
- ElementTreeImpl const* const pResult = doCastToElementTree();
- TreeImpl const* const pTest = pResult;
- if (pTest== this)
- return const_cast<ElementTreeImpl *>(pResult);
- else
- return 0;
-}
-//-----------------------------------------------------------------------------
-
-ElementTreeImpl const* TreeImpl::asElementTree() const
-{
- return doCastToElementTree();
-}
-//-----------------------------------------------------------------------------
-
-RootTreeImpl const* ElementTreeImpl::doCastToRootTree() const
-{
- return 0;
-}
-//-----------------------------------------------------------------------------
-
-ElementTreeImpl const* ElementTreeImpl::doCastToElementTree() const
-{
- return this;
-}
-//-----------------------------------------------------------------------------
-
-RootTreeImpl const* RootTreeImpl::doCastToRootTree() const
-{
- return this;
-}
-//-----------------------------------------------------------------------------
-
-ElementTreeImpl const* RootTreeImpl::doCastToElementTree() const
-{
- return 0;
+ValueMemberNode Tree::getMemberNode(ValueRef const & value) {
+ OSL_ASSERT(nodeCount() != 0);
+ view::ViewTreeAccess v(this);
+ return v.getValue(v.getGroupNodeAt(value.m_nParentPos), value.m_sNodeName);
}
-//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
-// class RootTreeImpl
+// class RootTree
//-----------------------------------------------------------------------------
-RootTreeImpl::RootTreeImpl( rtl::Reference<view::ViewStrategy> const& _xStrategy,
+RootTree::RootTree( rtl::Reference<view::ViewStrategy> const& _xStrategy,
AbsolutePath const& aRootPath,
- data::NodeAccess const& _aCacheNode, TreeDepth nDepth,
+ sharable::Node * cacheNode, unsigned int nDepth,
TemplateProvider const& aTemplateProvider)
-: TreeImpl()
+: Tree()
, m_aRootPath(aRootPath)
{
-// OSL_ENSURE( aRootPath.getLocalName().getName() == _aCacheNode.getName(),
+// OSL_ENSURE( aRootPath.getLocalName().getName() == cacheNode->getName(),
// "Constructing root node: Path does not match node name");
- TreeImpl::build(_xStrategy,_aCacheNode,nDepth,aTemplateProvider);
+ Tree::build(_xStrategy,cacheNode,nDepth,aTemplateProvider);
+}
+
+bool isEmpty(Tree * tree)
+{
+ return tree == 0 || tree->nodeCount() == 0;
}
//-----------------------------------------------------------------------------
-// class ElementTreeImpl
+// class ElementTree
//-----------------------------------------------------------------------------
-ElementTreeImpl::ElementTreeImpl( rtl::Reference<view::ViewStrategy> const& _xStrategy,
- data::TreeAccessor const& _aCacheTree, TreeDepth nDepth,
- TemplateHolder aTemplateInfo,
+ElementTree::ElementTree( rtl::Reference<view::ViewStrategy> const& _xStrategy,
+ sharable::TreeFragment * cacheTree, unsigned int nDepth,
+ rtl::Reference<Template> aTemplateInfo,
TemplateProvider const& aTemplateProvider )
-: TreeImpl()
+: Tree()
, m_aInstanceInfo(aTemplateInfo)
-, m_aElementName(_aCacheTree.getName())
-, m_aDataAddress(_aCacheTree)
+, m_aElementName(cacheTree->getName())
+, m_aDataAddress(cacheTree)
, m_aOwnData()
{
- TreeImpl::build( _xStrategy, _aCacheTree.getRootNode(), nDepth, aTemplateProvider );
+ Tree::build( _xStrategy, cacheTree->getRootNode(), nDepth, aTemplateProvider );
}
//-----------------------------------------------------------------------------
-ElementTreeImpl::ElementTreeImpl( rtl::Reference<view::ViewStrategy> const& _xStrategy,
- TreeImpl& rParentTree, NodeOffset nParentNode,
- data::TreeAccessor const& _aCacheTree, TreeDepth nDepth,
- TemplateHolder aTemplateInfo,
+ElementTree::ElementTree( rtl::Reference<view::ViewStrategy> const& _xStrategy,
+ Tree& rParentTree, unsigned int nParentNode,
+ sharable::TreeFragment * cacheTree, unsigned int nDepth,
+ rtl::Reference<Template> aTemplateInfo,
TemplateProvider const& aTemplateProvider )
-: TreeImpl( rParentTree, nParentNode )
+: Tree( rParentTree, nParentNode )
, m_aInstanceInfo(aTemplateInfo)
-, m_aElementName(_aCacheTree.getName())
-, m_aDataAddress(_aCacheTree)
+, m_aElementName(cacheTree->getName())
+, m_aDataAddress(cacheTree)
, m_aOwnData()
{
- TreeImpl::build( _xStrategy, _aCacheTree.getRootNode(), nDepth, aTemplateProvider );
+ Tree::build( _xStrategy, cacheTree->getRootNode(), nDepth, aTemplateProvider );
}
//-----------------------------------------------------------------------------
-ElementTreeImpl::ElementTreeImpl( data::TreeSegment const& pNewTree,
- TemplateHolder aTemplate,
+ElementTree::ElementTree( rtl::Reference< data::TreeSegment > const& pNewTree,
+ rtl::Reference<Template> aTemplate,
TemplateProvider const& aTemplateProvider )
-: TreeImpl()
+: Tree()
, m_aInstanceInfo(aTemplate)
-, m_aElementName(pNewTree.getName())
-, m_aDataAddress(pNewTree.getBaseAddress())
, m_aOwnData(pNewTree)
{
if (!pNewTree.is())
throw Exception("ERROR: Provider can't create Element Instance From Template");
+ m_aElementName = pNewTree->fragment->getName();
+ m_aDataAddress = pNewTree->fragment;
- data::NodeAccess aNewNodeWrapper( m_aOwnData.getSegmentRootNode() );
-
- TreeImpl::build( view::createDirectAccessStrategy(m_aOwnData), aNewNodeWrapper, c_TreeDepthAll, aTemplateProvider );
+ Tree::build( view::createDirectAccessStrategy(m_aOwnData), m_aOwnData->fragment->nodes, c_TreeDepthAll, aTemplateProvider );
}
//-----------------------------------------------------------------------------
-ElementTreeImpl::~ElementTreeImpl()
+ElementTree::~ElementTree()
{
}
//-----------------------------------------------------------------------------
-bool ElementTreeImpl::isUpdatableSegment(TreeImpl& _rTree)
+bool ElementTree::isUpdatableSegment(Tree& _rTree)
{
- TreeImpl * pTree = &_rTree;
+ Tree * pTree = &_rTree;
- while (ElementTreeImpl * pElement = pTree->asElementTree())
+ while (ElementTree * pElement = dynamic_cast< ElementTree * >(pTree))
{
if (pElement->m_aOwnData.is())
{
@@ -743,16 +1215,16 @@ bool ElementTreeImpl::isUpdatableSegment(TreeImpl& _rTree)
}
//-----------------------------------------------------------------------------
-void ElementTreeImpl::disposeData()
+void ElementTree::disposeData()
{
- TreeImpl::disposeData();
+ Tree::disposeData();
m_aOwnData.clear();
}
//-----------------------------------------------------------------------------
-Path::Component ElementTreeImpl::makeExtendedName(Name const& _aSimpleName) const
+Path::Component ElementTree::makeExtendedName(rtl::OUString const& _aSimpleName) const
{
- Name aTypeName = implGetOriginalName(root_());
+ rtl::OUString aTypeName = implGetOriginalName(ROOT);
OSL_ENSURE(this->isTemplateInstance(), "ElementTree: Cannot discover the type this instantiatiates");
@@ -765,123 +1237,108 @@ Path::Component ElementTreeImpl::makeExtendedName(Name const& _aSimpleName) cons
// ownership handling
//-----------------------------------------------------------------------------
-void ElementTreeImpl::rebuild(rtl::Reference<view::ViewStrategy> const & _aStrategy, data::TreeAccessor const & _aNewTree)
+void ElementTree::rebuild(rtl::Reference<view::ViewStrategy> const & _aStrategy, sharable::TreeFragment * newTree)
{
- TreeImpl::rebuild(_aStrategy,_aNewTree.getRootNode());
- m_aDataAddress = _aNewTree;
- m_aElementName = _aNewTree.getName();
+ Tree::rebuild(_aStrategy, newTree->getRootNode());
+ m_aDataAddress = newTree;
+ m_aElementName = newTree->getName();
}
//-----------------------------------------------------------------------------
/// transfer ownership to the given set
// -----------------------------------------------------------------------------
-void ElementTreeImpl::attachTo(data::SetNodeAccess const & aOwningSet, Name const& aElementName)
+void ElementTree::attachTo(sharable::SetNode * owningSet, rtl::OUString const& aElementName)
{
- OSL_ENSURE(m_aOwnData.is(),"ERROR: Cannot add a non-owned node to a subtree");
+ OSL_ENSURE(m_aOwnData.is(), "ERROR: Cannot add a non-owned node to a subtree");
if (m_aOwnData.is())
{
OSL_ENSURE(this->getSimpleRootName() == aElementName,"ElementTree: Attaching with unexpected element name");
- m_aOwnData.setName(aElementName);
+ m_aOwnData->fragment->setName(aElementName);
- TreeImpl* pOwningTree = this->getContextTree();
+ Tree* pOwningTree = this->getContextTree();
OSL_ENSURE(pOwningTree, "Element Tree Context must be set before attaching data");
if (isUpdatableSegment(*pOwningTree))
{
// copy over to the new segment
- data::TreeAddress aNewElement = m_aOwnData.getTreeAccess().copyTree();
-
- data::SetNodeAccess::addElement(aOwningSet, aNewElement);
+ sharable::TreeFragment * aNewElement = data::buildTree(m_aOwnData->fragment);
- data::TreeAccessor aNewAccessor(aNewElement);
+ owningSet->addElement(aNewElement);
rtl::Reference<view::ViewStrategy> xNewBehavior = pOwningTree->getViewBehavior();
- this->rebuild(xNewBehavior,aNewAccessor);
+ this->rebuild(xNewBehavior,aNewElement);
}
else
OSL_ENSURE( false, "Cannot attach directly to new tree - no update access available");
- m_aOwnData.clearData();
+ m_aOwnData.clear();
OSL_ASSERT(!m_aOwnData.is());
}
}
//-----------------------------------------------------------------------------
/// tranfer ownership from the given set
-void ElementTreeImpl::detachFrom(data::SetNodeAccess const & aOwningSet, Name const& aElementName)
+void ElementTree::detachFrom(sharable::SetNode * owningSet, rtl::OUString const& aElementName)
{
OSL_ENSURE(!m_aOwnData.is(),"ERROR: Cannot detach a already owned node from a subtree");
- if (!m_aOwnData.is())
- {
- OSL_ENSURE(this->getSimpleRootName() == aElementName,"ElementTree: Detaching with unexpected element name");
+ OSL_ENSURE(this->getSimpleRootName() == aElementName,"ElementTree: Detaching with unexpected element name");
- rtl::Reference< view::ViewStrategy > xOldStrategy = this->getViewBehavior();
- OSL_ENSURE(xOldStrategy.is(), "Element Tree Context must still have the old strategy when detaching data");
+ rtl::Reference< view::ViewStrategy > xOldStrategy = this->getViewBehavior();
+ OSL_ENSURE(xOldStrategy.is(), "Element Tree Context must still have the old strategy when detaching data");
- {
- using namespace data;
-
- // make a new segment with a copy of the data
- TreeSegment aNewSegment = TreeSegment::createNew( this->getOriginalTreeAccess() );
+ {
+ // make a new segment with a copy of the data
+ rtl::Reference< data::TreeSegment > aNewSegment = data::TreeSegment::create( this->getOriginalTreeAccess() );
- OSL_ENSURE(aNewSegment.is(),"ERROR: Could not create detached copy of elment data");
+ OSL_ENSURE(aNewSegment.is(),"ERROR: Could not create detached copy of elment data");
- this->takeTreeAndRebuild( aNewSegment );
+ this->takeTreeAndRebuild( aNewSegment );
- TreeAddress aOldElement = data::SetNodeAccess::removeElement(aOwningSet, aElementName );
+ sharable::TreeFragment * aOldElement = owningSet->removeElement(aElementName );
OSL_ENSURE(aOldElement != NULL,"ERROR: Detached node not found in the given subtree");
- TreeAccessor::freeTree(aOldElement);
- }
-
- OSL_ENSURE(m_aOwnData.is(),"ERROR: Could not create own data segment for detached node");
+ data::destroyTree(aOldElement);
}
+
+ OSL_ENSURE(m_aOwnData.is(),"ERROR: Could not create own data segment for detached node");
}
//-----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
/// transfer ownership from the given owner
-void ElementTreeImpl::takeTreeBack(data::TreeSegment const & _aDataSegment)
+void ElementTree::takeTreeBack(rtl::Reference< data::TreeSegment > const & _aDataSegment)
{
- OSL_ENSURE(!m_aOwnData.is(),"ERROR: Cannot take over a node - already owning");
- OSL_ENSURE(_aDataSegment.is(),"ERROR: Cannot take over NULL tree segment");
+ OSL_ENSURE(!m_aOwnData.is(), "ERROR: Cannot take over a node - already owning");
+ OSL_ENSURE(_aDataSegment.is(), "ERROR: Cannot take over NULL tree segment");
m_aOwnData = _aDataSegment;
- OSL_ENSURE(m_aOwnData.is(),"ERROR: Could not take over data segment");
+ OSL_ENSURE(m_aOwnData.is(), "ERROR: Could not take over data segment");
- m_aDataAddress = m_aOwnData.getBaseAddress();
- m_aElementName = m_aOwnData.getName();
+ m_aDataAddress = m_aOwnData->fragment;
+ m_aElementName = m_aOwnData->fragment->getName();
}
//-----------------------------------------------------------------------------
/// transfer ownership from the given owner
-void ElementTreeImpl::takeTreeAndRebuild(data::TreeSegment const & _aDataSegment)
+void ElementTree::takeTreeAndRebuild(rtl::Reference< data::TreeSegment > const & _aDataSegment)
{
- OSL_ENSURE(!m_aOwnData.is(),"ERROR: Cannot take over a node - already owning");
- OSL_ENSURE(_aDataSegment.is(),"ERROR: Cannot take over NULL tree segment");
- if (!m_aOwnData.is())
- {
- this->rebuild(view::createDirectAccessStrategy(_aDataSegment), _aDataSegment.getTreeAccess());
- m_aOwnData = _aDataSegment;
- OSL_ENSURE(m_aOwnData.is(),"ERROR: Could not take over data segment");
- }
+ OSL_ENSURE(!m_aOwnData.is(), "ERROR: Cannot take over a node - already owning");
+ OSL_ENSURE(_aDataSegment.is(), "ERROR: Cannot take over NULL tree segment");
+ this->rebuild(view::createDirectAccessStrategy(_aDataSegment), _aDataSegment->fragment);
+ m_aOwnData = _aDataSegment;
}
//-----------------------------------------------------------------------------
/// release ownership
-data::TreeSegment ElementTreeImpl::releaseOwnedTree()
+rtl::Reference< data::TreeSegment > ElementTree::releaseOwnedTree()
{
- OSL_ENSURE(m_aOwnData.is(),"ERROR: Cannot release and rename a non-owned node");
-
- data::TreeSegment aTree = m_aOwnData;
+ OSL_ENSURE(m_aOwnData.is(), "ERROR: Cannot release and rename a non-owned node");
+ rtl::Reference< data::TreeSegment > aTree(m_aOwnData);
m_aOwnData.clear();
-
- if (aTree.is())
- aTree.setName(m_aElementName);
-
+ aTree->fragment->setName(m_aElementName);
return aTree;
}
//-----------------------------------------------------------------------------
@@ -890,21 +1347,21 @@ data::TreeSegment ElementTreeImpl::releaseOwnedTree()
//-----------------------------------------------------------------------------
/// renames the tree's root without concern for context consistency !
-void ElementTreeImpl::renameTree(Name const& aNewName)
+void ElementTree::renameTree(rtl::OUString const& aNewName)
{
m_aElementName = aNewName;
}
//-----------------------------------------------------------------------------
-void ElementTreeImpl::moveTree(TreeImpl* pParentTree, NodeOffset nParentNode)
+void ElementTree::moveTree(Tree* pParentTree, unsigned int nParentNode)
{
- TreeImpl::setContext(pParentTree,nParentNode);
+ Tree::setContext(pParentTree,nParentNode);
}
//-----------------------------------------------------------------------------
-void ElementTreeImpl::detachTree()
+void ElementTree::detachTree()
{
- TreeImpl::clearContext();
+ Tree::clearContext();
}
//-----------------------------------------------------------------------------
diff --git a/configmgr/source/treemgr/treeimpl.hxx b/configmgr/source/treemgr/treeimpl.hxx
deleted file mode 100644
index c50b6c41f5..0000000000
--- a/configmgr/source/treemgr/treeimpl.hxx
+++ /dev/null
@@ -1,577 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: treeimpl.hxx,v $
- * $Revision: 1.27 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef CONFIGMGR_CONFIGNODEIMPL_HXX_
-#define CONFIGMGR_CONFIGNODEIMPL_HXX_
-
-#include "change.hxx"
-#include "nodeimpl.hxx"
-#include "configpath.hxx"
-#include "template.hxx"
-#include "treeaccessor.hxx"
-#include "utility.hxx"
-#include <rtl/ref.hxx>
-#include <osl/diagnose.h>
-
-#ifndef INCLUDED_VECTOR
-#include <vector>
-#define INCLUDED_VECTOR
-#endif
-#ifndef INCLUDED_MAP
-#include <map>
-#define INCLUDED_MAP
-#endif
-#ifndef INCLUDED_MEMORY
-#include <memory>
-#define INCLUDED_MEMORY
-#endif
-
-namespace configmgr
-{
- class INode;
- class ISubtree;
-
- class Change;
- class SubtreeChange;
-
- namespace view { class ViewStrategy; class ViewTreeAccess; }
- namespace node { struct Attributes; }
- namespace configuration
- {
-//-----------------------------------------------------------------------------
- typedef com::sun::star::uno::Any UnoAny;
-
-//-----------------------------------------------------------------------------
- class TreeImpl;
- class TemplateProvider;
-//-----------------------------------------------------------------------------
- typedef unsigned int NodeOffset;
- typedef unsigned int TreeDepth;
-
- // WARNING: a similar item is in noderef.hxx
- const TreeDepth c_TreeDepthAll = ~0u;
-
-//-----------------------------------------------------------------------------
- inline
- TreeDepth& incDepth(TreeDepth& rDepth)
- {
- if (rDepth != c_TreeDepthAll) ++rDepth;
- return rDepth;
- }
-
- inline
- TreeDepth& decDepth(TreeDepth& rDepth)
- {
- OSL_ENSURE(rDepth != 0,"Cannot decrement zero depth");
- if (rDepth != c_TreeDepthAll && rDepth != 0) --rDepth;
- return rDepth;
- }
-
- inline
- TreeDepth childDepth(TreeDepth nDepth)
- { return decDepth(nDepth); }
-
- inline
- TreeDepth parentDepth(TreeDepth nDepth)
- { return incDepth(nDepth); }
-
- inline
- TreeDepth remainingDepth(TreeDepth nOuterDepth, TreeDepth nRelativeDepth)
- {
- OSL_ENSURE(nRelativeDepth != c_TreeDepthAll,"RelativeDepth can't be infinite");
- OSL_ENSURE(nRelativeDepth <= nOuterDepth,"ERROR: RelativeDepth is larger than enclosing depth");
-
- TreeDepth nInnerDepth = (nOuterDepth == c_TreeDepthAll) ? nOuterDepth :
- (nRelativeDepth < nOuterDepth) ? nOuterDepth-nRelativeDepth :
- 0;
- return nInnerDepth;
- }
-//-----------------------------------------------------------------------------
-
-// class Node Impl
-//-----------------------------------------------------------------------------
-
- /** is the Implementation class for class <type>Node</type>, held inside a <type>Tree</type>.
- <p> Implements some functionality common to all node types.
- </p>
- <p> Otherwise it provides (not really typesafe) access to a
- <type scope='configmgr::configuration::NodeType>NodeImpl</type> which implements
- functionality for a node of a given type
- (as given by a <type scope='configmgr::configuration::NodeType>Enum</type> value).
- </p>
- */
- class NodeData
- {
- rtl::Reference<NodeImpl> m_pSpecificNode;
- Name m_aName_; // cached for better performance
- NodeOffset m_nParent;
- public:
- NodeData(rtl::Reference<NodeImpl> const& aSpecificNodeImpl, Name const& aName, NodeOffset nParent);
-
- void rebuild(rtl::Reference<view::ViewStrategy> const& _xNewStrategy, data::NodeAccess const & _aNewData);
- // COMMON: information
- Name getName() const { return m_aName_; }
- NodeOffset getParent() const { return m_nParent; }
-
- // change management
- public:
- // BASIC NODE: access to common attributes
- NodeImpl & nodeImpl() { return implGetNodeImpl(); }
- NodeImpl const & nodeImpl() const { return implGetNodeImpl(); }
-
- // SET: access to child elements
- bool isSetNode() const;
- SetNodeImpl& setImpl() { return implGetSetImpl(); }
- SetNodeImpl const& setImpl() const { return implGetSetImpl(); }
-
- // VALUES: access to data
- bool isValueElementNode() const;
- ValueElementNodeImpl& valueElementImpl() { return implGetValueImpl(); }
- ValueElementNodeImpl const& valueElementImpl() const { return implGetValueImpl(); }
-
- // GROUP: access to children
- bool isGroupNode() const;
- GroupNodeImpl& groupImpl() { return implGetGroupImpl(); }
- GroupNodeImpl const&groupImpl() const { return implGetGroupImpl(); }
-
- // access helper
- public:
- data::NodeAccess getOriginalNodeAccess() const
- { return data::NodeAccess(m_pSpecificNode->getOriginalNodeAddress()); }
-
- private:
- NodeImpl& implGetNodeImpl() const;
- SetNodeImpl& implGetSetImpl() const;
- GroupNodeImpl& implGetGroupImpl() const ;
- ValueElementNodeImpl& implGetValueImpl() const ;
- };
-//-----------------------------------------------------------------------------
- class RootTreeImpl; // for 'dynamic-casting'
- class ElementTreeImpl; // for 'dynamic-casting'
-
- typedef rtl::Reference<ElementTreeImpl> ElementTreeHolder; // see also setnodeimpl.hxx
- typedef std::vector< ElementTreeHolder > ElementList; // see also setnodeimpl.hxx
-
- /** is the Implementation class for class <type>Tree</type>.
- <p> Holds a list of <type>Node</type> which it allows to access by
- <type>NodeOffset</type> (which is basically a one-based index).
- </p>
- <p> Also provides for navigation to the context this tree is located in
- </p>
- */
- class TreeImpl : public configmgr::SimpleReferenceObject
- {
- friend class view::ViewStrategy;
- friend class TreeSetNodeImpl;
- // friend class DeferredSetNodeImpl;
- public:
- /// the type of the internal list of <type>Node</type>
- typedef std::vector<NodeData> NodeList;
-
- protected:
- // Construction
- /// creates a TreeImpl for a detached, virgin tree
- explicit
- TreeImpl( );
-
- /// creates a TreeImpl with a parent tree
- TreeImpl(TreeImpl& rParentTree, NodeOffset nParentNode);
-
- /// fills this TreeImpl starting from _aRootNode, using the given factory and the tree's template provider
- void build(rtl::Reference<view::ViewStrategy> const& _xStrategy, data::NodeAccess const& _aRootNode, TreeDepth nDepth, TemplateProvider const& aTemplateProvider);
-
- void rebuild(rtl::Reference<view::ViewStrategy> const& _xNewStrategy, data::NodeAccess const & _aNewData);
-
- public:
- /// destroys a TreeImpl
- virtual ~TreeImpl();
-
- // realeses the data this refers to
- virtual void disposeData();
-
- // Context Access
- /// gets the path to the root node of this tree
- AbsolutePath getRootPath() const;
- /// gets the tree of parent node of this tree
- TreeImpl* getContextTree() { return m_pParentTree; }
- /// gets the tree of parent node of this tree
- TreeImpl const *getContextTree() const { return m_pParentTree; }
- /// gets the offset of parent node of this tree within its tree
- NodeOffset getContextNode() const { return m_nParentNode; }
-
- // Node Collection information
- /// checks whether <var>nNode</var> is a valid node offset in this tree
- bool isValidNode(NodeOffset nNode) const;
-
- /// gets the depth that is available in this tree (due to the original request)
- TreeDepth getAvailableDepth() const { return m_nDepth; }
-
- /// gets the depth that is available in this tree within the given node
- TreeDepth getRemainingDepth(NodeOffset nNode) const
- { return remainingDepth(getAvailableDepth(),depthTo(nNode)); }
-
- // Node Collection navigation
- /** gets the simple <type>Name</type> of the node <var>nNode</var>
- <p>PRE: <code>isValidNode(nNode)</code>
- </p>
- */
- Name getSimpleNodeName(NodeOffset nNode) const;
-
- /** gets the simple <type>Name</type> of the root node (i.e. of the tree as a whole)
- */
- virtual Name getSimpleRootName() const;
-
- /** gets the full name of the root node
- */
- Path::Component getExtendedRootName() const;
-
- /** gets the number of hierarchy levels from the root node to node <var>nNode</var>
- in this tree
- <p>In particular <code>depthTo(N) == 0</code> if <code>N == root()</code>
- </p>
- <p>PRE: <code>isValidNode(nNode)</code>
- </p>
- */
- TreeDepth depthTo(NodeOffset nNode) const;
-
- /// append the local path (relative to root) to a node to a collection of names
- void prependLocalPathTo(NodeOffset nNode, Path::Rep& rNames);
-
- // check whether defaults are available
- bool hasDefaults(NodeOffset _nNode) const;
- public:
- /// gets the <type>NodeOffset</type> of the root node in this tree
- NodeOffset root_() const { return m_nRoot; }
-
- /** gets the <type>NodeOffset</type> of the parent node <var>nNode</var> in this tree
- or 0 (zero) if it is the root node
- <p>PRE: <code>isValidNode(nNode)</code>
- </p>
- */
- NodeOffset parent_(NodeOffset nNode) const;
-
- // Node iteration and access
- /** gets the <type>NodeOffset</type> of the first child node
- of node <var>nParent</var> in this tree (in list order)
- or 0 (zero) if it has no children in this tree
- <p>PRE: <code>isValidNode(nParent)</code>
- </p>
- */
- NodeOffset firstChild_ (NodeOffset nParent) const;
-
- /** gets the <type>NodeOffset</type> of the first child node
- of node <var>nParent</var> that is after
- node <var>nNode</var> in this tree (in list order)
- or 0 (zero) if there is no such node
- <p>if <code>nStartAfter == 0</code> searching starts at the beginning
- </p>
- <p>PRE: <code>isValidNode(nParent)</code>
- </p>
- <p>PRE: <code>isValidNode(nStartAfter) || nStartAfter == 0</code>
- </p>
- */
- NodeOffset findNextChild_(NodeOffset nParent, NodeOffset nStartAfter) const;
-
- /** gets the <type>NodeOffset</type> of the first (and only) child node
- of node <var>nParent</var> in this tree (in list order)
- where the name of the node is <var>aName</var>,
- or 0 (zero) if there is no such node
- <p>PRE: <code>isValidNode(nParent)</code>
- </p>
- */
- NodeOffset findChild_(NodeOffset nParent, Name const& aName) const;
-
- // Node Collection access
- /// get the number of nodes in this tree
- NodeOffset nodeCount() const;
-
- /// get the <type>NodeData</type> for node <var>nNode</var> in this tree
- NodeData* nodeData(NodeOffset nNode);
- /// get the <type>NodeData</type> for node <var>nNode</var> in this tree
- NodeData const* nodeData(NodeOffset nNode) const;
- /// get the <type>NodeData</type> for node <var>nNode</var> in this tree
- NodeImpl& nodeImpl(NodeOffset nNode) { return nodeData(nNode)->nodeImpl(); }
- /// get the <type>NodeData</type> for node <var>nNode</var> in this tree
- NodeImpl const& nodeImpl(NodeOffset nNode) const { return nodeData(nNode)->nodeImpl(); }
-
- NodeOffset nodeOffset(NodeData const & rNodeData) const;
-
- ElementTreeImpl * asElementTree();
- ElementTreeImpl const* asElementTree() const;
-
- // Behavior
- rtl::Reference< view::ViewStrategy > getViewBehavior() const;
- protected:
- // immediate commit
-/* // implementation of commit protocol
- void commitDirect();
-
- void implCommitDirectFrom(NodeOffset nNode);
-*/
- void implRebuild(NodeOffset nNode, data::NodeAccess const & _aNewData);
-
- protected:
- /// set a new parent context for this tree
- void setContext(TreeImpl* pParentTree, NodeOffset nParentNode);
- /// set no-parent context for this tree
- void clearContext();
-
- inline // is protected and should be used only in the implementation
- Name implGetOriginalName(NodeOffset nNode) const;
-
- private:
- virtual RootTreeImpl const* doCastToRootTree() const = 0;
- virtual ElementTreeImpl const* doCastToElementTree() const = 0;
-
- /// get the full name of the root of this tree
- virtual Path::Component doGetRootName() const = 0;
-
- /// prepend the absolute path to the root of this tree (no context use)
- virtual void doFinishRootPath(Path::Rep& rPath) const = 0;
-
- rtl::Reference<view::ViewStrategy> m_xStrategy;
- NodeList m_aNodes;
- TreeImpl* m_pParentTree;
- NodeOffset m_nParentNode;
- TreeDepth m_nDepth;
-
- enum { m_nRoot = 1 }; /// base of <type>NodeOffset</type>s used in this class
-
- /// prepend the absolute path to the root of this tree (using context if present)
- void implPrependRootPath(Path::Rep& rPath) const;
-
- friend class TreeImplBuilder;
- };
-//-----------------------------------------------------------------------------
-
- class ElementTreeImpl : public TreeImpl
- {
- public:
-
- /// creates a TreeImpl for a detached, virgin instance of <var>aTemplate</var> (always will be direct)
- ElementTreeImpl( data::TreeSegment const& _aElementData, TemplateHolder aTemplate, TemplateProvider const& aTemplateProvider );
-
- /** creates a TreeImpl with a parent tree, that (supposedly)
- is an instance of <var>aTemplateInfo</var>
- */
- ElementTreeImpl(rtl::Reference<view::ViewStrategy> const& _xStrategy,
- TreeImpl& rParentTree, NodeOffset nParentNode,
- data::TreeAccessor const& _aDataTree, TreeDepth nDepth,
- TemplateHolder aTemplateInfo,
- TemplateProvider const& aTemplateProvider );
-
- /** creates a TreeImpl with no parent node, that (supposedly)
- is an instance of <var>aTemplateInfo</var>
- */
- ElementTreeImpl(rtl::Reference<view::ViewStrategy> const& _xStrategy,
- data::TreeAccessor const& _aDataTree, TreeDepth nDepth,
- TemplateHolder aTemplateInfo,
- TemplateProvider const& aTemplateProvider );
-
- ~ElementTreeImpl();
-
- // realeses the data this refers to
- virtual void disposeData();
-
- // rebuilding
- using TreeImpl::rebuild;
- void rebuild(rtl::Reference<view::ViewStrategy> const& _xNewStrategy, data::TreeAccessor const & _aNewData);
-
- // data access
- data::TreeAccessor getOriginalTreeAccess() const { return data::TreeAccessor(m_aDataAddress); }
-
- // Tree information
- virtual Name getSimpleRootName() const;
- /// checks whether this is an instance of a known template
- bool isTemplateInstance() const { return !!m_aInstanceInfo.is(); }
- /// checks whether this is an instance of the given template
- bool isInstanceOf(TemplateHolder const& aTemplateInfo) const
- { return m_aInstanceInfo == aTemplateInfo && aTemplateInfo.is(); }
- /// retrieves the template that this is an instance of
- TemplateHolder getTemplate() const { return m_aInstanceInfo; }
- /// makes a complete name from a simple name and template information
- Path::Component makeExtendedName(Name const& aSimpleName) const;
-
- // node control operation
- /// check if this is a free-floating tree
- bool isFree() const { return m_aOwnData.is(); }
- /// transfer ownership to the given set
- void attachTo(data::SetNodeAccess const & _aUpdatableSetNode, Name const& aElementName);
- /// tranfer ownership from the given set
- void detachFrom(data::SetNodeAccess const & _aUpdatableSetNode, Name const& aElementName);
-
- /// take ownership of the given tree (which must not already be the one in use)
- void takeTreeAndRebuild(data::TreeSegment const& _aElementData);
- /// take ownership of the given tree (which must already be the one in use)
- void takeTreeBack(data::TreeSegment const& _aElementData);
-
- /// release ownership
- data::TreeSegment releaseOwnedTree();
-
- // context operation
- /// set a new root name
- void renameTree(Name const& aNewName);
- /// set a new parent context for this tree
- void moveTree(TreeImpl* pParentTree, NodeOffset nParentNode);
- /// set no-parent context for this tree
- void detachTree();
-
- private:
- static bool isUpdatableSegment(TreeImpl& _rTree);
-
- virtual RootTreeImpl const* doCastToRootTree() const;
- virtual ElementTreeImpl const* doCastToElementTree() const;
-
- virtual Path::Component doGetRootName() const;
-
- virtual void doFinishRootPath(Path::Rep& rPath) const;
- private:
- TemplateHolder const m_aInstanceInfo;
- Name m_aElementName;
- data::TreeAddress m_aDataAddress;
- data::TreeSegment m_aOwnData;
- };
-//-----------------------------------------------------------------------------
-
- inline
- NodeImpl& NodeData::implGetNodeImpl() const
- {
- OSL_ASSERT(m_pSpecificNode != 0);
- return *m_pSpecificNode;
- }
-//-----------------------------------------------------------------------------
- inline
- bool TreeImpl::isValidNode(NodeOffset nNode) const
- {
- return m_nRoot <= nNode && nNode < nodeCount() +m_nRoot;
- }
- //---------------------------------------------------------------------
- inline
- NodeOffset TreeImpl::nodeCount() const
- {
- return m_aNodes.size();
- }
- //---------------------------------------------------------------------
- inline
- NodeData* TreeImpl::nodeData(NodeOffset nNode)
- {
- if (nNode == 0) return NULL;
- OSL_ASSERT(isValidNode(nNode));
- return &m_aNodes[nNode-root_()];
- }
- //---------------------------------------------------------------------
- inline
- NodeData const* TreeImpl::nodeData(NodeOffset nNode) const
- {
- if (nNode == 0) return NULL;
- OSL_ASSERT(isValidNode(nNode));
- return &m_aNodes[nNode-root_()];
- }
- //---------------------------------------------------------------------
- inline
- NodeOffset TreeImpl::nodeOffset(NodeData const & rNode) const
- {
- NodeOffset nOffset = root_() + (&rNode - &m_aNodes[0]);
- OSL_ASSERT(isValidNode(nOffset));
- return nOffset;
- }
-
-//-----------------------------------------------------------------------------
-// helper for other impl classes
-//-----------------------------------------------------------------------------
- class Tree;
- class TreeRef;
- class NodeRef;
- class ValueRef;
- class AnyNodeRef;
- class NodeID;
-
- class ValueMemberNode;
-//-----------------------------------------------------------------------------
- /// is a hack to avoid too many friend declarations in public headers
- class TreeImplHelper
- {
- public:
- static
- NodeRef makeNode(NodeOffset nOffset, TreeDepth nDepth);
-
- static
- NodeRef makeNode(TreeImpl& rTree, NodeOffset nOffset);
-
- static
- NodeRef makeNode(NodeID const& aNodeID);
-
- static
- ValueRef makeValue(Name const& aName, NodeOffset nParentOffset);
-
- static
- TreeImpl* impl(Tree const& aTree);
-
- static
- TreeImpl* impl(TreeRef const& aTree);
-
- static
- NodeData* nodeData(NodeRef const& aNode);
-
- static
- NodeOffset offset(NodeRef const& aNode);
-
- static
- NodeOffset parent_offset(ValueRef const& aNode);
-
- static
- Name value_name(ValueRef const& aNode);
-
- static
- ValueMemberNode member_node(Tree const & _aTree,ValueRef const& aValue);
-
- static
- TreeImpl* tree(NodeID const& aNodeID);
-
- static
- NodeOffset offset(NodeID const& aNodeID);
-
- };
-//-----------------------------------------------------------------------------
- class ElementTree;
-//-----------------------------------------------------------------------------
-#if OSL_DEBUG_LEVEL > 0
- struct ElementHelper
- {
- static
- UnoType getUnoType(ElementTree const& aElement);
- };
-#endif
-//-----------------------------------------------------------------------------
- }
-//-----------------------------------------------------------------------------
-}
-
-#endif // CONFIGMGR_CONFIGNODEIMPL_HXX_
diff --git a/configmgr/source/treemgr/valuemembernode.cxx b/configmgr/source/treemgr/valuemembernode.cxx
index 1548598926..d56c811ab5 100644
--- a/configmgr/source/treemgr/valuemembernode.cxx
+++ b/configmgr/source/treemgr/valuemembernode.cxx
@@ -55,16 +55,16 @@ namespace
//-----------------------------------------------------------------------------
inline
-void setOriginalValue(data::ValueNodeAddress const& rOriginalAddress, UnoAny const& aNewValue)
+void setOriginalValue(sharable::ValueNode * const& rOriginalAddress, com::sun::star::uno::Any const& aNewValue)
{
- data::ValueNodeAccess::setValue(rOriginalAddress,aNewValue);
+ rOriginalAddress->setValue(aNewValue);
}
//-----------------------------------------------------------------------------
inline
-void setOriginalToDefault(data::ValueNodeAddress const& rOriginalAddress)
+void setOriginalToDefault(sharable::ValueNode * const& rOriginalAddress)
{
- data::ValueNodeAccess::setToDefault(rOriginalAddress);
+ rOriginalAddress->setToDefault();
}
} // anonymous namespace
@@ -73,25 +73,25 @@ void setOriginalToDefault(data::ValueNodeAddress const& rOriginalAddress)
// class ValueMemberNode
//-----------------------------------------------------------------------------
-ValueMemberNode::ValueMemberNode(data::ValueNodeAccess const& _aNodeAccess)
- : m_aNodeRef(_aNodeAccess)
+ValueMemberNode::ValueMemberNode(sharable::ValueNode * node)
+ : m_node(node)
, m_xDeferredOperation()
{}
//-----------------------------------------------------------------------------
-ValueMemberNode::ValueMemberNode(DeferredImplRef const& _xDeferred) // must be valid
- : m_aNodeRef( _xDeferred->getOriginalNode() )
+ValueMemberNode::ValueMemberNode(rtl::Reference<DeferredImpl> const& _xDeferred) // must be valid
+ : m_node( _xDeferred->getOriginalNode() )
, m_xDeferredOperation(_xDeferred)
{}
//-----------------------------------------------------------------------------
ValueMemberNode::ValueMemberNode(ValueMemberNode const& rOriginal)
- : m_aNodeRef(rOriginal.m_aNodeRef)
+ : m_node(rOriginal.m_node)
, m_xDeferredOperation(rOriginal.m_xDeferredOperation)
{}
//-----------------------------------------------------------------------------
ValueMemberNode& ValueMemberNode::operator=(ValueMemberNode const& rOriginal)
{
- m_aNodeRef = rOriginal.m_aNodeRef;
+ m_node = rOriginal.m_node;
m_xDeferredOperation = rOriginal.m_xDeferredOperation;
return *this;
}
@@ -104,9 +104,9 @@ ValueMemberNode::~ValueMemberNode()
bool ValueMemberNode::isValid() const
{
OSL_ASSERT( !m_xDeferredOperation.is() ||
- m_aNodeRef == m_xDeferredOperation->getOriginalNodeAddress());
+ m_node == m_xDeferredOperation->getOriginalNode());
- return m_aNodeRef.isValid();
+ return m_node != 0;
}
//-----------------------------------------------------------------------------
@@ -122,15 +122,15 @@ bool ValueMemberNode::hasChange() const
// external accessors
//-----------------------------------------------------------------------------
-Name ValueMemberNode::getNodeName() const
+rtl::OUString ValueMemberNode::getNodeName() const
{
- return m_aNodeRef.getName();
+ return m_node->info.getName();
}
//-----------------------------------------------------------------------------
node::Attributes ValueMemberNode::getAttributes() const
{
- return m_aNodeRef.getAttributes();
+ return sharable::node(m_node)->getAttributes();
}
//-----------------------------------------------------------------------------
@@ -140,86 +140,86 @@ bool ValueMemberNode::isDefault() const
if (hasChange())
return m_xDeferredOperation->isToDefault();
- return m_aNodeRef.isDefault();
+ return m_node->info.isDefault();
}
//-----------------------------------------------------------------------------
bool ValueMemberNode::canGetDefaultValue() const
{
- return m_aNodeRef.hasUsableDefault();
+ return m_node->hasUsableDefault();
}
//-----------------------------------------------------------------------------
-UnoAny ValueMemberNode::getValue() const
+com::sun::star::uno::Any ValueMemberNode::getValue() const
{
if (hasChange())
return m_xDeferredOperation->getNewValue();
- return m_aNodeRef.getValue();
+ return m_node->getValue();
}
//-----------------------------------------------------------------------------
-UnoAny ValueMemberNode::getDefaultValue() const
+com::sun::star::uno::Any ValueMemberNode::getDefaultValue() const
{
- return m_aNodeRef.getDefaultValue();
+ return m_node->getDefaultValue();
}
//-----------------------------------------------------------------------------
-UnoType ValueMemberNode::getValueType() const
+com::sun::star::uno::Type ValueMemberNode::getValueType() const
{
- return m_aNodeRef.getValueType();
+ return m_node->getValueType();
}
//-----------------------------------------------------------------------------
-void ValueMemberUpdate::setValue(UnoAny const& aNewValue)
+void ValueMemberUpdate::setValue(com::sun::star::uno::Any const& aNewValue)
{
if (m_aMemberNode.m_xDeferredOperation.is())
- m_aMemberNode.m_xDeferredOperation->setValue(aNewValue, m_aMemberNode.m_aNodeRef);
+ m_aMemberNode.m_xDeferredOperation->setValue(aNewValue, m_aMemberNode.m_node);
else
- setOriginalValue(m_aMemberNode.m_aNodeRef, aNewValue );
+ setOriginalValue(m_aMemberNode.m_node, aNewValue );
}
//-----------------------------------------------------------------------------
void ValueMemberUpdate::setDefault()
{
if (m_aMemberNode.m_xDeferredOperation.is())
- m_aMemberNode.m_xDeferredOperation->setValueToDefault(m_aMemberNode.m_aNodeRef);
+ m_aMemberNode.m_xDeferredOperation->setValueToDefault(m_aMemberNode.m_node);
else
- setOriginalToDefault( m_aMemberNode.m_aNodeRef );
+ setOriginalToDefault(m_aMemberNode.m_node);
}
//-----------------------------------------------------------------------------
// class ValueMemberNode::DeferredImpl
//-----------------------------------------------------------------------------
-ValueMemberNode::DeferredImpl::DeferredImpl(data::ValueNodeAccess const& _aValueNode)
-: m_aValueRef(_aValueNode)
-, m_aNewValue(_aValueNode.getValue())
+ValueMemberNode::DeferredImpl::DeferredImpl(sharable::ValueNode * valueNode)
+: m_valueNode(valueNode)
+, m_aNewValue(valueNode->getValue())
, m_bToDefault(false)
, m_bChange(false)
{}
//-----------------------------------------------------------------------------
-void ValueMemberNode::DeferredImpl::setValue(UnoAny const& aNewValue, data::ValueNodeAccess const& _aOriginalNode)
+void ValueMemberNode::DeferredImpl::setValue(com::sun::star::uno::Any const& aNewValue, sharable::ValueNode * originalNode)
{
- OSL_ENSURE(_aOriginalNode == m_aValueRef, "Incorrect original node passed");
+ OSL_ENSURE(originalNode == m_valueNode, "Incorrect original node passed");
m_aNewValue = aNewValue;
m_bToDefault = false;
- m_bChange = _aOriginalNode.isDefault() || aNewValue != _aOriginalNode.getValue();
+ m_bChange = originalNode->info.isDefault() || aNewValue != originalNode->getValue();
}
//-----------------------------------------------------------------------------
-void ValueMemberNode::DeferredImpl::setValueToDefault(data::ValueNodeAccess const& _aOriginalNode)
+void ValueMemberNode::DeferredImpl::setValueToDefault(sharable::ValueNode * originalNode)
{
- OSL_ENSURE(_aOriginalNode == m_aValueRef, "Incorrect original node passed");
+ OSL_ENSURE(originalNode == m_valueNode, "Incorrect original node passed");
- m_aNewValue = _aOriginalNode.getDefaultValue();
+ m_aNewValue = originalNode->getDefaultValue();
m_bToDefault = true;
- m_bChange = !_aOriginalNode.isDefault();
+ m_bChange = !originalNode->info.isDefault();
}
//-----------------------------------------------------------------------------
@@ -227,7 +227,7 @@ std::auto_ptr<ValueChange> ValueMemberNode::DeferredImpl::preCommitChange()
{
OSL_ENSURE(isChange(), "Trying to commit a non-change");
- data::ValueNodeAccess aOriginalNode = getOriginalNode();
+ sharable::ValueNode * originalNode = getOriginalNode();
// first find the mode of the change
ValueChange::Mode eMode;
@@ -235,18 +235,18 @@ std::auto_ptr<ValueChange> ValueMemberNode::DeferredImpl::preCommitChange()
if (m_bToDefault)
eMode = ValueChange::setToDefault;
- else if (! aOriginalNode.isDefault())
+ else if (! originalNode->info.isDefault())
eMode = ValueChange::changeValue;
else
eMode = ValueChange::wasDefault;
// now make a ValueChange
- std::auto_ptr<ValueChange>pChange( new ValueChange( aOriginalNode.getName().toString(),
- aOriginalNode.getAttributes(),
+ std::auto_ptr<ValueChange>pChange( new ValueChange( originalNode->info.getName(),
+ sharable::node(originalNode)->getAttributes(),
eMode,
this->getNewValue(),
- aOriginalNode.getValue()
+ originalNode->getValue()
) );
return pChange;
@@ -258,9 +258,9 @@ void ValueMemberNode::DeferredImpl::finishCommit(ValueChange& rChange)
{ (void)rChange; }
OSL_ENSURE(rChange.getNewValue() == this->getNewValue(),"Committed change does not match the intended value");
- data::ValueNodeAccess aOriginalNode = getOriginalNode();
+ sharable::ValueNode * originalNode = getOriginalNode();
- m_aNewValue = aOriginalNode.getValue();
+ m_aNewValue = originalNode->getValue();
m_bToDefault = false;
OSL_ENSURE(rChange.getNewValue() == m_aNewValue,"Committed change does not match the actual value");
@@ -279,10 +279,10 @@ void ValueMemberNode::DeferredImpl::revertCommit(ValueChange& rChange)
void ValueMemberNode::DeferredImpl::failedCommit(ValueChange&)
{
- data::ValueNodeAccess aOriginalNode = getOriginalNode();
+ sharable::ValueNode * originalNode = getOriginalNode();
// discard the change
- m_aNewValue = aOriginalNode.getValue();
+ m_aNewValue = originalNode->getValue();
m_bToDefault = false;
m_bChange= false;
@@ -290,16 +290,16 @@ void ValueMemberNode::DeferredImpl::failedCommit(ValueChange&)
//-----------------------------------------------------------------------------
ValueChangeImpl* ValueMemberNode::DeferredImpl::collectChange()
{
- data::ValueNodeAccess aOriginalNode = getOriginalNode();
+ sharable::ValueNode * originalNode = getOriginalNode();
- UnoAny aOldValue = aOriginalNode.getValue();
+ com::sun::star::uno::Any aOldValue = originalNode->getValue();
if (!m_bChange)
{
return NULL;
}
else if (m_bToDefault)
{
- OSL_ASSERT( m_aNewValue == aOriginalNode.getDefaultValue() );
+ OSL_ASSERT( m_aNewValue == originalNode->getDefaultValue() );
return new ValueResetImpl( m_aNewValue, aOldValue );
}
diff --git a/configmgr/source/treemgr/valuemembernode.hxx b/configmgr/source/treemgr/valuemembernode.hxx
index 98e5f7f919..7fac046425 100644
--- a/configmgr/source/treemgr/valuemembernode.hxx
+++ b/configmgr/source/treemgr/valuemembernode.hxx
@@ -32,35 +32,29 @@
#define CONFIGMGR_VALUEMEMBERNODE_HXX_
#include "nodeimpl.hxx"
-#include "valuenodeaccess.hxx"
namespace configmgr
{
namespace configuration
{
//-----------------------------------------------------------------------------
- typedef com::sun::star::uno::Any UnoAny;
- typedef com::sun::star::uno::Type UnoType;
-
- class Name;
-//-----------------------------------------------------------------------------
/// handle class for values that are not nodes themselves, but members of a group
class ValueMemberNode
{
+ public:
class DeferredImpl;
- typedef rtl::Reference<DeferredImpl> DeferredImplRef;
-
- data::ValueNodeAccess m_aNodeRef;
- DeferredImplRef m_xDeferredOperation;
+ private:
+ sharable::ValueNode * m_node;
+ rtl::Reference<DeferredImpl> m_xDeferredOperation;
private:
friend class GroupNodeImpl;
friend class DeferredGroupNodeImpl;
friend class ValueMemberUpdate;
/// create a ValueMemberNode for a given node
- explicit ValueMemberNode(data::ValueNodeAccess const& _aNodeAccess);
+ explicit ValueMemberNode(sharable::ValueNode * node);
/// create a deferred ValueMemberNode (xOriginal must not be empty)
- ValueMemberNode(DeferredImplRef const& _xDeferred);
+ ValueMemberNode(rtl::Reference<DeferredImpl> const& _xDeferred);
public:
ValueMemberNode(ValueMemberNode const& rOriginal);
ValueMemberNode& operator=(ValueMemberNode const& rOriginal);
@@ -73,7 +67,7 @@ namespace configmgr
bool hasChange() const;
/// retrieve the name of the underlying node
- Name getNodeName() const;
+ rtl::OUString getNodeName() const;
/// retrieve the attributes
node::Attributes getAttributes() const;
@@ -82,11 +76,11 @@ namespace configmgr
/// is the default value of this node available
bool canGetDefaultValue() const;
/// retrieve the current value of this node
- UnoAny getValue() const;
+ com::sun::star::uno::Any getValue() const;
/// retrieve the default value of this node
- UnoAny getDefaultValue() const;
+ com::sun::star::uno::Any getDefaultValue() const;
- UnoType getValueType() const;
+ com::sun::star::uno::Type getValueType() const;
};
//-------------------------------------------------------------------------
@@ -97,7 +91,6 @@ namespace configmgr
ValueMemberNode m_aMemberNode;
view::ViewStrategy * m_pStrategy;
private:
- typedef ValueMemberNode::DeferredImplRef DeferredImplRef;
friend class view::ViewStrategy;
ValueMemberUpdate(ValueMemberNode const& rOriginal, view::ViewStrategy& _rStrategy)
@@ -111,7 +104,7 @@ namespace configmgr
ValueMemberNode getNode() const { return m_aMemberNode; }
/// Set this node to a new value
- void setValue(UnoAny const& aNewValue);
+ void setValue(com::sun::star::uno::Any const& aNewValue);
/// Set this node to assume its default value
void setDefault();
diff --git a/configmgr/source/treemgr/valuenodeimpl.hxx b/configmgr/source/treemgr/valuenodeimpl.hxx
index 0b8c5d29b0..ed17bca95c 100644
--- a/configmgr/source/treemgr/valuenodeimpl.hxx
+++ b/configmgr/source/treemgr/valuenodeimpl.hxx
@@ -37,17 +37,8 @@ namespace configmgr
{
class ValueChange;
- namespace data
- {
- class GroupNodeAccess;
- class ValueNodeAccess;
- }
-//-----------------------------------------------------------------------------
-
namespace configuration
{
- typedef com::sun::star::uno::Any UnoAny;
- typedef com::sun::star::uno::Type UnoType;
//-----------------------------------------------------------------------------
// Another types of node
//-----------------------------------------------------------------------------
@@ -59,19 +50,18 @@ namespace configmgr
class ValueElementNodeImpl : public NodeImpl
{
public:
- explicit ValueElementNodeImpl(data::ValueNodeAddress const& _aNodeRef) ;
+ explicit ValueElementNodeImpl(sharable::ValueNode * const& _aNodeRef) ;
// the following delegate directly to the original node
public:
/// Does this node assume its default value
/// retrieve the current value of this node
- UnoAny getValue() const;
+ com::sun::star::uno::Any getValue() const;
/// get the type of this value
- UnoType getValueType() const;
+ com::sun::star::uno::Type getValueType() const;
- typedef data::ValueNodeAccess DataAccess;
- DataAccess getDataAccess() const;
+ sharable::ValueNode * getDataAccess() const;
};
// domain-specific 'dynamic_cast' replacement
diff --git a/configmgr/source/treemgr/viewaccess.cxx b/configmgr/source/treemgr/viewaccess.cxx
index db2bf734a7..cc0765903e 100644
--- a/configmgr/source/treemgr/viewaccess.cxx
+++ b/configmgr/source/treemgr/viewaccess.cxx
@@ -32,7 +32,7 @@
#include "precompiled_configmgr.hxx"
#include "viewaccess.hxx"
-#include "treeimpl.hxx"
+#include "tree.hxx"
#include "noderef.hxx"
//-----------------------------------------------------------------------------
@@ -48,9 +48,9 @@ configuration::NodeData* ViewTreeAccess::nodeData(configuration::NodeRef const&
}
//-----------------------------------------------------------------------------
-configuration::NodeData* ViewTreeAccess::nodeData(NodeOffset _aNodePos) const
+configuration::NodeData* ViewTreeAccess::nodeData(unsigned int _aNodePos) const
{
- return m_aTree.get_impl()->nodeData(_aNodePos);
+ return m_tree->nodeData(_aNodePos);
}
//-----------------------------------------------------------------------------
diff --git a/configmgr/source/treemgr/viewaccess.hxx b/configmgr/source/treemgr/viewaccess.hxx
index b95a8b279c..0127d973c8 100644
--- a/configmgr/source/treemgr/viewaccess.hxx
+++ b/configmgr/source/treemgr/viewaccess.hxx
@@ -48,97 +48,95 @@ namespace configmgr
class ViewTreeAccess
{
rtl::Reference< ViewStrategy > m_xStrategy;
- Tree m_aTree;
+ configuration::Tree * m_tree;
public:
- explicit ViewTreeAccess(Tree const & _aTree);
- explicit ViewTreeAccess(configuration::TreeImpl& _rTree);
+ explicit ViewTreeAccess(configuration::Tree * tree):
+ m_xStrategy(tree->getViewBehavior()), m_tree(tree) {}
rtl::Reference< view::ViewStrategy > getViewBehavior() { return m_xStrategy; }
public:
- typedef configuration::NodeRef const& NodeArg;
- typedef configuration::NodeOffset NodeOffset;
- configuration::NodeData* nodeData(NodeArg _aNodeArg) const;
- configuration::NodeData* nodeData(NodeOffset _aNodePos) const;
+ configuration::NodeData* nodeData(configuration::NodeRef const& _aNodeArg) const;
+ configuration::NodeData* nodeData(unsigned int _aNodePos) const;
- Node makeNode(NodeArg _aNodeArg) const { return Node(m_aTree,nodeData(_aNodeArg)); }
- Node makeNode(NodeOffset _aNodePos) const { return Node(m_aTree,nodeData(_aNodePos)); }
+ Node makeNode(configuration::NodeRef const& _aNodeArg) const { return Node(m_tree,nodeData(_aNodeArg)); }
+ Node makeNode(unsigned int _aNodePos) const { return Node(m_tree,nodeData(_aNodePos)); }
- bool isSetNode (NodeArg _aNodeArg) const { return makeNode(_aNodeArg).isSetNode(); }
- bool isGroupNode(NodeArg _aNodeArg) const { return makeNode(_aNodeArg).isGroupNode(); }
- bool isValueNode(NodeArg _aNodeArg) const { return makeNode(_aNodeArg).isValueNode(); }
+ bool isSetNode (configuration::NodeRef const& _aNodeArg) const { return makeNode(_aNodeArg).isSetNode(); }
+ bool isGroupNode(configuration::NodeRef const& _aNodeArg) const { return makeNode(_aNodeArg).isGroupNode(); }
+ bool isValueNode(configuration::NodeRef const& _aNodeArg) const { return makeNode(_aNodeArg).isValueNode(); }
- bool isSetNodeAt (NodeOffset _aNodeArg) const { return makeNode(_aNodeArg).isSetNode(); }
- bool isGroupNodeAt(NodeOffset _aNodeArg) const { return makeNode(_aNodeArg).isGroupNode(); }
- bool isValueNodeAt(NodeOffset _aNodeArg) const { return makeNode(_aNodeArg).isValueNode(); }
+ bool isSetNodeAt (unsigned int _aNodeArg) const { return makeNode(_aNodeArg).isSetNode(); }
+ bool isGroupNodeAt(unsigned int _aNodeArg) const { return makeNode(_aNodeArg).isGroupNode(); }
+ bool isValueNodeAt(unsigned int _aNodeArg) const { return makeNode(_aNodeArg).isValueNode(); }
- SetNode toSetNode (NodeArg _aNodeArg) const
+ SetNode toSetNode (configuration::NodeRef const& _aNodeArg) const
{ return SetNode (makeNode(_aNodeArg)); }
- GroupNode toGroupNode(NodeArg _aNodeArg) const
+ GroupNode toGroupNode(configuration::NodeRef const& _aNodeArg) const
{ return GroupNode(makeNode(_aNodeArg)); }
- ValueNode toValueNode(NodeArg _aNodeArg) const
+ ValueNode toValueNode(configuration::NodeRef const& _aNodeArg) const
{ return ValueNode(makeNode(_aNodeArg)); }
- SetNode getSetNodeAt (NodeOffset _aNodeArg) const
+ SetNode getSetNodeAt (unsigned int _aNodeArg) const
{ return SetNode (makeNode(_aNodeArg)); }
- GroupNode getGroupNodeAt(NodeOffset _aNodeArg) const
+ GroupNode getGroupNodeAt(unsigned int _aNodeArg) const
{ return GroupNode(makeNode(_aNodeArg)); }
- ValueNode getValueNodeAt(NodeOffset _aNodeArg) const
+ ValueNode getValueNodeAt(unsigned int _aNodeArg) const
{ return ValueNode(makeNode(_aNodeArg)); }
// node attributes
public:
/// retrieve the name of the node
- Name getName(NodeArg _aNode) const
+ rtl::OUString getName(configuration::NodeRef const& _aNode) const
{ return m_xStrategy->getName(makeNode(_aNode)); }
/// retrieve the attributes of the node
- node::Attributes getAttributes(NodeArg _aNode) const
+ node::Attributes getAttributes(configuration::NodeRef const& _aNode) const
{ return m_xStrategy->getAttributes(makeNode(_aNode)); }
/// retrieve the name of the tree root
- Name getRootName() const
- { return m_xStrategy->getName( getRootNode(m_aTree) ); }
+ rtl::OUString getRootName() const
+ { return m_xStrategy->getName( getRootNode(m_tree) ); }
/// retrieve the attributes of the tree root
node::Attributes getRootAttributes() const
- { return m_xStrategy->getAttributes( getRootNode(m_aTree) ); }
+ { return m_xStrategy->getAttributes( getRootNode(m_tree) ); }
// tracking pending changes
public:
void collectChanges(configuration::NodeChanges& rChanges) const
- { m_xStrategy->collectChanges(m_aTree,rChanges); }
+ { m_xStrategy->collectChanges(m_tree,rChanges); }
bool hasChanges() const
- { return m_xStrategy->hasChanges(m_aTree); }
+ { return m_xStrategy->hasChanges(m_tree); }
- bool hasChanges(NodeArg _aNode) const
+ bool hasChanges(configuration::NodeRef const& _aNode) const
{ return m_xStrategy->hasChanges(makeNode(_aNode)); }
- void markChanged(NodeArg _aNode)
+ void markChanged(configuration::NodeRef const& _aNode)
{ m_xStrategy->markChanged(makeNode(_aNode)); }
// commit protocol
public:
- std::auto_ptr<SubtreeChange> preCommitChanges(configuration::ElementList& _rRemovedElements)
- { return m_xStrategy->preCommitChanges(m_aTree,_rRemovedElements); }
+ std::auto_ptr<SubtreeChange> preCommitChanges(std::vector< rtl::Reference<configuration::ElementTree> >& _rRemovedElements)
+ { return m_xStrategy->preCommitChanges(m_tree,_rRemovedElements); }
void finishCommit(SubtreeChange& rRootChange)
- { m_xStrategy->finishCommit(m_aTree,rRootChange); }
+ { m_xStrategy->finishCommit(m_tree,rRootChange); }
void revertCommit(SubtreeChange& rRootChange)
- { m_xStrategy->revertCommit(m_aTree,rRootChange); }
+ { m_xStrategy->revertCommit(m_tree,rRootChange); }
void recoverFailedCommit(SubtreeChange& rRootChange)
- { m_xStrategy->recoverFailedCommit(m_aTree,rRootChange); }
+ { m_xStrategy->recoverFailedCommit(m_tree,rRootChange); }
// notification protocol
public:
/// Adjust the internal representation after external changes to the original data - build NodeChangeInformation objects for notification
- void adjustToChanges(configuration::NodeChangesInformation& rLocalChanges, NodeArg _aNode, SubtreeChange const& aExternalChange)
+ void adjustToChanges(configuration::NodeChangesInformation& rLocalChanges, configuration::NodeRef const& _aNode, SubtreeChange const& aExternalChange)
{ m_xStrategy->adjustToChanges(rLocalChanges,makeNode(_aNode), aExternalChange); }
// visitor dispatch
@@ -154,18 +152,18 @@ namespace configmgr
public:
/// Does this node assume its default value
/// retrieve the current value of this node
- UnoAny getValue(ValueNode const& _aNode) const
+ com::sun::star::uno::Any getValue(ValueNode const& _aNode) const
{ return m_xStrategy->getValue(_aNode); }
#if OSL_DEBUG_LEVEL > 0
/// get the type of this value
- UnoType getValueType(ValueNode const& _aNode) const
+ com::sun::star::uno::Type getValueType(ValueNode const& _aNode) const
{ return m_xStrategy->getValueType(_aNode); }
#endif
// group node specific operations
public:
/// does this hold a child value of the given name
- bool hasValue(GroupNode const& _aNode, Name const& _aName) const
+ bool hasValue(GroupNode const& _aNode, rtl::OUString const& _aName) const
{ return m_xStrategy->hasValue(_aNode,_aName); }
/// does this hold a child value
@@ -177,11 +175,11 @@ namespace configmgr
{ return m_xStrategy->areValueDefaultsAvailable(_aNode); }
/// retrieve data for the child value of the given name
- configuration::ValueMemberNode getValue(GroupNode const& _aNode, Name const& _aName) const
+ configuration::ValueMemberNode getValue(GroupNode const& _aNode, rtl::OUString const& _aName) const
{ return m_xStrategy->getValue(_aNode,_aName); }
/// retrieve data for updating the child value of the given name
- configuration::ValueMemberUpdate getValueForUpdate(GroupNode const & _aNode, Name const& _aName) const
+ configuration::ValueMemberUpdate getValueForUpdate(GroupNode const & _aNode, rtl::OUString const& _aName) const
{ return m_xStrategy->getValueForUpdate(_aNode,_aName); }
// set node specific operations
@@ -191,19 +189,19 @@ namespace configmgr
{ return m_xStrategy->isEmpty(_aNode); }
/// does this set contain an element named <var>aName</var> (loads elements if needed)
- configuration::SetEntry findElement(SetNode const& _aNode, Name const& aName) const
+ configuration::SetEntry findElement(SetNode const& _aNode, rtl::OUString const& aName) const
{ return m_xStrategy->findElement(_aNode,aName); }
/// does this set contain an element named <var>aName</var> (and is that element loaded ?)
- configuration::SetEntry findAvailableElement(SetNode const& _aNode, Name const& aName) const
+ configuration::SetEntry findAvailableElement(SetNode const& _aNode, rtl::OUString const& aName) const
{ return m_xStrategy->findAvailableElement(_aNode,aName); }
/// insert a new entry into this set
- void insertElement(SetNode const& _aNode, Name const& aName, configuration::SetEntry const& aNewEntry)
+ void insertElement(SetNode const& _aNode, rtl::OUString const& aName, configuration::SetEntry const& aNewEntry)
{ m_xStrategy->insertElement(_aNode,aName,aNewEntry); }
/// remove an existing entry into this set
- void removeElement(SetNode const& _aNode, Name const& aName)
+ void removeElement(SetNode const& _aNode, rtl::OUString const& aName)
{ m_xStrategy->removeElement(_aNode,aName); }
/** Create a Subtree change as 'diff' which allows transforming the set to its default state
@@ -214,7 +212,7 @@ namespace configmgr
{ return m_xStrategy->differenceToDefaultState(_aNode,_rDefaultTree); }
/// Get the template that describes elements of this set
- configuration::TemplateHolder getElementTemplate(SetNode const& _aNode) const
+ rtl::Reference<configuration::Template> getElementTemplate(SetNode const& _aNode) const
{ return m_xStrategy->getElementTemplate(_aNode); }
/// Get a template provider that can create new elements for this set
@@ -227,25 +225,6 @@ namespace configmgr
// void makeDirect ();
};
-
-//-----------------------------------------------------------------------------
- inline
- ViewTreeAccess::ViewTreeAccess(Tree const & _aTree)
- : m_xStrategy()
- , m_aTree(_aTree)
- {
- m_xStrategy = _aTree.get_impl()->getViewBehavior();
- }
-
-//-----------------------------------------------------------------------------
- inline
- ViewTreeAccess::ViewTreeAccess(configuration::TreeImpl& _rTree)
- : m_xStrategy(_rTree.getViewBehavior())
- , m_aTree(_rTree)
- {
- }
-
-//-----------------------------------------------------------------------------
}
}
diff --git a/configmgr/source/treemgr/viewfactory.hxx b/configmgr/source/treemgr/viewfactory.hxx
index c6e937bf1c..e3a12fec39 100644
--- a/configmgr/source/treemgr/viewfactory.hxx
+++ b/configmgr/source/treemgr/viewfactory.hxx
@@ -40,14 +40,12 @@ namespace configmgr
{
// Different standard (static) strategies
//---------------------------------------------------------------------
- typedef rtl::Reference<ViewStrategy> ViewStrategyRef;
-
/// provides a factory for read-only node implementations
- ViewStrategyRef createReadOnlyStrategy();
+ rtl::Reference<ViewStrategy> createReadOnlyStrategy();
/// provides a factory for nodes that cache changes temporarily
- ViewStrategyRef createDeferredChangeStrategy();
+ rtl::Reference<ViewStrategy> createDeferredChangeStrategy();
/// provides a factory for immediately commiting node implementations
- ViewStrategyRef createDirectAccessStrategy(data::TreeSegment const & _aTreeSegment);
+ rtl::Reference<ViewStrategy> createDirectAccessStrategy(rtl::Reference< data::TreeSegment > const & _aTreeSegment);
//---------------------------------------------------------------------
}
diff --git a/configmgr/source/treemgr/viewnode.cxx b/configmgr/source/treemgr/viewnode.cxx
index b137e2f80d..f0f387961e 100644
--- a/configmgr/source/treemgr/viewnode.cxx
+++ b/configmgr/source/treemgr/viewnode.cxx
@@ -32,13 +32,10 @@
#include "precompiled_configmgr.hxx"
#include "viewnode.hxx"
-#include "valuenodeaccess.hxx"
-#include "groupnodeaccess.hxx"
-#include "setnodeaccess.hxx"
#include "setnodeimpl.hxx"
#include "groupnodeimpl.hxx"
#include "valuenodeimpl.hxx"
-#include "treeimpl.hxx"
+#include "tree.hxx"
#include "viewstrategy.hxx"
//-----------------------------------------------------------------------------
@@ -48,61 +45,59 @@ namespace configmgr
namespace view
{
//-----------------------------------------------------------------------------
- rtl::Reference< view::ViewStrategy > getViewBehavior(Tree const & _aTree)
+ rtl::Reference< view::ViewStrategy > getViewBehavior(configuration::Tree * _aTree)
{
- Tree::TreeData* pTreeData = _aTree.get_impl();
- return pTreeData->getViewBehavior();
+ return _aTree->getViewBehavior();
}
//-----------------------------------------------------------------------------
- static inline Node makeNode_(Tree const & _aTree, configuration::NodeOffset nOffset)
+ static inline Node makeNode_(configuration::Tree * _aTree, unsigned int nOffset)
{
- Tree::TreeData * pTreeData = _aTree.get_impl();
- return Node(_aTree, pTreeData->nodeData(nOffset));
+ return Node(_aTree, _aTree->nodeData(nOffset));
}
//-----------------------------------------------------------------------------
Node Node::getParent() const
{
- Tree::TreeData * pTreeData = this->tree().get_impl();
+ configuration::Tree * pTreeData = this->tree();
return makeNode_(tree(), pTreeData->parent_(this->get_offset()));
}
//-----------------------------------------------------------------------------
- Node GroupNode::findChild(configuration::Name const& _aName) const
+ Node GroupNode::findChild(rtl::OUString const& _aName) const
{
- Tree::TreeData * pTreeData = this->tree().get_impl();
+ configuration::Tree * pTreeData = this->tree();
return makeNode_(tree(), pTreeData->findChild_(node().get_offset(), _aName));
}
//-----------------------------------------------------------------------------
Node GroupNode::getFirstChild() const
{
- Tree::TreeData * pTreeData = this->tree().get_impl();
+ configuration::Tree * pTreeData = this->tree();
return makeNode_(tree(), pTreeData->firstChild_(node().get_offset()));
}
//-----------------------------------------------------------------------------
Node GroupNode::getNextChild(Node const& _aAfterNode) const
{
- Tree::TreeData * pTreeData = this->tree().get_impl();
+ configuration::Tree * pTreeData = this->tree();
OSL_ASSERT(pTreeData->parent_(_aAfterNode.get_offset()) == this->node().get_offset());
return makeNode_(tree(), pTreeData->findNextChild_(node().get_offset(),_aAfterNode.get_offset()));
}
//-----------------------------------------------------------------------------
- data::NodeAccess Node::getAccessRef() const
+ sharable::Node * Node::getAccessRef() const
{
return get_impl()->getOriginalNodeAccess();
}
//-----------------------------------------------------------------------------
- data::GroupNodeAccess GroupNode::getAccess() const
+ sharable::GroupNode * GroupNode::getAccess() const
{
return get_impl()->getDataAccess();
}
//-----------------------------------------------------------------------------
- data::SetNodeAccess SetNode::getAccess() const
+ sharable::SetNode * SetNode::getAccess() const
{
return get_impl()->getDataAccess();
}
diff --git a/configmgr/source/treemgr/viewnode.hxx b/configmgr/source/treemgr/viewnode.hxx
index 5c0c7cc27c..2b37f0b3bb 100644
--- a/configmgr/source/treemgr/viewnode.hxx
+++ b/configmgr/source/treemgr/viewnode.hxx
@@ -31,55 +31,28 @@
#ifndef CONFIGMGR_VIEWNODE_HXX_
#define CONFIGMGR_VIEWNODE_HXX_
-#include "treeimpl.hxx"
-
-#include "valuenodeaccess.hxx"
-#include "groupnodeaccess.hxx"
+#include "tree.hxx"
namespace configmgr
{
//-----------------------------------------------------------------------------
namespace configuration
{
- class Name;
struct ElementTreeData;
}
+ namespace sharable { struct GroupNode; }
//-----------------------------------------------------------------------------
namespace view
{
//-------------------------------------------------------------------------
- using configuration::Name;
- //-------------------------------------------------------------------------
- struct Tree // is a tree fragment
- {
- typedef configuration::TreeImpl TreeData;
-
- Tree(TreeData& _ref)
- : m_addr(&_ref)
- {}
-
- // low-level access
-// TreeData* operator->() const { return m_addr; }
-
- TreeData* get_impl() const
- { return m_addr; }
-
- private:
- TreeData * m_addr; // has a TreeAddress or NodeAddress
- };
- //-------------------------------------------------------------------------
struct Node
{
- typedef configuration::NodeOffset NodeOffset;
- typedef configuration::NodeData NodeData;
- typedef configuration::NodeImpl * NodeAddress;
-
- Node(Tree const& _tree, NodeData* _addr)
+ Node(configuration::Tree * _tree, configuration::NodeData* _addr)
: m_tree(_tree), m_addr(_addr)
{}
- Node(Tree::TreeData& _ref, NodeOffset _offs)
- : m_tree(_ref), m_addr( _ref.nodeData(_offs))
+ Node(configuration::Tree * _tree, unsigned int _offs)
+ : m_tree(_tree), m_addr( _tree->nodeData(_offs))
{}
bool is() const { return m_addr != 0; }
@@ -91,29 +64,28 @@ namespace configmgr
bool isValueNode() const { return is() && data().isValueElementNode(); }
// low-level access
-// NodeAddress operator->() const { return &data().nodeImpl(); }
+// configuration::NodeImpl * operator->() const { return &data().nodeImpl(); }
- NodeData& data() const { return *m_addr; }
+ configuration::NodeData& data() const { return *m_addr; }
- NodeAddress get_impl() const
+ configuration::NodeImpl * get_impl() const
{ return is() ? &data().nodeImpl() : NULL; }
- NodeOffset get_offset() const
- { return is() ? m_tree.get_impl()->nodeOffset( this->data() ) : 0; }
+ unsigned int get_offset() const
+ { return is() ? m_tree->nodeOffset( this->data() ) : 0; }
- Tree tree() const // has a Tree
+ configuration::Tree * tree() const // has a tree
{ return m_tree; }
- data::NodeAccess getAccessRef() const; // has a NodeAccess
+ sharable::Node * getAccessRef() const; // has a Node
private:
- Tree m_tree; // has a Tree + Accessor
- NodeData* m_addr; // has a NodeAddress
+ configuration::Tree * m_tree; // has a Tree + Accessor
+ configuration::NodeData* m_addr; // has a configuration::NodeImpl *
};
//-------------------------------------------------------------------------
struct ValueNode // has/is a Node
{
- typedef configuration::ValueElementNodeImpl NodeType;
Node m_node;
explicit
@@ -124,21 +96,20 @@ namespace configmgr
bool is() const { return m_node.isValueNode(); }
// low-level access
- // NodeType* operator->() const { return &m_node.data().valueElementImpl(); }
+ // configuration::ValueElementNodeImpl* operator->() const { return &m_node.data().valueElementImpl(); }
- NodeType* get_impl() const
+ configuration::ValueElementNodeImpl* get_impl() const
{ return is() ? &m_node.data().valueElementImpl() : NULL; }
Node node() const // has a Node
{ return m_node; }
- Tree tree() const // has a Tree
+ configuration::Tree * tree() const // has a tree
{ return m_node.tree(); }
};
//-------------------------------------------------------------------------
struct GroupNode // has/is a Node
{
- typedef configuration::GroupNodeImpl NodeType;
Node m_node;
explicit
@@ -148,29 +119,26 @@ namespace configmgr
bool is() const { return m_node.isGroupNode(); }
- Node findChild(configuration::Name const& _aName) const;
+ Node findChild(rtl::OUString const& _aName) const;
Node getFirstChild() const;
Node getNextChild(Node const& _aAfterNode) const;
-// NodeType* operator->() const { return &m_node.data().groupImpl(); }
+// configuration::GroupNodeImpl* operator->() const { return &m_node.data().groupImpl(); }
- NodeType* get_impl() const
+ configuration::GroupNodeImpl* get_impl() const
{ return is() ? &m_node.data().groupImpl() : NULL; }
Node node() const // has a Node
{ return m_node; }
- Tree tree() const // has a Tree
+ configuration::Tree * tree() const // has a tree
{ return m_node.tree(); }
- data::GroupNodeAccess getAccess() const; // has a NodeAccess
+ sharable::GroupNode * getAccess() const; // has a GroupNode
};
//-------------------------------------------------------------------------
struct SetNode // has/is a Node
{
- typedef configuration::SetNodeImpl NodeType;
- typedef configuration::ElementTreeData Element;
-
Node m_node;
explicit
@@ -180,54 +148,52 @@ namespace configmgr
bool is() const { return m_node.isSetNode(); }
- // NodeType* operator->() const { return &m_node.data().setImpl(); }
+ // configuration::SetNodeImpl* operator->() const { return &m_node.data().setImpl(); }
- NodeType* get_impl() const
+ configuration::SetNodeImpl* get_impl() const
{ return is() ? &m_node.data().setImpl() : 0; }
Node node() const // has a Node
{ return m_node; }
- Tree tree() const // has a Tree
+ configuration::Tree * tree() const // has a tree
{ return m_node.tree(); }
- data::SetNodeAccess getAccess() const; // has a NodeAccess
+ sharable::SetNode * getAccess() const; // has a SetNode
};
//-------------------------------------------------------------------------
inline
- Node getRootNode(Tree const & _aTree)
+ Node getRootNode(configuration::Tree * _aTree)
{
- Tree::TreeData* pTreeData = _aTree.get_impl();
- return Node(_aTree,pTreeData->nodeData(pTreeData->root_()));
+ return Node(_aTree,_aTree->nodeData(configuration::Tree::ROOT));
}
//-------------------------------------------------------------------------
inline
- Name getSimpleRootName(Tree const & _aTree)
+ rtl::OUString getSimpleRootName(configuration::Tree * _aTree)
{
- Tree::TreeData* pTreeData = _aTree.get_impl();
- return pTreeData->getSimpleRootName();
+ return _aTree->getSimpleRootName();
}
//-------------------------------------------------------------------------
inline
bool isValidNode(Node const & _aNode)
{
- Tree::TreeData* pTreeData = _aNode.tree().get_impl();
+ configuration::Tree* pTreeData = _aNode.tree();
return pTreeData->isValidNode(_aNode.get_offset());
}
//-------------------------------------------------------------------------
inline
- Name getSimpleNodeName(Node const & _aNode)
+ rtl::OUString getSimpleNodeName(Node const & _aNode)
{
- Tree::TreeData* pTreeData = _aNode.tree().get_impl();
+ configuration::Tree* pTreeData = _aNode.tree();
return pTreeData->getSimpleNodeName(_aNode.get_offset());
}
//-------------------------------------------------------------------------
extern
- rtl::Reference< view::ViewStrategy > getViewBehavior(Tree const & _aTree);
+ rtl::Reference< view::ViewStrategy > getViewBehavior(configuration::Tree * _aTree);
//-------------------------------------------------------------------------
}
//-----------------------------------------------------------------------------
diff --git a/configmgr/source/treemgr/viewstrategy.cxx b/configmgr/source/treemgr/viewstrategy.cxx
index f8e9ed7333..0b0fa04229 100644
--- a/configmgr/source/treemgr/viewstrategy.cxx
+++ b/configmgr/source/treemgr/viewstrategy.cxx
@@ -37,8 +37,6 @@
#include "setnodeimpl.hxx"
#include "change.hxx"
#include "nodevisitor.hxx"
-#include "groupnodeaccess.hxx"
-#include "setnodeaccess.hxx"
#include "nodechange.hxx"
#include "nodechangeimpl.hxx"
#include "nodeconverter.hxx"
@@ -49,44 +47,39 @@ namespace configmgr
namespace view
{
//-----------------------------------------------------------------------------
- using configuration::SetEntry;
- using configuration::ElementList;
- using configuration::GroupMemberVisitor;
- using configuration::SetNodeVisitor;
-
static
inline
- data::ValueNodeAccess getMemberValueAccess( GroupNode const & _aGroupNode, Name const & _aName )
+ sharable::ValueNode * getMemberValueAccess( GroupNode const & _aGroupNode, rtl::OUString const & _aName )
{
configuration::GroupNodeImpl* pGroupData = _aGroupNode.get_impl();
return pGroupData->getOriginalValueNode(_aName);
}
//-----------------------------------------------------------------------------
- void ViewStrategy::checkInstance(Tree const& _aTreeForThis) const
+ void ViewStrategy::checkInstance(configuration::Tree * tree) const
{
- { (void)_aTreeForThis; }
- OSL_ENSURE( getViewBehavior(_aTreeForThis).get() == this,
+ (void) tree; // avoid warnings
+ OSL_ENSURE( getViewBehavior(tree).get() == this,
"Tree operation dispatched to wrong strategy instance");
}
//-----------------------------------------------------------------------------
- void ViewStrategy::collectChanges(Tree const& _aTree, NodeChanges& rChanges) const
+ void ViewStrategy::collectChanges(configuration::Tree * tree, configuration::NodeChanges& rChanges) const
{
- checkInstance(_aTree);
- doCollectChanges( getRootNode(_aTree), rChanges );
+ checkInstance(tree);
+ doCollectChanges( getRootNode(tree), rChanges );
}
- bool ViewStrategy::hasChanges(Tree const& _aTree) const
+ bool ViewStrategy::hasChanges(configuration::Tree * tree) const
{
- checkInstance(_aTree);
- return hasChanges( getRootNode(_aTree) );
+ checkInstance(tree);
+ return hasChanges( getRootNode(tree) );
}
// mark the given node and all its ancestors (we can stop when we hit a node that already is marked)
void ViewStrategy::markChanged(Node const& _aNode)
{
- Tree aTree = _aNode.tree();
- checkInstance(aTree);
+ configuration::Tree * tree = _aNode.tree();
+ checkInstance(tree);
Node aNode = _aNode;
if (aNode.is())
@@ -102,59 +95,58 @@ namespace configmgr
if (!aNode.is()) // just marked the root
{
- configuration::TreeImpl* pTreeData = aTree.get_impl();
- configuration::TreeImpl* pContext = pTreeData->getContextTree();
- NodeOffset nContext = pTreeData->getContextNode();
+ configuration::Tree* pContext = tree->getContextTree();
+ unsigned int nContext = tree->getContextNode();
if (pContext)
{
OSL_ASSERT(pContext->isValidNode(nContext));
- view::Node aContextNode(*pContext,nContext);
+ view::Node aContextNode(pContext,nContext);
pContext->getViewBehavior()->markChanged(aContextNode);
}
}
}
//-----------------------------------------------------------------------------
- std::auto_ptr<SubtreeChange> ViewStrategy::preCommitChanges(Tree const& _aTree, ElementList& _rRemovedElements)
+ std::auto_ptr<SubtreeChange> ViewStrategy::preCommitChanges(configuration::Tree * tree, std::vector< rtl::Reference<configuration::ElementTree> >& _rRemovedElements)
{
- checkInstance(_aTree);
- return doPreCommitChanges( _aTree, _rRemovedElements);
+ checkInstance(tree);
+ return doPreCommitChanges( tree, _rRemovedElements);
}
- void ViewStrategy::finishCommit(Tree const& _aTree, SubtreeChange& rRootChange)
+ void ViewStrategy::finishCommit(configuration::Tree * tree, SubtreeChange& rRootChange)
{
- checkInstance(_aTree);
- doFinishCommit(_aTree, rRootChange);
+ checkInstance(tree);
+ doFinishCommit(tree, rRootChange);
}
- void ViewStrategy::revertCommit(Tree const& _aTree, SubtreeChange& rRootChange)
+ void ViewStrategy::revertCommit(configuration::Tree * tree, SubtreeChange& rRootChange)
{
- checkInstance(_aTree);
- doRevertCommit(_aTree, rRootChange);
+ checkInstance(tree);
+ doRevertCommit(tree, rRootChange);
}
- void ViewStrategy::recoverFailedCommit(Tree const& _aTree, SubtreeChange& rRootChange)
+ void ViewStrategy::recoverFailedCommit(configuration::Tree * tree, SubtreeChange& rRootChange)
{
- checkInstance(_aTree);
- doFailedCommit(_aTree, rRootChange);
+ checkInstance(tree);
+ doFailedCommit(tree, rRootChange);
}
//-----------------------------------------------------------------------------
- void ViewStrategy::adjustToChanges(NodeChangesInformation& rLocalChanges, Node const& _aNode, SubtreeChange const& aExternalChange)
+ void ViewStrategy::adjustToChanges(configuration::NodeChangesInformation& rLocalChanges, Node const& _aNode, SubtreeChange const& aExternalChange)
{
OSL_PRECOND( isValidNode(_aNode), "ERROR: Valid node required for adjusting to changes" );
- OSL_PRECOND( getSimpleNodeName(_aNode).toString() == aExternalChange.getNodeName(), "Name of change does not match actual node" );
+ OSL_PRECOND( getSimpleNodeName(_aNode) == aExternalChange.getNodeName(), "name of change does not match actual node" );
checkInstance(_aNode.tree());
- configuration::TreeImpl * pTreeData = _aNode.tree().get_impl();
+ configuration::Tree * pTreeData = _aNode.tree();
if (_aNode.isSetNode())
{
OSL_ENSURE(aExternalChange.isSetNodeChange(),"ERROR: Change type GROUP does not match set");
- TreeDepth nDepth = pTreeData->getRemainingDepth(_aNode.get_offset());
+ unsigned int nDepth = pTreeData->getRemainingDepth(_aNode.get_offset());
implAdjustToElementChanges( rLocalChanges, SetNode(_aNode), aExternalChange, nDepth);
}
@@ -169,9 +161,9 @@ namespace configmgr
}
else // might occur on external change (?)
{
- OSL_ENSURE(_aNode.isValueNode(), "TreeImpl: Unknown node type to adjust to changes");
+ OSL_ENSURE(_aNode.isValueNode(), "Tree: Unknown node type to adjust to changes");
- OSL_ENSURE(_aNode.get_offset() == pTreeData->root_(), "TreeImpl: Unexpected node type - non-root value element");
+ OSL_ENSURE(_aNode.get_offset() == configuration::Tree::ROOT, "Tree: Unexpected node type - non-root value element");
OSL_ENSURE(false,"ERROR: Change type does not match node: Trying to apply subtree change to value element.");
}
@@ -179,7 +171,7 @@ namespace configmgr
//-----------------------------------------------------------------------------
- void ViewStrategy::addLocalChangeHelper( NodeChangesInformation& rLocalChanges_, configuration::NodeChange const& aChange_)
+ void ViewStrategy::addLocalChangeHelper( configuration::NodeChangesInformation& rLocalChanges_, configuration::NodeChange const& aChange_)
{
aChange_.getChangeInfos(rLocalChanges_);
}
@@ -187,59 +179,53 @@ namespace configmgr
//-----------------------------------------------------------------------------
// TO DO: create CommitAction class, which is returned by precommit (if applicable)
- std::auto_ptr<SubtreeChange> ViewStrategy::doPreCommitChanges(Tree const& _aTree, configuration::ElementList& )
+ std::auto_ptr<SubtreeChange> ViewStrategy::doPreCommitChanges(configuration::Tree * tree, std::vector< rtl::Reference<configuration::ElementTree> >& )
{
- { (void)_aTree; }
- OSL_ENSURE(!hasChanges(getRootNode(_aTree)),"Unexpected changes in View");
+ (void) tree; // avoid warnings
+ OSL_ENSURE(!hasChanges(getRootNode(tree)),"Unexpected changes in View");
return std::auto_ptr<SubtreeChange>();
}
- void ViewStrategy::doFinishCommit(Tree const& _aTree, SubtreeChange& )
+ void ViewStrategy::doFinishCommit(configuration::Tree * tree, SubtreeChange& )
{
- { (void)_aTree; }
- OSL_ENSURE(!hasChanges(getRootNode(_aTree)),"Unexpected changes in View");
+ (void) tree; // avoid warnings
+ OSL_ENSURE(!hasChanges(getRootNode(tree)),"Unexpected changes in View");
OSL_ENSURE(false,"ERROR: Cannot finish commit for unexpected changes");
}
- void ViewStrategy::doRevertCommit(Tree const& _aTree, SubtreeChange& )
+ void ViewStrategy::doRevertCommit(configuration::Tree * tree, SubtreeChange& )
{
- { (void)_aTree; }
- OSL_ENSURE(!hasChanges(getRootNode(_aTree)),"Unexpected changes in View");
+ (void) tree; // avoid warnings
+ OSL_ENSURE(!hasChanges(getRootNode(tree)),"Unexpected changes in View");
OSL_ENSURE(false,"ERROR: Cannot revert commit for unexpected changes");
}
- void ViewStrategy::doFailedCommit(Tree const& _aTree, SubtreeChange& )
+ void ViewStrategy::doFailedCommit(configuration::Tree * tree, SubtreeChange& )
{
- { (void)_aTree; }
- OSL_ENSURE(!hasChanges(getRootNode(_aTree)),"Unexpected changes in View");
+ (void) tree; // avoid warnings
+ OSL_ENSURE(!hasChanges(getRootNode(tree)),"Unexpected changes in View");
OSL_ENSURE(false,"ERROR: Cannot recover commit for unexpected changes");
}
//-----------------------------------------------------------------------------
- void ViewStrategy::implAdjustToElementChange(NodeChangesInformation& rLocalChanges, SetNode const& _aSetNode, Change const& rElementChange, TreeDepth nDepth)
+ void ViewStrategy::implAdjustToElementChange(configuration::NodeChangesInformation& rLocalChanges, SetNode const& _aSetNode, Change const& rElementChange, unsigned int nDepth)
{
- using namespace configuration;
-
- SetNodeImpl * pSetData = _aSetNode.get_impl();
+ configuration::SetNodeImpl * pSetData = _aSetNode.get_impl();
OSL_ENSURE( pSetData->implHasLoadedElements() , "Unexpected call: Processing element change in uninitialized set");
- Name aName = makeElementName( rElementChange.getNodeName(), Name::NoValidate() );
+ rtl::OUString aName( rElementChange.getNodeName() );
- SetElementChangeImpl* pThisChange = 0;
- if (rElementChange.ISA(AddNode))
+ configuration::SetElementChangeImpl* pThisChange = 0;
+ if (AddNode const * addNode = dynamic_cast< AddNode const *>(&rElementChange))
{
- AddNode const& aAddNode = static_cast<AddNode const&>(rElementChange);
-
- SetNodeElement aNewElement = pSetData->makeAdditionalElement(this,aAddNode,nDepth);
+ configuration::ElementTreeData aNewElement = pSetData->makeAdditionalElement(this, *addNode, nDepth);
- pThisChange = pSetData->doAdjustToAddedElement(aName, aAddNode,aNewElement);
+ pThisChange = pSetData->doAdjustToAddedElement(aName, *addNode, aNewElement);
}
- else if (rElementChange.ISA(RemoveNode))
+ else if (RemoveNode const * removeNode = dynamic_cast< RemoveNode const * >(&rElementChange))
{
- RemoveNode const& aRemoveNode = static_cast<RemoveNode const&>(rElementChange);
-
- pThisChange = pSetData->doAdjustToRemovedElement(aName, aRemoveNode);
+ pThisChange = pSetData->doAdjustToRemovedElement(aName, *removeNode);
}
else
{
@@ -251,11 +237,11 @@ namespace configmgr
if (pThisChange)
{
- addLocalChangeHelper( rLocalChanges, NodeChange(pThisChange) );
+ addLocalChangeHelper( rLocalChanges, configuration::NodeChange(pThisChange) );
}
}
- void ViewStrategy::implAdjustToElementChanges(NodeChangesInformation& rLocalChanges, SetNode const& _aSetNode, SubtreeChange const& rExternalChanges, TreeDepth nDepth)
+ void ViewStrategy::implAdjustToElementChanges(configuration::NodeChangesInformation& rLocalChanges, SetNode const& _aSetNode, SubtreeChange const& rExternalChanges, unsigned int nDepth)
{
if (nDepth > 0)
@@ -266,7 +252,7 @@ namespace configmgr
if (pSetData->implHasLoadedElements())
{
- TreeDepth const nElementDepth = configuration::childDepth(nDepth);
+ unsigned int const nElementDepth = configuration::childDepth(nDepth);
for (SubtreeChange::ChildIterator it = rExternalChanges.begin(); it != rExternalChanges.end(); ++it)
{
this->implAdjustToElementChange(rLocalChanges, _aSetNode, *it, nElementDepth);
@@ -281,33 +267,31 @@ namespace configmgr
}
}
- configuration::ValueChangeImpl* ViewStrategy::doAdjustToValueChange(GroupNode const& _aGroupNode, Name const& _aName, ValueChange const& _rExternalChange)
+ configuration::ValueChangeImpl* ViewStrategy::doAdjustToValueChange(GroupNode const& _aGroupNode, rtl::OUString const& _aName, ValueChange const& _rExternalChange)
{
- using namespace configuration;
+ configuration::ValueChangeImpl* pChangeImpl = NULL;
- ValueChangeImpl* pChangeImpl = NULL;
-
- data::ValueNodeAccess aLocalNode = getMemberValueAccess(_aGroupNode,_aName);
- if (aLocalNode.isValid())
+ sharable::ValueNode * localNode = getMemberValueAccess(_aGroupNode,_aName);
+ if (localNode != 0)
{
switch( _rExternalChange. getMode() )
{
case ValueChange::wasDefault:
case ValueChange::changeValue:
- pChangeImpl = new ValueReplaceImpl( _rExternalChange.getNewValue(), _rExternalChange.getOldValue() );
+ pChangeImpl = new configuration::ValueReplaceImpl( _rExternalChange.getNewValue(), _rExternalChange.getOldValue() );
break;
case ValueChange::setToDefault:
- pChangeImpl = new ValueResetImpl( _rExternalChange.getNewValue(), _rExternalChange.getOldValue() );
+ pChangeImpl = new configuration::ValueResetImpl( _rExternalChange.getNewValue(), _rExternalChange.getOldValue() );
break;
default: OSL_ENSURE(false, "Unknown change mode");
// fall thru to next case for somewhat meaningful return value
case ValueChange::changeDefault:
{
- UnoAny aLocalValue = aLocalNode.getValue();
+ com::sun::star::uno::Any aLocalValue = localNode->getValue();
- pChangeImpl = new ValueReplaceImpl( aLocalValue, aLocalValue );
+ pChangeImpl = new configuration::ValueReplaceImpl( aLocalValue, aLocalValue );
}
break;
}
@@ -321,61 +305,55 @@ namespace configmgr
return pChangeImpl;
}
- void ViewStrategy::implAdjustToValueChanges(NodeChangesInformation& rLocalChanges, GroupNode const& _aGroupNode, SubtreeChange const& rExternalChanges)
+ void ViewStrategy::implAdjustToValueChanges(configuration::NodeChangesInformation& rLocalChanges, GroupNode const& _aGroupNode, SubtreeChange const& rExternalChanges)
{
for (SubtreeChange::ChildIterator it = rExternalChanges.begin(); it != rExternalChanges.end(); ++it)
{
- using namespace configuration;
-
- if (it->ISA(ValueChange))
+ if (ValueChange const * valueChange = dynamic_cast< ValueChange const * >(&*it))
{
- ValueChange const& rValueChange = static_cast<ValueChange const&>(*it);
+ rtl::OUString aValueName( valueChange->getNodeName() );
- Name aValueName = makeNodeName( rValueChange.getNodeName(), Name::NoValidate() );
-
- if (ValueChangeImpl* pThisChange = doAdjustToValueChange(_aGroupNode, aValueName, rValueChange))
+ if (configuration::ValueChangeImpl* pThisChange = doAdjustToValueChange(_aGroupNode, aValueName, *valueChange))
{
pThisChange->setTarget(_aGroupNode,aValueName);
- addLocalChangeHelper(rLocalChanges, NodeChange(pThisChange));
+ addLocalChangeHelper(rLocalChanges, configuration::NodeChange(pThisChange));
}
else
OSL_TRACE("WARNING: Configuration: derived class hides an external value member change from listeners");
}
else
- OSL_ENSURE(it->ISA(SubtreeChange), "Unexpected change type within group");
+ OSL_ENSURE(dynamic_cast< SubtreeChange const * >(&*it) != 0, "Unexpected change type within group");
}
}
- void ViewStrategy::implAdjustToSubChanges(NodeChangesInformation& rLocalChanges, GroupNode const& _aGroupNode, SubtreeChange const& rExternalChanges)
+ void ViewStrategy::implAdjustToSubChanges(configuration::NodeChangesInformation& rLocalChanges, GroupNode const& _aGroupNode, SubtreeChange const& rExternalChanges)
{
- using namespace configuration;
-
#if (OSL_DEBUG_LEVEL > 0)
- TreeImpl * pTreeData = _aGroupNode.tree().get_impl();
+ configuration::Tree * pTreeData = _aGroupNode.tree();
#endif
for(SubtreeChange::ChildIterator it = rExternalChanges.begin(); it != rExternalChanges.end(); ++it)
{
- if ( it->ISA(SubtreeChange) )
+ if (SubtreeChange const * subtreeChange = dynamic_cast< SubtreeChange const * >(&*it))
{
- Node aSubNode = _aGroupNode.findChild( makeNodeName(it->getNodeName(), Name::NoValidate()) );
+ Node aSubNode = _aGroupNode.findChild( it->getNodeName() );
OSL_ENSURE( aSubNode.is() || pTreeData->depthTo(_aGroupNode.node().get_offset()) >= pTreeData->getAvailableDepth(), "Changed node not found in tree");
if (aSubNode.is())
{
OSL_ENSURE( pTreeData->getRemainingDepth(_aGroupNode.node().get_offset()) > 0, "Depth is smaller than expected for tree");
- this->adjustToChanges(rLocalChanges, aSubNode, static_cast<SubtreeChange const&>(*it));
+ this->adjustToChanges(rLocalChanges, aSubNode, *subtreeChange);
}
}
else
{
- OSL_ENSURE(it->ISA(ValueChange), "Unexpected change type for child of group node; change is ignored");
- OSL_ENSURE( !_aGroupNode.findChild(makeNodeName(it->getNodeName(), Name::NoValidate())).is(),
+ OSL_ENSURE(dynamic_cast< ValueChange const * >(&*it) != 0, "Unexpected change type for child of group node; change is ignored");
+ OSL_ENSURE( !_aGroupNode.findChild(it->getNodeName()).is(),
"Found sub(tree) node where a value was expected");
}
}
}
//-----------------------------------------------------------------------------
- void ViewStrategy::doCollectChanges(Node const& _aNode, NodeChanges& ) const
+ void ViewStrategy::doCollectChanges(Node const& _aNode, configuration::NodeChanges& ) const
{
{ (void)_aNode; }
// no-op: there are no changes to collect
@@ -384,13 +362,13 @@ namespace configmgr
//-----------------------------------------------------------------------------
- UnoAny ViewStrategy::getValue(ValueNode const& _aNode) const
+ com::sun::star::uno::Any ViewStrategy::getValue(ValueNode const& _aNode) const
{
checkInstance(_aNode.tree());
return _aNode.get_impl()->getValue();
}
#if OSL_DEBUG_LEVEL > 0
- UnoType ViewStrategy::getValueType(ValueNode const& _aNode) const
+ com::sun::star::uno::Type ViewStrategy::getValueType(ValueNode const& _aNode) const
{
checkInstance(_aNode.tree());
return _aNode.get_impl()->getValueType();
@@ -401,94 +379,82 @@ namespace configmgr
//-----------------------------------------------------------------------------
namespace { // helpers
- using configuration::GroupMemberVisitor;
-
struct GroupMemberDispatch : data::NodeVisitor
{
- GroupMemberDispatch(ViewStrategy& _rStrategy, GroupNode const& _aGroup, GroupMemberVisitor& rVisitor)
+ GroupMemberDispatch(ViewStrategy& _rStrategy, GroupNode const& _aGroup, configuration::GroupMemberVisitor& rVisitor)
: m_rStrategy(_rStrategy)
, m_aGroup(_aGroup)
, m_rVisitor(rVisitor)
{}
- static Result mapResult(GroupMemberVisitor::Result _aResult)
+ static bool mapResult(configuration::GroupMemberVisitor::Result _aResult)
{
-
- OSL_ASSERT( DONE == Result(GroupMemberVisitor::DONE) );
- OSL_ASSERT( CONTINUE == Result(GroupMemberVisitor::CONTINUE) );
- return Result(_aResult);
+ return _aResult == configuration::GroupMemberVisitor::DONE;
}
- static GroupMemberVisitor::Result unmapResult(Result _aResult)
+ static configuration::GroupMemberVisitor::Result unmapResult(bool done)
{
- OSL_ASSERT( DONE == Result(GroupMemberVisitor::DONE) );
- OSL_ASSERT( CONTINUE == Result(GroupMemberVisitor::CONTINUE) );
- return GroupMemberVisitor::Result(_aResult);
+ return done
+ ? configuration::GroupMemberVisitor::DONE
+ : configuration::GroupMemberVisitor::CONTINUE;
}
- virtual Result handle(data::ValueNodeAccess const& _aValue);
- virtual Result handle(data::NodeAccess const& _aNonValue);
+ using NodeVisitor::handle;
+ virtual bool handle(sharable::Node * node);
+ virtual bool handle(sharable::ValueNode * node);
#if (OSL_DEBUG_LEVEL > 0)
- bool test_value(data::NodeAccess const & _aNode) const;
+ bool test_value(sharable::Node * node) const;
#endif
ViewStrategy& m_rStrategy;
GroupNode m_aGroup;
- GroupMemberVisitor& m_rVisitor;
+ configuration::GroupMemberVisitor& m_rVisitor;
- GroupMemberVisitor::Result m_aResult;
-
- protected:
- using NodeVisitor::handle;
+ configuration::GroupMemberVisitor::Result m_aResult;
};
#if (OSL_DEBUG_LEVEL > 0)
- bool GroupMemberDispatch::test_value(data::NodeAccess const& _aNode) const
+ bool GroupMemberDispatch::test_value(sharable::Node * node) const
{
- Name aName = _aNode.getName();
-
- return m_rStrategy.hasValue( m_aGroup, aName );
+ return m_rStrategy.hasValue(m_aGroup, node->getName());
}
#endif
- GroupMemberDispatch::Result GroupMemberDispatch::handle(data::ValueNodeAccess const& _aValue)
+ bool GroupMemberDispatch::handle(sharable::ValueNode * node)
{
- OSL_ENSURE( test_value(_aValue), "ERROR: Group MemberDispatch:Did not find a ValueMember for a value child.");
+ OSL_ENSURE( test_value(sharable::node(node)), "ERROR: Group MemberDispatch:Did not find a ValueMember for a value child.");
- Name aValueName = _aValue.getName();
+ rtl::OUString aValueName = node->info.getName();
return mapResult( m_rVisitor.visit( m_rStrategy.getValue(m_aGroup,aValueName) ) );
}
- GroupMemberDispatch::Result GroupMemberDispatch::handle(data::NodeAccess const& _aNonValue)
- {
- { (void)_aNonValue; }
- OSL_ENSURE( !test_value(_aNonValue), "ERROR: Group MemberDispatch:Found a ValueMember for a subtree child.");
+ bool GroupMemberDispatch::handle(sharable::Node * node)
+ {
+ (void) node; // avoid warnings
+ OSL_ENSURE( !test_value(node), "ERROR: Group MemberDispatch:Found a ValueMember for a subtree child.");
- return CONTINUE;
+ return false;
}
}
//-----------------------------------------------------------------------------
- configuration::ValueMemberNode ViewStrategy::doGetValueMember(GroupNode const& _aNode, Name const& _aName, bool ) const
+ configuration::ValueMemberNode ViewStrategy::doGetValueMember(GroupNode const& _aNode, rtl::OUString const& _aName, bool ) const
{
- using data::ValueNodeAccess;
-
- ValueNodeAccess aValueData = getMemberValueAccess(_aNode,_aName);
-
- return _aNode.get_impl()->makeValueMember( aValueData );
+ sharable::ValueNode * valueData = getMemberValueAccess(_aNode,_aName);
+ return _aNode.get_impl()->makeValueMember(valueData);
}
- bool ViewStrategy::hasValue(GroupNode const& _aNode, Name const& _aName) const
+ bool ViewStrategy::hasValue(GroupNode const& _aNode, rtl::OUString const& _aName) const
{
checkInstance(_aNode.tree());
- return getMemberValueAccess(_aNode,_aName).isValid();
+ return getMemberValueAccess(_aNode,_aName) != 0;
}
bool ViewStrategy::hasValue(GroupNode const& _aNode) const
{
checkInstance(_aNode.tree());
configuration::GroupNodeImpl* pGroupNode=_aNode.get_impl();
- data::GroupNodeAccess aGroupNodeAccess = pGroupNode->getDataAccess();
- return aGroupNodeAccess.hasChildren();
+ sharable::GroupNode * group = pGroupNode->getDataAccess();
+ return group->numDescendants > 0;
}
@@ -499,72 +465,72 @@ namespace configmgr
return _aNode.get_impl()->areValueDefaultsAvailable();
}
- configuration::ValueMemberNode ViewStrategy::getValue(GroupNode const& _aNode, Name const& _aName) const
+ configuration::ValueMemberNode ViewStrategy::getValue(GroupNode const& _aNode, rtl::OUString const& _aName) const
{
checkInstance(_aNode.tree());
return doGetValueMember(_aNode,_aName,false);
}
- configuration::ValueMemberUpdate ViewStrategy::getValueForUpdate(GroupNode const & _aNode, Name const& _aName)
+ configuration::ValueMemberUpdate ViewStrategy::getValueForUpdate(GroupNode const & _aNode, rtl::OUString const& _aName)
{
checkInstance(_aNode.tree());
- return ValueMemberUpdate( doGetValueMember(_aNode,_aName,true), *this );
+ return configuration::ValueMemberUpdate( doGetValueMember(_aNode,_aName,true), *this );
}
- GroupMemberVisitor::Result ViewStrategy::dispatchToValues(GroupNode const& _aNode, GroupMemberVisitor& _aVisitor)
+ configuration::GroupMemberVisitor::Result ViewStrategy::dispatchToValues(GroupNode const& _aNode, configuration::GroupMemberVisitor& _aVisitor)
{
checkInstance(_aNode.tree());
GroupMemberDispatch aDispatch(*this,_aNode,_aVisitor);
- GroupMemberDispatch::Result eResult = aDispatch.visitChildren( _aNode.getAccess() );
+ bool done = aDispatch.visitChildren( _aNode.getAccess() );
- return aDispatch.unmapResult(eResult);
+ return aDispatch.unmapResult(done);
}
//-----------------------------------------------------------------------------
- ViewStrategy::SetNodeElement ViewStrategy::implMakeElement(SetNode const& _aNode, SetNodeEntry const& anEntry) const
+ configuration::ElementTreeData ViewStrategy::implMakeElement(SetNode const& _aNode, configuration::SetEntry const& anEntry) const
{
configuration::SetNodeImpl * pNodeData = _aNode.get_impl();
return pNodeData->implValidateElement(pNodeData->entryToElement(anEntry));
}
//-----------------------------------------------------------------------------
- SetEntry ViewStrategy::implFindElement(SetNode const& _aNode, Name const& aName) const
+ configuration::SetEntry ViewStrategy::implFindElement(SetNode const& _aNode, rtl::OUString const& aName) const
{
configuration::SetNodeImpl * pNodeData = _aNode.get_impl();
OSL_ENSURE(pNodeData->implHasLoadedElements(),"Cannot find elements in set that is not loaded");
- configuration::ElementTreeImpl * pElement = pNodeData->doFindElement(aName);
+ configuration::ElementTree * pElement = pNodeData->doFindElement(aName);
- return SetEntry(pElement);
+ return configuration::SetEntry(pElement);
}
- SetEntry ViewStrategy::findElement(SetNode const& _aNode, Name const& aName) const
+ configuration::SetEntry ViewStrategy::findElement(SetNode const& _aNode, rtl::OUString const& aName) const
{
checkInstance(_aNode.tree());
_aNode.get_impl()->implEnsureElementsLoaded();
return implFindElement(_aNode,aName);
}
- SetEntry ViewStrategy::findAvailableElement(SetNode const& _aNode, Name const& aName) const
+ configuration::SetEntry ViewStrategy::findAvailableElement(SetNode const& _aNode, rtl::OUString const& aName) const
{
checkInstance(_aNode.tree());
if (_aNode.get_impl()->implHasLoadedElements())
return implFindElement(_aNode,aName);
else
- return SetEntry(0);
+ return configuration::SetEntry(0);
}
static
inline
- std::auto_ptr<SubtreeChange> makeChangeToDefault(data::SetNodeAccess const & _aSetNode)
+ std::auto_ptr<SubtreeChange> makeChangeToDefault(sharable::SetNode * setNode)
{
return std::auto_ptr<SubtreeChange>(
new SubtreeChange(
- _aSetNode.getName().toString(),
- _aSetNode.getElementTemplateName().toString(),
- _aSetNode.getElementTemplateModule().toString(),
- _aSetNode.getAttributes(),
+ setNode->info.getName(),
+ setNode->getElementTemplateName(),
+ setNode->getElementTemplateModule(),
+ sharable::node(setNode)->getAttributes(),
true // to default
) );
}
@@ -574,12 +540,11 @@ namespace configmgr
checkInstance(_aNode.tree());
std::auto_ptr<SubtreeChange> aResult;
- data::SetNodeAccess aOriginalSetNode = _aNode.getAccess();
- if (!aOriginalSetNode.isDefault())
+ sharable::SetNode * originalSetNode = _aNode.getAccess();
+ OSL_ASSERT(originalSetNode != 0);
+ if (!originalSetNode->info.isDefault())
{
- OSL_ASSERT(aOriginalSetNode.isValid());
-
- aResult = makeChangeToDefault( aOriginalSetNode );
+ aResult = makeChangeToDefault(originalSetNode);
configuration::SetNodeImpl * pNodeData = _aNode.get_impl();
if (this->hasChanges(_aNode.node()))
@@ -593,7 +558,7 @@ namespace configmgr
return aResult;
}
- configuration::TemplateHolder ViewStrategy::getElementTemplate(SetNode const& _aNode) const
+ rtl::Reference<configuration::Template> ViewStrategy::getElementTemplate(SetNode const& _aNode) const
{
checkInstance(_aNode.tree());
return _aNode.get_impl()->getElementTemplate();
@@ -612,7 +577,7 @@ namespace configmgr
}
//-----------------------------------------------------------------------------
- SetNodeVisitor::Result ViewStrategy::dispatchToElements(SetNode const& _aNode, SetNodeVisitor& _aVisitor)
+ configuration::SetNodeVisitor::Result ViewStrategy::dispatchToElements(SetNode const& _aNode, configuration::SetNodeVisitor& _aVisitor)
{
checkInstance(_aNode.tree());
@@ -622,7 +587,7 @@ namespace configmgr
return pNodeData->doDispatchToElements(_aVisitor);
else
- return SetNodeVisitor::CONTINUE;
+ return configuration::SetNodeVisitor::CONTINUE;
}
bool ViewStrategy::isEmpty(SetNode const& _aNode) const
@@ -635,7 +600,7 @@ namespace configmgr
}
//-----------------------------------------------------------------------------
- void ViewStrategy::insertElement(SetNode const& _aNode, Name const& _aName, SetEntry const& _aNewEntry)
+ void ViewStrategy::insertElement(SetNode const& _aNode, rtl::OUString const& _aName, configuration::SetEntry const& _aNewEntry)
{
// cannot insert, if we cannot check for collisions
checkInstance(_aNode.tree());
@@ -643,7 +608,7 @@ namespace configmgr
doInsertElement(_aNode,_aName,_aNewEntry);
}
- void ViewStrategy::removeElement(SetNode const& _aNode, Name const& _aName)
+ void ViewStrategy::removeElement(SetNode const& _aNode, rtl::OUString const& _aName)
{
// cannot remove, if we cannot check for existance
checkInstance(_aNode.tree());
diff --git a/configmgr/source/treemgr/viewstrategy.hxx b/configmgr/source/treemgr/viewstrategy.hxx
index 45e479bdd3..8e77c0bf4a 100644
--- a/configmgr/source/treemgr/viewstrategy.hxx
+++ b/configmgr/source/treemgr/viewstrategy.hxx
@@ -36,6 +36,7 @@
#include "setnodeimpl.hxx"
#include "utility.hxx"
#include <rtl/ref.hxx>
+#include <salhelper/simplereferenceobject.hxx>
namespace configmgr
{
@@ -51,30 +52,21 @@ namespace configmgr
//-----------------------------------------------------------------------------
struct NodeFactory;
//-----------------------------------------------------------------------------
- using configuration::Name;
- using configuration::NodeOffset;
- using configuration::TreeDepth;
-
- typedef com::sun::star::uno::Any UnoAny;
- typedef com::sun::star::uno::Type UnoType;
-//-----------------------------------------------------------------------------
- class ViewStrategy : public configmgr::SimpleReferenceObject
+ class ViewStrategy : public salhelper::SimpleReferenceObject
{
// node attributes
public:
/// retrieve the attributes of the node
- Name getName(Node const& _aNode) const;
+ rtl::OUString getName(Node const& _aNode) const;
/// retrieve the attributes of the node
node::Attributes getAttributes(Node const& _aNode) const;
// tracking pending changes
public:
- typedef configuration::NodeChanges NodeChanges;
+ void collectChanges(configuration::Tree * tree, configuration::NodeChanges& rChanges) const;
- void collectChanges(Tree const& _aTree, NodeChanges& rChanges) const;
-
- bool hasChanges(Tree const& _aTree) const;
+ bool hasChanges(configuration::Tree * tree) const;
bool hasChanges(Node const& _aNode) const;
@@ -82,48 +74,40 @@ namespace configmgr
// commit protocol
public:
- std::auto_ptr<SubtreeChange> preCommitChanges(Tree const& _aTree, configuration::ElementList& _rRemovedElements);
+ std::auto_ptr<SubtreeChange> preCommitChanges(configuration::Tree * tree, std::vector< rtl::Reference<configuration::ElementTree> >& _rRemovedElements);
- void finishCommit(Tree const& _aTree, SubtreeChange& rRootChange);
+ void finishCommit(configuration::Tree * tree, SubtreeChange& rRootChange);
- void revertCommit(Tree const& _aTree, SubtreeChange& rRootChange);
+ void revertCommit(configuration::Tree * tree, SubtreeChange& rRootChange);
- void recoverFailedCommit(Tree const& _aTree, SubtreeChange& rRootChange);
+ void recoverFailedCommit(configuration::Tree * tree, SubtreeChange& rRootChange);
// notification protocol
public:
- typedef configuration::NodeChangesInformation NodeChangesInformation;
-
/// Adjust the internal representation after external changes to the original data - build NodeChangeInformation objects for notification
- void adjustToChanges(NodeChangesInformation& rLocalChanges, Node const & _aNode, SubtreeChange const& aExternalChange);
+ void adjustToChanges(configuration::NodeChangesInformation& rLocalChanges, Node const & _aNode, SubtreeChange const& aExternalChange);
// visitor dispatch
public:
- typedef configuration::GroupMemberVisitor GroupMemberVisitor;
- typedef configuration::SetNodeVisitor SetNodeVisitor;
-
- GroupMemberVisitor::Result dispatchToValues(GroupNode const& _aNode, GroupMemberVisitor& _aVisitor);
+ configuration::GroupMemberVisitor::Result dispatchToValues(GroupNode const& _aNode, configuration::GroupMemberVisitor& _aVisitor);
/// Call <code>aVisitor.visit(aElement)</code> for each element in this set until SetNodeVisitor::DONE is returned.
- SetNodeVisitor::Result dispatchToElements(SetNode const& _aNode, SetNodeVisitor& _aVisitor);
+ configuration::SetNodeVisitor::Result dispatchToElements(SetNode const& _aNode, configuration::SetNodeVisitor& _aVisitor);
// value (element) node specific operations
public:
/// Does this node assume its default value
/// retrieve the current value of this node
- UnoAny getValue(ValueNode const& _aNode) const;
+ com::sun::star::uno::Any getValue(ValueNode const& _aNode) const;
#if OSL_DEBUG_LEVEL > 0
/// get the type of this value
- UnoType getValueType(ValueNode const& _aNode) const;
+ com::sun::star::uno::Type getValueType(ValueNode const& _aNode) const;
#endif
// group node specific operations
public:
- typedef configuration::ValueMemberNode ValueMemberNode;
- typedef configuration::ValueMemberUpdate ValueMemberUpdate;
-
/// does this hold a child value of the given name
- bool hasValue(GroupNode const& _aNode, Name const& _aName) const;
+ bool hasValue(GroupNode const& _aNode, rtl::OUString const& _aName) const;
/// does this hold a child value
bool hasValue(GroupNode const& _aNode) const;
@@ -132,30 +116,27 @@ namespace configmgr
bool areValueDefaultsAvailable(GroupNode const& _aNode) const;
/// retrieve data for the child value of the given name
- ValueMemberNode getValue(GroupNode const& _aNode, Name const& _aName) const;
+ configuration::ValueMemberNode getValue(GroupNode const& _aNode, rtl::OUString const& _aName) const;
/// retrieve data for updating the child value of the given name
- ValueMemberUpdate getValueForUpdate(GroupNode const & _aNode, Name const& _aName);
+ configuration::ValueMemberUpdate getValueForUpdate(GroupNode const & _aNode, rtl::OUString const& _aName);
// set node specific operations
public:
- typedef configuration::ElementTreeData SetNodeElement;
- typedef configuration::SetEntry SetNodeEntry;
-
/// does this set contain any elements (loads elements if needed)
bool isEmpty(SetNode const& _aNode) const;
/// does this set contain an element named <var>aName</var> (loads elements if needed)
- SetNodeEntry findElement(SetNode const& _aNode, Name const& aName) const;
+ configuration::SetEntry findElement(SetNode const& _aNode, rtl::OUString const& aName) const;
/// does this set contain an element named <var>aName</var> (and is that element loaded ?)
- SetNodeEntry findAvailableElement(SetNode const& _aNode, Name const& aName) const;
+ configuration::SetEntry findAvailableElement(SetNode const& _aNode, rtl::OUString const& aName) const;
/// insert a new entry into this set
- void insertElement(SetNode const& _aNode, Name const& aName, SetNodeEntry const& aNewEntry);
+ void insertElement(SetNode const& _aNode, rtl::OUString const& aName, configuration::SetEntry const& aNewEntry);
/// remove an existing entry into this set
- void removeElement(SetNode const& _aNode, Name const& aName);
+ void removeElement(SetNode const& _aNode, rtl::OUString const& aName);
/** Create a Subtree change as 'diff' which allows transforming the set to its default state
(given that <var>_rDefaultTree</var> points to a default instance of this set)
@@ -164,13 +145,13 @@ namespace configmgr
std::auto_ptr<SubtreeChange> differenceToDefaultState(SetNode const& _aNode, ISubtree& _rDefaultTree) const;
/// Get the template that describes elements of this set
- configuration::TemplateHolder getElementTemplate(SetNode const& _aNode) const;
+ rtl::Reference<configuration::Template> getElementTemplate(SetNode const& _aNode) const;
/// Get a template provider that can create new elements for this set
configuration::TemplateProvider getTemplateProvider(SetNode const& _aNode) const;
- // create a view::Tree from a configuration::SetEntry
- Tree extractTree(SetNodeEntry const& _anEntry);
+ // create a configuration::Tree * from a configuration::SetEntry
+ configuration::Tree * extractTree(configuration::SetEntry const& _anEntry);
// creating/changing state/strategy
public:
@@ -179,26 +160,26 @@ namespace configmgr
// access to node innards
protected:
/// provide access to the address of the underlying node
- data::NodeAddress getNodeAddress(Node const& _aNode) const;
+ sharable::Node * getNodeAddress(Node const& _aNode) const;
/// retrieve the attributes of the underlying node
node::Attributes getNodeAttributes(Node const& _aNode) const;
protected:
//helper for migration to new (info based) model for adjusting to changes
- static void addLocalChangeHelper( NodeChangesInformation& rLocalChanges, configuration::NodeChange const& aChange);
+ static void addLocalChangeHelper( configuration::NodeChangesInformation& rLocalChanges, configuration::NodeChange const& aChange);
private:
- void implAdjustToValueChanges(NodeChangesInformation& rLocalChanges, GroupNode const& _aGroupNode, SubtreeChange const& rExternalChanges);
- void implAdjustToSubChanges(NodeChangesInformation& rLocalChanges, GroupNode const & _aGroupNode, SubtreeChange const& rExternalChanges);
- void implAdjustToElementChanges(NodeChangesInformation& rLocalChanges, SetNode const& _aNode, SubtreeChange const& rExternalChanges, TreeDepth nDepth);
- void implAdjustToElementChange (NodeChangesInformation& rLocalChanges, SetNode const& _aNode, Change const& rElementChange, TreeDepth nElementDepth);
- void implCommitDirectIn(data::TreeAccessor const& _aPlaceHolder, Node const& _aNode);
+ void implAdjustToValueChanges(configuration::NodeChangesInformation& rLocalChanges, GroupNode const& _aGroupNode, SubtreeChange const& rExternalChanges);
+ void implAdjustToSubChanges(configuration::NodeChangesInformation& rLocalChanges, GroupNode const & _aGroupNode, SubtreeChange const& rExternalChanges);
+ void implAdjustToElementChanges(configuration::NodeChangesInformation& rLocalChanges, SetNode const& _aNode, SubtreeChange const& rExternalChanges, unsigned int nDepth);
+ void implAdjustToElementChange (configuration::NodeChangesInformation& rLocalChanges, SetNode const& _aNode, Change const& rElementChange, unsigned int nElementDepth);
+ void implCommitDirectIn(sharable::TreeFragment * placeHolder, Node const& _aNode);
protected:
- void checkInstance(Tree const& _aTreeForThis) const;
- SetNodeEntry implFindElement(SetNode const& _aNode, Name const& aName) const;
- SetNodeElement implMakeElement(SetNode const& _aNode, SetNodeEntry const& anEntry) const;
+ void checkInstance(configuration::Tree * tree) const;
+ configuration::SetEntry implFindElement(SetNode const& _aNode, rtl::OUString const& aName) const;
+ configuration::ElementTreeData implMakeElement(SetNode const& _aNode, configuration::SetEntry const& anEntry) const;
// virtual interface - these functions must be provided
private:
@@ -211,26 +192,26 @@ namespace configmgr
// virtual interface - these functions all have default implementations without support for pending changes
protected:
// change handling
- virtual void doCollectChanges(Node const& _aNode, NodeChanges& rChanges) const;
+ virtual void doCollectChanges(Node const& _aNode, configuration::NodeChanges& rChanges) const;
// commit protocol
- virtual std::auto_ptr<SubtreeChange> doPreCommitChanges(Tree const& _aTree, configuration::ElementList& _rRemovedElements);
- virtual void doFailedCommit(Tree const& _aTree, SubtreeChange& rChanges);
- virtual void doFinishCommit(Tree const& _aTree, SubtreeChange& rChanges);
- virtual void doRevertCommit(Tree const& _aTree, SubtreeChange& rChanges);
+ virtual std::auto_ptr<SubtreeChange> doPreCommitChanges(configuration::Tree * tree, std::vector< rtl::Reference<configuration::ElementTree> >& _rRemovedElements);
+ virtual void doFailedCommit(configuration::Tree * tree, SubtreeChange& rChanges);
+ virtual void doFinishCommit(configuration::Tree * tree, SubtreeChange& rChanges);
+ virtual void doRevertCommit(configuration::Tree * tree, SubtreeChange& rChanges);
// notification protocol
- virtual configuration::ValueChangeImpl* doAdjustToValueChange(GroupNode const& _aGroupNode, Name const& aName, ValueChange const& rExternalChange);
+ virtual configuration::ValueChangeImpl* doAdjustToValueChange(GroupNode const& _aGroupNode, rtl::OUString const& aName, ValueChange const& rExternalChange);
// common attributes
virtual node::Attributes doAdjustAttributes(node::Attributes const& _aAttributes) const = 0;
// group member access
- virtual ValueMemberNode doGetValueMember(GroupNode const& _aNode, Name const& _aName, bool _bForUpdate) const = 0;
+ virtual configuration::ValueMemberNode doGetValueMember(GroupNode const& _aNode, rtl::OUString const& _aName, bool _bForUpdate) const = 0;
// set element access
- virtual void doInsertElement(SetNode const& _aNode, Name const& aName, SetNodeEntry const& aNewEntry) = 0;
- virtual void doRemoveElement(SetNode const& _aNode, Name const& aName) = 0;
+ virtual void doInsertElement(SetNode const& _aNode, rtl::OUString const& aName, configuration::SetEntry const& aNewEntry) = 0;
+ virtual void doRemoveElement(SetNode const& _aNode, rtl::OUString const& aName) = 0;
};
inline node::Attributes ViewStrategy::getAttributes(Node const& _aNode) const
diff --git a/configmgr/source/xml/basicparser.cxx b/configmgr/source/xml/basicparser.cxx
index 5de43bf915..fc30410dfa 100644
--- a/configmgr/source/xml/basicparser.cxx
+++ b/configmgr/source/xml/basicparser.cxx
@@ -48,28 +48,26 @@ namespace configmgr
namespace
{
- typedef uno::Reference< script::XTypeConverter > TypeConverter;
-
static inline
- TypeConverter createTCV(BasicParser::Context const & _xContext)
+ uno::Reference< script::XTypeConverter > createTCV(uno::Reference< uno::XComponentContext > const & _xContext)
{
OSL_ENSURE(_xContext.is(),"Cannot create Parser without a Context");
static const rtl::OUString k_sTCVService(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.script.Converter"));
uno::Reference< lang::XMultiComponentFactory > xSvcFactory = _xContext->getServiceManager();
- return TypeConverter::query(xSvcFactory->createInstanceWithContext(k_sTCVService,_xContext));
+ return uno::Reference< script::XTypeConverter >::query(xSvcFactory->createInstanceWithContext(k_sTCVService,_xContext));
}
}
// -----------------------------------------------------------------------------
struct BasicParser::ValueData : ValueConverter
{
- OUString content;
- OUString locale;
+ rtl::OUString content;
+ rtl::OUString locale;
bool isLocalized;
- ValueData(uno::Type const& _aType, TypeConverter const & _xTCV)
+ ValueData(uno::Type const& _aType, uno::Reference< script::XTypeConverter > const & _xTCV)
: ValueConverter(_aType, _xTCV)
, content()
, locale()
@@ -82,17 +80,17 @@ struct BasicParser::ValueData : ValueConverter
return ValueConverter::convertToAny(this->content);
}
- OUString toString() const
+ rtl::OUString toString() const
{
return this->content;
}
- uno::Sequence<OUString> toStringList() const
+ uno::Sequence<rtl::OUString> toStringList() const
{
return ValueConverter::splitStringList(this->content);
}
- void setLocalized(OUString const & _aLocale)
+ void setLocalized(rtl::OUString const & _aLocale)
{
isLocalized = true;
locale = _aLocale;
@@ -100,7 +98,7 @@ struct BasicParser::ValueData : ValueConverter
};
// -----------------------------------------------------------------------------
-BasicParser::BasicParser(Context const & _xContext)
+BasicParser::BasicParser(uno::Reference< uno::XComponentContext > const & _xContext)
: m_xTypeConverter( createTCV(_xContext) )
, m_xLocator(NULL)
, m_aDataParser(Logger(_xContext))
@@ -128,7 +126,7 @@ BasicParser::~BasicParser()
void BasicParser::dbgUpdateLocation()
{
#ifndef DBG_UTIL
- OUString dbgPublicId, dbgSystemId;
+ rtl::OUString dbgPublicId, dbgSystemId;
sal_Int32 dbgLineNo, dbgColumnNo;
#endif // OSL_DEBUG_LEVEL
@@ -141,7 +139,7 @@ void BasicParser::dbgUpdateLocation()
}
else
{
- dbgPublicId = dbgSystemId = OUString::createFromAscii("<<<unknown>>>");
+ dbgPublicId = dbgSystemId = rtl::OUString::createFromAscii("<<<unknown>>>");
dbgLineNo = dbgColumnNo = -1;
}
}
@@ -176,7 +174,7 @@ void SAL_CALL BasicParser::endDocument( ) throw (sax::SAXException, uno::Runtim
}
// -----------------------------------------------------------------------------
-void SAL_CALL BasicParser::characters( const OUString& aChars )
+void SAL_CALL BasicParser::characters( const rtl::OUString& aChars )
throw (sax::SAXException, uno::RuntimeException)
{
OSL_DEBUG_ONLY( dbgUpdateLocation() );
@@ -192,7 +190,7 @@ void SAL_CALL BasicParser::characters( const OUString& aChars )
}
// -----------------------------------------------------------------------------
-void SAL_CALL BasicParser::ignorableWhitespace( const OUString& aWhitespaces )
+void SAL_CALL BasicParser::ignorableWhitespace( const rtl::OUString& aWhitespaces )
throw (sax::SAXException, uno::RuntimeException)
{
OSL_DEBUG_ONLY( dbgUpdateLocation() );
@@ -209,7 +207,7 @@ void SAL_CALL BasicParser::ignorableWhitespace( const OUString& aWhitespaces )
}
// -----------------------------------------------------------------------------
-void SAL_CALL BasicParser::processingInstruction( const OUString& /*aTarget*/, const OUString& /*aData*/ )
+void SAL_CALL BasicParser::processingInstruction( const rtl::OUString& /*aTarget*/, const rtl::OUString& /*aData*/ )
throw (sax::SAXException, uno::RuntimeException)
{
OSL_DEBUG_ONLY( dbgUpdateLocation() );
@@ -377,7 +375,7 @@ void BasicParser::startValueData(const uno::Reference< sax::XAttributeList >& xA
!m_pValueData->isNull(),
"Warning: Spurious oor:separator on value that is not a list");
- OUString aLocale;
+ rtl::OUString aLocale;
if ( getDataParser().getLanguage(xAttribs,aLocale) )
m_pValueData->setLocalized( aLocale );
}
@@ -397,7 +395,7 @@ bool BasicParser::isValueDataLocalized()
}
// -----------------------------------------------------------------------------
-OUString BasicParser::getValueDataLocale()
+rtl::OUString BasicParser::getValueDataLocale()
{
OSL_ENSURE(isValueDataLocalized(), "There is no value data or it is not localized");
@@ -453,7 +451,7 @@ void BasicParser::endValueData()
}
// -----------------------------------------------------------------------------
-void BasicParser::startSkipping( const OUString& aName, const uno::Reference< sax::XAttributeList >& /*xAttribs*/ )
+void BasicParser::startSkipping( const rtl::OUString& aName, const uno::Reference< sax::XAttributeList >& /*xAttribs*/ )
{
OSL_DEBUG_ONLY( dbgUpdateLocation() );
@@ -462,7 +460,7 @@ void BasicParser::startSkipping( const OUString& aName, const uno::Reference< sa
}
// -----------------------------------------------------------------------------
-bool BasicParser::wasSkipping( const OUString& aName )
+bool BasicParser::wasSkipping( const rtl::OUString& aName )
{
OSL_DEBUG_ONLY( dbgUpdateLocation() );
@@ -488,13 +486,13 @@ bool BasicParser::isSkipping( )
// -----------------------------------------------------------------------------
void BasicParser::raiseParseException( uno::Any const & _aTargetException, sal_Char const * _pMsg )
- CFG_THROW2 (sax::SAXException, uno::RuntimeException)
+ SAL_THROW((sax::SAXException, uno::RuntimeException))
{
OSL_DEBUG_ONLY( dbgUpdateLocation() );
if (_pMsg == 0) _pMsg = "Configuration XML Parser: Invalid Data: ";
- OUString sMessage = OUString::createFromAscii(_pMsg);
+ rtl::OUString sMessage = rtl::OUString::createFromAscii(_pMsg);
uno::Exception aEx;
if (_aTargetException >>= aEx)
@@ -506,21 +504,21 @@ void BasicParser::raiseParseException( uno::Any const & _aTargetException, sal_C
// -----------------------------------------------------------------------------
void BasicParser::raiseParseException( sal_Char const * _pMsg )
- CFG_THROW2 (sax::SAXException, uno::RuntimeException)
+ SAL_THROW((sax::SAXException, uno::RuntimeException))
{
OSL_DEBUG_ONLY( dbgUpdateLocation() );
if (_pMsg == 0) _pMsg = "Configuration XML Parser: Invalid XML";
- OUString const sMessage = OUString::createFromAscii(_pMsg);
+ rtl::OUString const sMessage = rtl::OUString::createFromAscii(_pMsg);
getLogger().error(sMessage,"parse","configuration::xml::BasicParser");
throw sax::SAXException( sMessage, *this, uno::Any() );
}
// -----------------------------------------------------------------------------
-void BasicParser::raiseParseException( OUString const & sMessage )
- CFG_THROW2 (sax::SAXException, uno::RuntimeException)
+void BasicParser::raiseParseException( rtl::OUString const & sMessage )
+ SAL_THROW((sax::SAXException, uno::RuntimeException))
{
OSL_DEBUG_ONLY( dbgUpdateLocation() );
diff --git a/configmgr/source/xml/basicparser.hxx b/configmgr/source/xml/basicparser.hxx
index 783e44b874..f8bb218520 100644
--- a/configmgr/source/xml/basicparser.hxx
+++ b/configmgr/source/xml/basicparser.hxx
@@ -54,14 +54,10 @@ namespace configmgr
namespace lang = ::com::sun::star::lang;
namespace sax = ::com::sun::star::xml::sax;
-
- using rtl::OUString;
// -----------------------------------------------------------------------------
- typedef ::cppu::WeakImplHelper1<sax::XDocumentHandler> Parser_Base;
-
class BasicParser
- : public Parser_Base
+ : public cppu::WeakImplHelper1<sax::XDocumentHandler>
{
struct ValueData;
@@ -78,16 +74,14 @@ namespace configmgr
#if OSL_DEBUG_LEVEL > 0
#ifdef DBG_UTIL
- OUString dbgPublicId, dbgSystemId;
+ rtl::OUString dbgPublicId, dbgSystemId;
sal_Int32 dbgLineNo, dbgColumnNo;
#endif // DBG_UTIL
void dbgUpdateLocation();
#endif // OSL_DEBUG_LEVEL
public:
- typedef uno::Reference< uno::XComponentContext > Context;
-
- explicit BasicParser(Context const & _xContext);
+ explicit BasicParser(uno::Reference< uno::XComponentContext > const & _xContext);
virtual ~BasicParser();
// XDocumentHandler
@@ -100,15 +94,15 @@ namespace configmgr
endDocument( ) throw (sax::SAXException, uno::RuntimeException);
virtual void SAL_CALL
- characters( const OUString& aChars )
+ characters( const rtl::OUString& aChars )
throw (sax::SAXException, uno::RuntimeException);
virtual void SAL_CALL
- ignorableWhitespace( const OUString& aWhitespaces )
+ ignorableWhitespace( const rtl::OUString& aWhitespaces )
throw (sax::SAXException, uno::RuntimeException);
virtual void SAL_CALL
- processingInstruction( const OUString& aTarget, const OUString& aData )
+ processingInstruction( const rtl::OUString& aTarget, const rtl::OUString& aData )
throw (sax::SAXException, uno::RuntimeException);
virtual void SAL_CALL
@@ -151,26 +145,26 @@ namespace configmgr
/// check if the current value data has a locale set
bool isValueDataLocalized();
/// get the locale of the current value data, if localized
- OUString getValueDataLocale();
+ rtl::OUString getValueDataLocale();
/// return the collected value
uno::Any getCurrentValue();
/// end collecting data for a value
void endValueData();
/// start a node to be skipped
- void startSkipping( const OUString& aTag, const uno::Reference< sax::XAttributeList >& xAttribs );
+ void startSkipping( const rtl::OUString& aTag, const uno::Reference< sax::XAttributeList >& xAttribs );
/// are we inside a skipped node ?
bool isSkipping( );
/// ending a node: was this skipped ?
- bool wasSkipping( const OUString& aTag );
+ bool wasSkipping( const rtl::OUString& aTag );
protected:
void raiseParseException( uno::Any const & _aTargetException, sal_Char const * _pMsg = NULL)
- CFG_THROW2 (sax::SAXException, uno::RuntimeException);
+ SAL_THROW((sax::SAXException, uno::RuntimeException));
void raiseParseException( sal_Char const * _pMsg )
- CFG_THROW2 (sax::SAXException, uno::RuntimeException);
- void raiseParseException( OUString const & aMsg )
- CFG_THROW2 (sax::SAXException, uno::RuntimeException);
+ SAL_THROW((sax::SAXException, uno::RuntimeException));
+ void raiseParseException( rtl::OUString const & aMsg )
+ SAL_THROW((sax::SAXException, uno::RuntimeException));
};
// -----------------------------------------------------------------------------
} // namespace xml
diff --git a/configmgr/source/xml/elementformatter.cxx b/configmgr/source/xml/elementformatter.cxx
index 8e3a1f4303..3b0a48e9f0 100644
--- a/configmgr/source/xml/elementformatter.cxx
+++ b/configmgr/source/xml/elementformatter.cxx
@@ -73,7 +73,7 @@ void ElementFormatter::reset()
}
// -----------------------------------------------------------------------------
-void ElementFormatter::addAttribute(OUString const & _anAttributeName, OUString const & _aValue)
+void ElementFormatter::addAttribute(rtl::OUString const & _anAttributeName, rtl::OUString const & _aValue)
{
OSL_PRECOND(m_xAttributes.is(),"Trying to add an attribute to a non-existing list");
@@ -83,7 +83,7 @@ void ElementFormatter::addAttribute(OUString const & _anAttributeName, OUString
}
// -----------------------------------------------------------------------------
-void ElementFormatter::addAttribute(OUString const & _anAttributeName, bool _bValue)
+void ElementFormatter::addAttribute(rtl::OUString const & _anAttributeName, bool _bValue)
{
OSL_PRECOND(m_xAttributes.is(),"Trying to add an attribute to a non-existing list");
@@ -95,10 +95,10 @@ void ElementFormatter::addAttribute(OUString const & _anAttributeName, bool _bVa
void ElementFormatter::addNamespaces()
{
- static OUString const sNamespaceDecl( RTL_CONSTASCII_USTRINGPARAM("xmlns:") );
+ static rtl::OUString const sNamespaceDecl( RTL_CONSTASCII_USTRINGPARAM("xmlns:") );
- addAttribute( sNamespaceDecl.concat(NS_PREFIX_OOR), static_cast<OUString const &>(NS_URI_OOR));
- addAttribute( sNamespaceDecl.concat(NS_PREFIX_XS ), static_cast<OUString const &>(NS_URI_XS ));
+ addAttribute( sNamespaceDecl.concat(NS_PREFIX_OOR), static_cast<rtl::OUString const &>(NS_URI_OOR));
+ addAttribute( sNamespaceDecl.concat(NS_PREFIX_XS ), static_cast<rtl::OUString const &>(NS_URI_XS ));
}
// -----------------------------------------------------------------------------
@@ -134,7 +134,7 @@ void ElementFormatter::prepareSimpleElement(ElementType::Enum _eType)
}
// -----------------------------------------------------------------------------
-void ElementFormatter::addName(OUString const & _aName)
+void ElementFormatter::addName(rtl::OUString const & _aName)
{
if (_aName.getLength())
{
@@ -145,13 +145,13 @@ void ElementFormatter::addName(OUString const & _aName)
{
sal_Int32 nIndex = _aName.lastIndexOf('.');
- OUString aNodeName = _aName.copy(nIndex + 1);
+ rtl::OUString aNodeName = _aName.copy(nIndex + 1);
addAttribute(ATTR_NAME, aNodeName);
OSL_ENSURE(nIndex > 0,"Found component root element without a package part in its name");
if (nIndex > 0)
{
- OUString aPackage = _aName.copy(0, nIndex);
+ rtl::OUString aPackage = _aName.copy(0, nIndex);
addAttribute(ATTR_PACKAGE, aPackage);
}
}
@@ -166,23 +166,21 @@ void ElementFormatter::addName(OUString const & _aName)
// -----------------------------------------------------------------------------
inline
-void ElementFormatter::maybeAddFlag(FlagsType _eFlags, FlagsType _eSelect, OUString const & _anAttributeName, bool _bValue)
+void ElementFormatter::maybeAddFlag(sal_Int16 _eFlags, sal_Int16 _eSelect, rtl::OUString const & _anAttributeName, bool _bValue)
{
if (_eFlags & _eSelect) addAttribute(_anAttributeName,_bValue);
}
// -----------------------------------------------------------------------------
-void ElementFormatter::addNodeFlags(FlagsType _eFlags)
+void ElementFormatter::addNodeFlags(sal_Int16 _eFlags)
{
- using namespace ::com::sun::star::configuration::backend;
+ maybeAddFlag(_eFlags,com::sun::star::configuration::backend::SchemaAttribute::REQUIRED, ATTR_FLAG_NULLABLE, false);
+ maybeAddFlag(_eFlags,com::sun::star::configuration::backend::SchemaAttribute::LOCALIZED, ATTR_FLAG_LOCALIZED);
+ maybeAddFlag(_eFlags,com::sun::star::configuration::backend::SchemaAttribute::EXTENSIBLE, ATTR_FLAG_EXTENSIBLE);
- maybeAddFlag(_eFlags,SchemaAttribute::REQUIRED, ATTR_FLAG_NULLABLE, false);
- maybeAddFlag(_eFlags,SchemaAttribute::LOCALIZED, ATTR_FLAG_LOCALIZED);
- maybeAddFlag(_eFlags,SchemaAttribute::EXTENSIBLE, ATTR_FLAG_EXTENSIBLE);
-
- maybeAddFlag(_eFlags,NodeAttribute::FINALIZED, ATTR_FLAG_FINALIZED);
- maybeAddFlag(_eFlags,NodeAttribute::MANDATORY, ATTR_FLAG_MANDATORY);
- maybeAddFlag(_eFlags,NodeAttribute::READONLY, ATTR_FLAG_READONLY);
+ maybeAddFlag(_eFlags,com::sun::star::configuration::backend::NodeAttribute::FINALIZED, ATTR_FLAG_FINALIZED);
+ maybeAddFlag(_eFlags,com::sun::star::configuration::backend::NodeAttribute::MANDATORY, ATTR_FLAG_MANDATORY);
+ maybeAddFlag(_eFlags,com::sun::star::configuration::backend::NodeAttribute::READONLY, ATTR_FLAG_READONLY);
}
// -----------------------------------------------------------------------------
@@ -191,12 +189,12 @@ void ElementFormatter::addOperation(Operation::Enum _eOp)
switch (_eOp)
{
case Operation::none: break;
- case Operation::modify: break ; //addAttribute(ATTR_OPERATION, static_cast<OUString const &>(OPERATION_MODIFY)); break;
+ case Operation::modify: break ; //addAttribute(ATTR_OPERATION, static_cast<rtl::OUString const &>(OPERATION_MODIFY)); break;
case Operation::clear: OSL_ENSURE(false,"'clear' operation is not yet supported"); break ;
- //addAttribute(ATTR_OPERATION, static_cast<OUString const &>(OPERATION_CLEAR)); break;
- case Operation::replace: addAttribute(ATTR_OPERATION, static_cast<OUString const &>(OPERATION_REPLACE)); break;
- case Operation::fuse: addAttribute(ATTR_OPERATION, static_cast<OUString const &>(OPERATION_FUSE)); break;
- case Operation::remove: addAttribute(ATTR_OPERATION, static_cast<OUString const &>(OPERATION_REMOVE)); break;
+ //addAttribute(ATTR_OPERATION, static_cast<rtl::OUString const &>(OPERATION_CLEAR)); break;
+ case Operation::replace: addAttribute(ATTR_OPERATION, static_cast<rtl::OUString const &>(OPERATION_REPLACE)); break;
+ case Operation::fuse: addAttribute(ATTR_OPERATION, static_cast<rtl::OUString const &>(OPERATION_FUSE)); break;
+ case Operation::remove: addAttribute(ATTR_OPERATION, static_cast<rtl::OUString const &>(OPERATION_REMOVE)); break;
case Operation::unknown:
OSL_ENSURE(false, "ElementFormatter: Trying to add attribute for 'unknown' operation");
@@ -208,7 +206,7 @@ void ElementFormatter::addOperation(Operation::Enum _eOp)
}
// -----------------------------------------------------------------------------
-void ElementFormatter::addInstanceType(OUString const & /*_aElementType*/, OUString const & /*_aElementTypeModule*/)
+void ElementFormatter::addInstanceType(rtl::OUString const & /*_aElementType*/, rtl::OUString const & /*_aElementTypeModule*/)
{
}
// -----------------------------------------------------------------------------
@@ -241,10 +239,10 @@ void ElementFormatter::addPropertyValueType(uno::Type const& _aType)
bool bList = false;
uno::Type aSimpleType = getBasicType(_aType, bList);
uno::TypeClass aSimpleTypeClass = aSimpleType.getTypeClass();
- OUString aSimpleTypeName = toXmlTypeName(aSimpleTypeClass);
+ rtl::OUString aSimpleTypeName = toXmlTypeName(aSimpleTypeClass);
- OUString sNsPrefix = (bList || aSimpleTypeClass == uno::TypeClass_ANY) ?
- OUString( NS_PREFIX_OOR ) : OUString( NS_PREFIX_XS );
+ rtl::OUString sNsPrefix = (bList || aSimpleTypeClass == uno::TypeClass_ANY) ?
+ rtl::OUString( NS_PREFIX_OOR ) : rtl::OUString( NS_PREFIX_XS );
rtl::OUStringBuffer aTypeNameBuf(sNsPrefix);
@@ -260,7 +258,7 @@ void ElementFormatter::addPropertyValueType(uno::Type const& _aType)
}
// -----------------------------------------------------------------------------
-void ElementFormatter::addLanguage(OUString const & _sLanguage)
+void ElementFormatter::addLanguage(rtl::OUString const & _sLanguage)
{
OSL_ENSURE(_sLanguage.getLength(), "ElementFormatter: Trying to add empty language attribute");
addAttribute(EXT_ATTR_LANGUAGE, _sLanguage);
@@ -273,32 +271,32 @@ void ElementFormatter::addIsNull(bool _bIsNull)
}
// -----------------------------------------------------------------------------
-void ElementFormatter::addSeparator(OUString const& _sSeparator)
+void ElementFormatter::addSeparator(rtl::OUString const& _sSeparator)
{
addAttribute( ATTR_VALUESEPARATOR, _sSeparator);
}
// -----------------------------------------------------------------------------
-OUString ElementFormatter::getElementTag() const
+rtl::OUString ElementFormatter::getElementTag() const
{
switch (m_aElementType)
{
- case ElementType::schema: return OUString( TAG_SCHEMA );
- case ElementType::layer: return OUString( TAG_LAYER );
+ case ElementType::schema: return rtl::OUString( TAG_SCHEMA );
+ case ElementType::layer: return rtl::OUString( TAG_LAYER );
- case ElementType::component: return OUString( TAG_COMPONENT );
- case ElementType::templates: return OUString( TAG_TEMPLATES );
+ case ElementType::component: return rtl::OUString( TAG_COMPONENT );
+ case ElementType::templates: return rtl::OUString( TAG_TEMPLATES );
- case ElementType::property: return OUString( TAG_PROP );
- case ElementType::node: return OUString( TAG_NODE );
- case ElementType::group: return OUString( TAG_GROUP );
- case ElementType::set: return OUString( TAG_SET );
+ case ElementType::property: return rtl::OUString( TAG_PROP );
+ case ElementType::node: return rtl::OUString( TAG_NODE );
+ case ElementType::group: return rtl::OUString( TAG_GROUP );
+ case ElementType::set: return rtl::OUString( TAG_SET );
- case ElementType::import: return OUString( TAG_IMPORT );
- case ElementType::instance: return OUString( TAG_INSTANCE );
- case ElementType::item_type: return OUString( TAG_ITEMTYPE );
- case ElementType::value: return OUString( TAG_VALUE );
- case ElementType::uses: return OUString( TAG_USES );
+ case ElementType::import: return rtl::OUString( TAG_IMPORT );
+ case ElementType::instance: return rtl::OUString( TAG_INSTANCE );
+ case ElementType::item_type: return rtl::OUString( TAG_ITEMTYPE );
+ case ElementType::value: return rtl::OUString( TAG_VALUE );
+ case ElementType::uses: return rtl::OUString( TAG_USES );
case ElementType::unknown:
OSL_ENSURE(false, "ElementFormatter: Trying to get Tag for 'unknown' element type");
@@ -310,7 +308,7 @@ OUString ElementFormatter::getElementTag() const
OSL_ENSURE(false, "ElementFormatter: Trying to get Tag for invalid element type");
break;
}
- return OUString();
+ return rtl::OUString();
}
// -----------------------------------------------------------------------------
diff --git a/configmgr/source/xml/elementformatter.hxx b/configmgr/source/xml/elementformatter.hxx
index 5e799792e5..930aaaeb1c 100644
--- a/configmgr/source/xml/elementformatter.hxx
+++ b/configmgr/source/xml/elementformatter.hxx
@@ -49,15 +49,10 @@ namespace configmgr
namespace uno = ::com::sun::star::uno;
namespace sax = ::com::sun::star::xml::sax;
- using rtl::OUString;
-
// -----------------------------------------------------------------------------
class ElementFormatter
{
public:
- typedef uno::Reference< sax::XAttributeList > SaxAttributeList;
- typedef ElementInfo::FlagsType FlagsType;
- public:
ElementFormatter();
~ElementFormatter();
@@ -71,42 +66,42 @@ namespace configmgr
void prepareSimpleElement(ElementType::Enum _eType);
/// sets the instantiated type of a set item,
- void addInstanceType(OUString const & _aElementType, OUString const & _aElementTypeModule);
+ void addInstanceType(rtl::OUString const & _aElementType, rtl::OUString const & _aElementTypeModule);
/// retrieve element type and associated module name of a set,
void addPropertyValueType(uno::Type const& _aType);
/// add a language for the current element
- void addLanguage(OUString const & _sLanguage);
+ void addLanguage(rtl::OUString const & _sLanguage);
/// adds a value attribute to the attribute list
void addIsNull(bool _bIsNull = true);
/// adds a value attribute to the attribute list
- void addSeparator(OUString const& _sSeparator);
+ void addSeparator(rtl::OUString const& _sSeparator);
/// retrieve the tag to use for the current element
- OUString getElementTag() const;
+ rtl::OUString getElementTag() const;
/// retrieve the attributes to use for the current element
- SaxAttributeList getElementAttributes() const;
+ uno::Reference< sax::XAttributeList > getElementAttributes() const;
/// retrieve the attributes to use for an element with associated component
private:
void addNamespaces();
/// sets an attributes for a node
- void addName(OUString const & _aName);
+ void addName(rtl::OUString const & _aName);
/// sets attributes for nodes from the flags
- void addNodeFlags(FlagsType _eFlags);
+ void addNodeFlags(sal_Int16 _eFlags);
/// sets attributes for nodes from the flags
void addOperation(Operation::Enum _eOp);
/// sets attributes for nodes from the flags
- void maybeAddFlag(FlagsType _eFlags, FlagsType _eSelect,
- OUString const & _anAttributeName, bool _bValue = true);
+ void maybeAddFlag(sal_Int16 _eFlags, sal_Int16 _eSelect,
+ rtl::OUString const & _anAttributeName, bool _bValue = true);
/// sets attributes for nodes
- void addAttribute(OUString const & _anAttributeName, OUString const & _aValue);
- void addAttribute(OUString const & _anAttributeName, bool _bValue);
+ void addAttribute(rtl::OUString const & _anAttributeName, rtl::OUString const & _aValue);
+ void addAttribute(rtl::OUString const & _anAttributeName, bool _bValue);
private:
ElementType::Enum m_aElementType;
diff --git a/configmgr/source/xml/elementinfo.hxx b/configmgr/source/xml/elementinfo.hxx
index 1fd8c93f34..8bb00b49b8 100644
--- a/configmgr/source/xml/elementinfo.hxx
+++ b/configmgr/source/xml/elementinfo.hxx
@@ -42,8 +42,6 @@ namespace configmgr
namespace xml
{
// -----------------------------------------------------------------------------
- typedef rtl::OUString ElementName;
-// -----------------------------------------------------------------------------
namespace ElementType
{
enum Enum
@@ -90,8 +88,6 @@ namespace configmgr
// -----------------------------------------------------------------------------
struct ElementInfo
{
- typedef sal_Int16 FlagsType;
-
explicit
ElementInfo(ElementType::Enum _type = ElementType::unknown)
: name()
@@ -101,7 +97,7 @@ namespace configmgr
{}
explicit
- ElementInfo(ElementName const & _name, ElementType::Enum _type = ElementType::unknown)
+ ElementInfo(rtl::OUString const & _name, ElementType::Enum _type = ElementType::unknown)
: name(_name)
, type(_type)
, op(Operation::none)
@@ -109,10 +105,10 @@ namespace configmgr
{}
- ElementName name;
+ rtl::OUString name;
ElementType::Enum type;
Operation::Enum op;
- FlagsType flags;
+ sal_Int16 flags;
};
// -----------------------------------------------------------------------------
} // namespace xml
diff --git a/configmgr/source/xml/elementparser.cxx b/configmgr/source/xml/elementparser.cxx
index 4b69a56578..12ea5dde5c 100644
--- a/configmgr/source/xml/elementparser.cxx
+++ b/configmgr/source/xml/elementparser.cxx
@@ -54,7 +54,7 @@ namespace configmgr
static
inline
-sal_Int16 impl_getIndexByName(uno::Reference< sax::XAttributeList > const& xAttribs, OUString const& aAttributeName)
+sal_Int16 impl_getIndexByName(uno::Reference< sax::XAttributeList > const& xAttribs, rtl::OUString const& aAttributeName)
{
OSL_PRECOND( xAttribs.is(), "ERROR: NULL Attribute list");
@@ -72,11 +72,11 @@ sal_Int16 impl_getIndexByName(uno::Reference< sax::XAttributeList > const& xAttr
// -----------------------------------------------------------------------------
static
inline
-bool impl_maybeGetAttribute(uno::Reference< sax::XAttributeList > const& xAttribs, OUString const& aAttributeName, /* OUT */ OUString& rAttributeValue)
+bool impl_maybeGetAttribute(uno::Reference< sax::XAttributeList > const& xAttribs, rtl::OUString const& aAttributeName, /* OUT */ rtl::OUString& rAttributeValue)
{
OSL_PRECOND( xAttribs.is(), "ERROR: NULL Attribute list");
- OUString aValue = xAttribs->getValueByName(aAttributeName);
+ rtl::OUString aValue = xAttribs->getValueByName(aAttributeName);
if( aValue.getLength()!=0)
{
rAttributeValue = aValue;
@@ -87,7 +87,7 @@ bool impl_maybeGetAttribute(uno::Reference< sax::XAttributeList > const& xAttrib
// -----------------------------------------------------------------------------
/// retrieve the (almost) complete information for an element
-ElementInfo ElementParser::parseElementInfo(OUString const& _sTag, SaxAttributeList const& _xAttribs) const
+ElementInfo ElementParser::parseElementInfo(rtl::OUString const& _sTag, uno::Reference< sax::XAttributeList > const& _xAttribs) const
{
ElementType::Enum aType = this->getNodeType(_sTag,_xAttribs);
@@ -100,7 +100,7 @@ ElementInfo ElementParser::parseElementInfo(OUString const& _sTag, SaxAttributeL
}
// -----------------------------------------------------------------------------
-ElementType::Enum ElementParser::getNodeType(OUString const& _sElementName, SaxAttributeList const& _xAttribs) const
+ElementType::Enum ElementParser::getNodeType(rtl::OUString const& _sElementName, uno::Reference< sax::XAttributeList > const& _xAttribs) const
{
{ (void)_xAttribs; }
OSL_PRECOND( _xAttribs.is(), "ERROR: NULL Attribute list");
@@ -162,10 +162,10 @@ ElementType::Enum ElementParser::getNodeType(OUString const& _sElementName, SaxA
// -----------------------------------------------------------------------------
/// takes the node name from either an attribute or the element name
-OUString ElementParser::getName(OUString const& _sElementName, SaxAttributeList const& _xAttribs, ElementType::Enum _eType) const
+rtl::OUString ElementParser::getName(rtl::OUString const& _sElementName, uno::Reference< sax::XAttributeList > const& _xAttribs, ElementType::Enum _eType) const
{
- OUString aName;
- OUString aPackage;
+ rtl::OUString aName;
+ rtl::OUString aPackage;
bool bNameFound = this->maybeGetAttribute(_xAttribs, ATTR_NAME, aName);
bool bPackage = false;
@@ -232,7 +232,7 @@ OUString ElementParser::getName(OUString const& _sElementName, SaxAttributeList
{
static const sal_Unicode chPackageSep = '.';
- aName = aPackage.concat(OUString(&chPackageSep,1)).concat(aName);
+ aName = aPackage.concat(rtl::OUString(&chPackageSep,1)).concat(aName);
}
else
{
@@ -244,9 +244,9 @@ OUString ElementParser::getName(OUString const& _sElementName, SaxAttributeList
}
// -----------------------------------------------------------------------------
-Operation::Enum ElementParser::getOperation(SaxAttributeList const& xAttribs,ElementType::Enum _eType) const
+Operation::Enum ElementParser::getOperation(uno::Reference< sax::XAttributeList > const& xAttribs,ElementType::Enum _eType) const
{
- OUString sOpName;
+ rtl::OUString sOpName;
if ((_eType != ElementType::property) && (_eType !=ElementType::node))
{
return Operation::none;
@@ -276,21 +276,21 @@ Operation::Enum ElementParser::getOperation(SaxAttributeList const& xAttribs,Ele
/// retrieve the locale stored in the attribute list
-bool ElementParser::getLanguage(SaxAttributeList const& xAttribs, OUString& _rsLanguage) const
+bool ElementParser::getLanguage(uno::Reference< sax::XAttributeList > const& xAttribs, rtl::OUString& _rsLanguage) const
{
return this->maybeGetAttribute(xAttribs, EXT_ATTR_LANGUAGE, _rsLanguage);
}
// -----------------------------------------------------------------------------
/// reads attributes for nodes from the attribute list
-ElementInfo::FlagsType ElementParser::getNodeFlags(SaxAttributeList const& xAttribs,ElementType::Enum _eType) const
+sal_Int16 ElementParser::getNodeFlags(uno::Reference< sax::XAttributeList > const& xAttribs,ElementType::Enum _eType) const
{
namespace NodeAttribute = ::com::sun::star::configuration::backend::NodeAttribute;
namespace SchemaAttribute = ::com::sun::star::configuration::backend::SchemaAttribute;
bool bValue;
- ElementInfo::FlagsType aResult = 0;
+ sal_Int16 aResult = 0;
switch(_eType)
{
@@ -335,7 +335,7 @@ ElementInfo::FlagsType ElementParser::getNodeFlags(SaxAttributeList const& xAttr
}
// -----------------------------------------------------------------------------
static
-void badValueType(Logger const & logger, sal_Char const * _pMsg, OUString const & _sType)
+void badValueType(Logger const & logger, sal_Char const * _pMsg, rtl::OUString const & _sType)
{
rtl::OUStringBuffer sMessageBuf;
sMessageBuf.appendAscii( "Configuration XML parser: Bad value type attribute: " );
@@ -344,14 +344,14 @@ void badValueType(Logger const & logger, sal_Char const * _pMsg, OUString const
const sal_Unicode kQuote = '"';
sMessageBuf.append(kQuote).append(_sType).append(kQuote);
- OUString const sMessage = sMessageBuf.makeStringAndClear();
+ rtl::OUString const sMessage = sMessageBuf.makeStringAndClear();
logger.error(sMessage);
throw ElementParser::BadValueType(sMessage);
}
// -----------------------------------------------------------------------------
static
inline
-sal_Bool matchNsPrefix(OUString const & _sString, OUString const & _sPrefix)
+sal_Bool matchNsPrefix(rtl::OUString const & _sString, rtl::OUString const & _sPrefix)
{
return _sString.match(_sPrefix) &&
_sString.getStr()[_sPrefix.getLength()] == k_NS_SEPARATOR;
@@ -359,7 +359,7 @@ sal_Bool matchNsPrefix(OUString const & _sString, OUString const & _sPrefix)
// -----------------------------------------------------------------------------
static
inline
-sal_Bool matchSuffix(OUString const & _sString, OUString const & _sSuffix)
+sal_Bool matchSuffix(rtl::OUString const & _sString, rtl::OUString const & _sSuffix)
{
sal_Int32 nSuffixStart = _sString.getLength() - _sSuffix.getLength();
if (nSuffixStart < 0)
@@ -370,7 +370,7 @@ sal_Bool matchSuffix(OUString const & _sString, OUString const & _sSuffix)
// -----------------------------------------------------------------------------
static
inline
-OUString stripNsPrefix(OUString const & _sString, OUString const & _sPrefix)
+rtl::OUString stripNsPrefix(rtl::OUString const & _sString, rtl::OUString const & _sPrefix)
{
OSL_ASSERT( matchNsPrefix(_sString,_sPrefix) );
@@ -379,7 +379,7 @@ OUString stripNsPrefix(OUString const & _sString, OUString const & _sPrefix)
// -----------------------------------------------------------------------------
static
inline
-OUString stripSuffix(OUString const & _sString, OUString const & _sSuffix)
+rtl::OUString stripSuffix(rtl::OUString const & _sString, rtl::OUString const & _sSuffix)
{
OSL_ASSERT( matchSuffix(_sString,_sSuffix) );
@@ -390,7 +390,7 @@ OUString stripSuffix(OUString const & _sString, OUString const & _sSuffix)
// -----------------------------------------------------------------------------
static
inline
-OUString stripTypeName(Logger const & logger, OUString const & _sString, OUString const & _sPrefix)
+rtl::OUString stripTypeName(Logger const & logger, rtl::OUString const & _sString, rtl::OUString const & _sPrefix)
{
if ( matchNsPrefix(_sString,_sPrefix))
return stripNsPrefix(_sString, _sPrefix);
@@ -401,7 +401,7 @@ OUString stripTypeName(Logger const & logger, OUString const & _sString, OUStrin
}
// -----------------------------------------------------------------------------
static
-uno::Type xmlToScalarType(const OUString& _rType)
+uno::Type xmlToScalarType(const rtl::OUString& _rType)
{
uno::Type aRet;
@@ -421,7 +421,7 @@ uno::Type xmlToScalarType(const OUString& _rType)
aRet = ::getCppuType(static_cast< double const*>(0));
else if(_rType.equalsIgnoreAsciiCaseAscii(VALUETYPE_STRING))
- aRet = ::getCppuType(static_cast<OUString const*>(0));
+ aRet = ::getCppuType(static_cast<rtl::OUString const*>(0));
else if(_rType.equalsIgnoreAsciiCaseAscii(VALUETYPE_BINARY))
aRet = ::getCppuType(static_cast<uno::Sequence<sal_Int8> const*>(0));
@@ -435,7 +435,7 @@ uno::Type xmlToScalarType(const OUString& _rType)
return aRet;
}
// -----------------------------------------------------------------------------
-uno::Type xmlToListType(const OUString& _aElementType)
+uno::Type xmlToListType(const rtl::OUString& _aElementType)
{
uno::Type aRet;
@@ -467,9 +467,9 @@ uno::Type xmlToListType(const OUString& _aElementType)
}
// -----------------------------------------------------------------------------
/// retrieve data type of a property,
-uno::Type ElementParser::getPropertyValueType(SaxAttributeList const& xAttribs) const
+uno::Type ElementParser::getPropertyValueType(uno::Reference< sax::XAttributeList > const& xAttribs) const
{
- OUString sTypeName;
+ rtl::OUString sTypeName;
if (!this->maybeGetAttribute(xAttribs, ATTR_VALUETYPE, sTypeName))
return uno::Type(); // => VOID
@@ -478,15 +478,15 @@ uno::Type ElementParser::getPropertyValueType(SaxAttributeList const& xAttribs)
// valuetype names are either 'xs:<type>' or 'oor:<type>' or 'oor:<type>-list'
if (matchSuffix(sTypeName,VALUETYPE_LIST_SUFFIX))
{
- OUString sBasicName = stripTypeName( mLogger, stripSuffix(sTypeName,VALUETYPE_LIST_SUFFIX), NS_PREFIX_OOR );
+ rtl::OUString sBasicName = stripTypeName( mLogger, stripSuffix(sTypeName,VALUETYPE_LIST_SUFFIX), NS_PREFIX_OOR );
aType = xmlToListType(sBasicName);
}
else
{
- OUString sPrefix = matchNsPrefix(sTypeName,NS_PREFIX_OOR) ? OUString( NS_PREFIX_OOR ) : OUString( NS_PREFIX_XS );
+ rtl::OUString sPrefix = matchNsPrefix(sTypeName,NS_PREFIX_OOR) ? rtl::OUString( NS_PREFIX_OOR ) : rtl::OUString( NS_PREFIX_XS );
- OUString sBasicName = stripTypeName( mLogger, sTypeName, sPrefix );
+ rtl::OUString sBasicName = stripTypeName( mLogger, sTypeName, sPrefix );
aType = xmlToScalarType(sBasicName);
}
@@ -499,7 +499,7 @@ uno::Type ElementParser::getPropertyValueType(SaxAttributeList const& xAttribs)
// -----------------------------------------------------------------------------
/// retrieve element type and associated module name of a set,
-bool ElementParser::getSetElementType(SaxAttributeList const& xAttribs, OUString& aElementType, OUString& aElementTypeModule) const
+bool ElementParser::getSetElementType(uno::Reference< sax::XAttributeList > const& xAttribs, rtl::OUString& aElementType, rtl::OUString& aElementTypeModule) const
{
if (!this->maybeGetAttribute(xAttribs, ATTR_ITEMTYPE, aElementType))
return false;
@@ -511,7 +511,7 @@ bool ElementParser::getSetElementType(SaxAttributeList const& xAttribs, OUString
// -----------------------------------------------------------------------------
/// retrieve instance type and associated module name of a set,
-bool ElementParser::getInstanceType(SaxAttributeList const& xAttribs, OUString& aElementType, OUString& aElementTypeModule) const
+bool ElementParser::getInstanceType(uno::Reference< sax::XAttributeList > const& xAttribs, rtl::OUString& aElementType, rtl::OUString& aElementTypeModule) const
{
if (!this->maybeGetAttribute(xAttribs, ATTR_ITEMTYPE, aElementType))
return false;
@@ -523,14 +523,14 @@ bool ElementParser::getInstanceType(SaxAttributeList const& xAttribs, OUString&
// -----------------------------------------------------------------------------
/// retrieve the component for an import or uses element,
-bool ElementParser::getImportComponent(SaxAttributeList const& xAttribs, OUString& _rsComponent) const
+bool ElementParser::getImportComponent(uno::Reference< sax::XAttributeList > const& xAttribs, rtl::OUString& _rsComponent) const
{
return this->maybeGetAttribute(xAttribs, ATTR_COMPONENT, _rsComponent);
}
// -----------------------------------------------------------------------------
/// reads attributes for values from the attribute list
-bool ElementParser::isNull(SaxAttributeList const& _xAttribs) const
+bool ElementParser::isNull(uno::Reference< sax::XAttributeList > const& _xAttribs) const
{
bool bNull;
return maybeGetAttribute(_xAttribs, EXT_ATTR_NULL, bNull) && bNull;
@@ -538,9 +538,9 @@ bool ElementParser::isNull(SaxAttributeList const& _xAttribs) const
// -----------------------------------------------------------------------------
/// reads attributes for values from the attribute list
-OUString ElementParser::getSeparator(SaxAttributeList const& _xAttribs) const
+rtl::OUString ElementParser::getSeparator(uno::Reference< sax::XAttributeList > const& _xAttribs) const
{
- OUString aSeparator;
+ rtl::OUString aSeparator;
maybeGetAttribute(_xAttribs, ATTR_VALUESEPARATOR, aSeparator);
return aSeparator;
}
@@ -548,9 +548,9 @@ OUString ElementParser::getSeparator(SaxAttributeList const& _xAttribs) const
// low-level internal methods
/// checks for presence of a boolean attribute and assigns its value if it exists (and is a bool)
-bool ElementParser::maybeGetAttribute(SaxAttributeList const& xAttribs, OUString const& aAttributeName, bool& rAttributeValue) const
+bool ElementParser::maybeGetAttribute(uno::Reference< sax::XAttributeList > const& xAttribs, rtl::OUString const& aAttributeName, bool& rAttributeValue) const
{
- OUString sAttribute;
+ rtl::OUString sAttribute;
if ( !this->maybeGetAttribute(xAttribs, aAttributeName, sAttribute) )
{
@@ -574,7 +574,7 @@ bool ElementParser::maybeGetAttribute(SaxAttributeList const& xAttribs, OUString
// -----------------------------------------------------------------------------
/// checks for presence of an attribute and assigns its value if it exists
-bool ElementParser::maybeGetAttribute(SaxAttributeList const& xAttribs, OUString const& aAttributeName, OUString& rAttributeValue) const
+bool ElementParser::maybeGetAttribute(uno::Reference< sax::XAttributeList > const& xAttribs, rtl::OUString const& aAttributeName, rtl::OUString& rAttributeValue) const
{
return xAttribs.is() && impl_maybeGetAttribute(xAttribs, aAttributeName, rAttributeValue);
}
diff --git a/configmgr/source/xml/elementparser.hxx b/configmgr/source/xml/elementparser.hxx
index 868ef54577..9cbea22775 100644
--- a/configmgr/source/xml/elementparser.hxx
+++ b/configmgr/source/xml/elementparser.hxx
@@ -44,22 +44,18 @@ namespace configmgr
namespace uno = ::com::sun::star::uno;
namespace sax = ::com::sun::star::xml::sax;
- using rtl::OUString;
-
// -----------------------------------------------------------------------------
class ElementParser
{
Logger mLogger;
public:
- typedef uno::Reference< sax::XAttributeList > SaxAttributeList;
-
class BadValueType
{
- OUString mMessage;
+ rtl::OUString mMessage;
public:
- BadValueType(OUString const & aMessage) : mMessage(aMessage) {}
+ BadValueType(rtl::OUString const & aMessage) : mMessage(aMessage) {}
- OUString message() const { return mMessage.getStr(); }
+ rtl::OUString message() const { return mMessage.getStr(); }
};
public:
explicit
@@ -74,49 +70,49 @@ namespace configmgr
{}
/// retrieve the (almost) complete information for an element
- ElementInfo parseElementInfo(OUString const& _sTag, SaxAttributeList const& _xAttribs) const;
+ ElementInfo parseElementInfo(rtl::OUString const& _sTag, uno::Reference< sax::XAttributeList > const& _xAttribs) const;
/// retrieve the node name for an element
- ElementType::Enum getNodeType(OUString const& _sTag, SaxAttributeList const& xAttribs) const;
+ ElementType::Enum getNodeType(rtl::OUString const& _sTag, uno::Reference< sax::XAttributeList > const& xAttribs) const;
/// retrieve the node name for an element
- ElementName getName(OUString const& _sTag, SaxAttributeList const& xAttribs, ElementType::Enum eType = ElementType::unknown) const;
+ rtl::OUString getName(rtl::OUString const& _sTag, uno::Reference< sax::XAttributeList > const& xAttribs, ElementType::Enum eType = ElementType::unknown) const;
/// query whether the node has an operation
- Operation::Enum getOperation(SaxAttributeList const& xAttribs, ElementType::Enum _eType) const;
+ Operation::Enum getOperation(uno::Reference< sax::XAttributeList > const& xAttribs, ElementType::Enum _eType) const;
/// retrieve the language (if any) stored in the attribute list
- bool getLanguage(SaxAttributeList const& xAttribs, OUString & _rsLanguage) const;
+ bool getLanguage(uno::Reference< sax::XAttributeList > const& xAttribs, rtl::OUString & _rsLanguage) const;
/// reads attributes for nodes from the attribute list
- ElementInfo::FlagsType getNodeFlags(SaxAttributeList const& xAttribs, ElementType::Enum _eType) const;
+ sal_Int16 getNodeFlags(uno::Reference< sax::XAttributeList > const& xAttribs, ElementType::Enum _eType) const;
/// retrieve element type and associated module name of a set,
- bool getSetElementType(SaxAttributeList const& _xAttribs, OUString& _rsElementType, OUString& _rsElementTypeModule) const;
+ bool getSetElementType(uno::Reference< sax::XAttributeList > const& _xAttribs, rtl::OUString& _rsElementType, rtl::OUString& _rsElementTypeModule) const;
/// retrieve the instance type and associated module name of a instance,
- bool getInstanceType(SaxAttributeList const& _xAttribs, OUString& _rsElementType, OUString& _rsElementTypeModule) const;
+ bool getInstanceType(uno::Reference< sax::XAttributeList > const& _xAttribs, rtl::OUString& _rsElementType, rtl::OUString& _rsElementTypeModule) const;
/// retrieve the component for an import or uses element,
- bool getImportComponent(SaxAttributeList const& _xAttribs, OUString& _rsComponent) const;
+ bool getImportComponent(uno::Reference< sax::XAttributeList > const& _xAttribs, rtl::OUString& _rsComponent) const;
/// retrieve element type and associated module name of a set,
- uno::Type getPropertyValueType(SaxAttributeList const& _xAttribs) const;
+ uno::Type getPropertyValueType(uno::Reference< sax::XAttributeList > const& _xAttribs) const;
// throw( BadValueType )
/// reads a value attribute from the attribute list
- bool isNull(SaxAttributeList const& _xAttribs) const;
+ bool isNull(uno::Reference< sax::XAttributeList > const& _xAttribs) const;
/// reads a value attribute from the attribute list
- OUString getSeparator(SaxAttributeList const& _xAttribs) const;
+ rtl::OUString getSeparator(uno::Reference< sax::XAttributeList > const& _xAttribs) const;
// low-level internal methods
/// checks for presence of a boolean attribute and assigns its value if it exists (and is a bool)
- bool maybeGetAttribute(SaxAttributeList const& _xAttribs, OUString const& _aAttributeName, bool& _rbAttributeValue) const;
+ bool maybeGetAttribute(uno::Reference< sax::XAttributeList > const& _xAttribs, rtl::OUString const& _aAttributeName, bool& _rbAttributeValue) const;
/// checks for presence of an attribute and assigns its value if it exists
- bool maybeGetAttribute(SaxAttributeList const& _xAttribs, OUString const& _aAttributeName, OUString& _rsAttributeValue) const;
+ bool maybeGetAttribute(uno::Reference< sax::XAttributeList > const& _xAttribs, rtl::OUString const& _aAttributeName, rtl::OUString& _rsAttributeValue) const;
};
// -----------------------------------------------------------------------------
diff --git a/configmgr/source/xml/layerparser.cxx b/configmgr/source/xml/layerparser.cxx
index d2613570a9..10797b5a34 100644
--- a/configmgr/source/xml/layerparser.cxx
+++ b/configmgr/source/xml/layerparser.cxx
@@ -61,7 +61,7 @@ namespace configmgr
namespace sax = ::com::sun::star::xml::sax;
// -----------------------------------------------------------------------------
-LayerParser::LayerParser(Context const & _xContext, uno::Reference< backenduno::XLayerHandler > const & _xHandler)
+LayerParser::LayerParser(uno::Reference< uno::XComponentContext > const & _xContext, uno::Reference< backenduno::XLayerHandler > const & _xHandler)
: BasicParser(_xContext)
, m_xHandler(_xHandler)
, m_bRemoved(false)
@@ -69,7 +69,7 @@ LayerParser::LayerParser(Context const & _xContext, uno::Reference< backenduno::
{
if (!m_xHandler.is())
{
- OUString sMessage(RTL_CONSTASCII_USTRINGPARAM("Cannot create LayerParser: Unexpected NULL Handler"));
+ rtl::OUString sMessage(RTL_CONSTASCII_USTRINGPARAM("Cannot create LayerParser: Unexpected NULL Handler"));
throw uno::RuntimeException(sMessage, NULL);
}
}
@@ -111,7 +111,7 @@ void SAL_CALL LayerParser::endDocument( ) throw (sax::SAXException, uno::Runtim
}
// -----------------------------------------------------------------------------
-void SAL_CALL LayerParser::startElement( const OUString& aName, const uno::Reference< sax::XAttributeList >& xAttribs )
+void SAL_CALL LayerParser::startElement( const rtl::OUString& aName, const uno::Reference< sax::XAttributeList >& xAttribs )
throw (sax::SAXException, uno::RuntimeException)
{
if ( this->isSkipping() )
@@ -156,7 +156,7 @@ void SAL_CALL LayerParser::startElement( const OUString& aName, const uno::Refer
}
// -----------------------------------------------------------------------------
-void SAL_CALL LayerParser::endElement( const OUString& aName )
+void SAL_CALL LayerParser::endElement( const rtl::OUString& aName )
throw (sax::SAXException, uno::RuntimeException)
{
if ( this->wasSkipping(aName) )
@@ -341,7 +341,7 @@ void LayerParser::endValueData()
}
else if (this->isValueDataLocalized())
{
- OUString aLocale = this->getValueDataLocale();
+ rtl::OUString aLocale = this->getValueDataLocale();
m_xHandler->setPropertyValueForLocale(aValue,aLocale);
}
diff --git a/configmgr/source/xml/layerparser.hxx b/configmgr/source/xml/layerparser.hxx
index 2e5b8f1b4d..f871fbf85f 100644
--- a/configmgr/source/xml/layerparser.hxx
+++ b/configmgr/source/xml/layerparser.hxx
@@ -53,10 +53,7 @@ namespace configmgr
class LayerParser : public BasicParser
{
public:
- typedef uno::Reference< backenduno::XLayerHandler > HandlerRef;
-
- public:
- LayerParser(Context const & _xContext, HandlerRef const & _xHandler);
+ LayerParser(uno::Reference< uno::XComponentContext > const & _xContext, uno::Reference< backenduno::XLayerHandler > const & _xHandler);
virtual ~LayerParser();
// XDocumentHandler
@@ -69,11 +66,11 @@ namespace configmgr
endDocument( ) throw (sax::SAXException, uno::RuntimeException);
virtual void SAL_CALL
- startElement( const OUString& aName, const uno::Reference< sax::XAttributeList >& xAttribs )
+ startElement( const rtl::OUString& aName, const uno::Reference< sax::XAttributeList >& xAttribs )
throw (sax::SAXException, uno::RuntimeException);
virtual void SAL_CALL
- endElement( const OUString& aName )
+ endElement( const rtl::OUString& aName )
throw (sax::SAXException, uno::RuntimeException);
private:
@@ -106,7 +103,7 @@ namespace configmgr
bool isInRemoved() const { return m_bRemoved; }
void checkNotRemoved();
private:
- HandlerRef m_xHandler;
+ uno::Reference< backenduno::XLayerHandler > m_xHandler;
bool m_bRemoved;
bool m_bNewProp;
};
diff --git a/configmgr/source/xml/layerwriter.cxx b/configmgr/source/xml/layerwriter.cxx
index 68867d704a..8c47d0164f 100644
--- a/configmgr/source/xml/layerwriter.cxx
+++ b/configmgr/source/xml/layerwriter.cxx
@@ -55,7 +55,7 @@ namespace configmgr
// -----------------------------------------------------------------------------
uno::Reference< uno::XInterface > SAL_CALL instantiateLayerWriter
- ( CreationContext const& xContext )
+ ( uno::Reference< uno::XComponentContext > const& xContext )
{
return * new LayerWriter(xContext);
}
@@ -63,23 +63,21 @@ namespace configmgr
namespace
{
- typedef uno::Reference< script::XTypeConverter > TypeConverter;
-
static inline
- TypeConverter createTCV(LayerWriter::ServiceFactory const & _xSvcFactory)
+ uno::Reference< script::XTypeConverter > createTCV(uno::Reference< lang::XMultiServiceFactory > const & _xSvcFactory)
{
OSL_ENSURE(_xSvcFactory.is(),"Cannot create Write Formatter without a ServiceManager");
static const rtl::OUString k_sTCVService(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.script.Converter"));
- return TypeConverter::query(_xSvcFactory->createInstance(k_sTCVService));
+ return uno::Reference< script::XTypeConverter >::query(_xSvcFactory->createInstance(k_sTCVService));
}
// -----------------------------------------------------------------------------
static
void translateSAXException( sax::SAXException & aSAXException,
backenduno::XLayerHandler * context)
{
- OUString sMessage = aSAXException.Message;
+ rtl::OUString sMessage = aSAXException.Message;
uno::Any const & aWrappedException = aSAXException.WrappedException;
if (aWrappedException.hasValue())
@@ -116,7 +114,7 @@ namespace configmgr
{
OSL_ASSERT(anIOException.isExtractableTo(getIOExceptionType()));
io::IOException const * pException = static_cast<io::IOException const *>(anIOException.getValue());
- OUString sMessage = pException->Message;
+ rtl::OUString sMessage = pException->Message;
if (anIOException.isExtractableTo(getNotConnectedExceptionType()))
{
@@ -131,9 +129,9 @@ namespace configmgr
}
// -----------------------------------------------------------------------------
- LayerWriter::LayerWriter(CreationArg _xContext)
- : LayerWriterService_Base(_xContext)
- , m_xTCV( createTCV( LayerWriterService_Base::getServiceFactory() ) )
+ LayerWriter::LayerWriter(uno::Reference< uno::XComponentContext > const & _xContext)
+ : WriterService< ::com::sun::star::configuration::backend::XLayerHandler >(_xContext)
+ , m_xTCV( createTCV( WriterService< ::com::sun::star::configuration::backend::XLayerHandler >::getServiceFactory() ) )
, m_bInProperty(false)
, m_bStartedDocument(false)
{
@@ -183,7 +181,7 @@ namespace configmgr
}
// -----------------------------------------------------------------------------
- void SAL_CALL LayerWriter::overrideNode( const OUString& aName, sal_Int16 aAttributes, sal_Bool bClear )
+ void SAL_CALL LayerWriter::overrideNode( const rtl::OUString& aName, sal_Int16 aAttributes, sal_Bool bClear )
throw (backenduno::MalformedDataException, lang::WrappedTargetException,
uno::RuntimeException)
{
@@ -223,7 +221,7 @@ namespace configmgr
m_aFormatter.prepareElement(info);
}
- void SAL_CALL LayerWriter::addOrReplaceNode( const OUString& aName, sal_Int16 aAttributes )
+ void SAL_CALL LayerWriter::addOrReplaceNode( const rtl::OUString& aName, sal_Int16 aAttributes )
throw (backenduno::MalformedDataException, lang::WrappedTargetException,
uno::RuntimeException)
{
@@ -242,7 +240,7 @@ namespace configmgr
}
// -----------------------------------------------------------------------------
- void SAL_CALL LayerWriter::addOrReplaceNodeFromTemplate( const OUString& aName, const backenduno::TemplateIdentifier& aTemplate, sal_Int16 aAttributes )
+ void SAL_CALL LayerWriter::addOrReplaceNodeFromTemplate( const rtl::OUString& aName, const backenduno::TemplateIdentifier& aTemplate, sal_Int16 aAttributes )
throw (backenduno::MalformedDataException, lang::WrappedTargetException,
uno::RuntimeException)
{
@@ -278,7 +276,7 @@ namespace configmgr
}
// -----------------------------------------------------------------------------
- void SAL_CALL LayerWriter::dropNode( const OUString& aName )
+ void SAL_CALL LayerWriter::dropNode( const rtl::OUString& aName )
throw (backenduno::MalformedDataException, lang::WrappedTargetException,
uno::RuntimeException)
{
@@ -302,7 +300,7 @@ namespace configmgr
}
// -----------------------------------------------------------------------------
- void SAL_CALL LayerWriter::addProperty( const OUString& aName, sal_Int16 aAttributes, const uno::Type& aType )
+ void SAL_CALL LayerWriter::addProperty( const rtl::OUString& aName, sal_Int16 aAttributes, const uno::Type& aType )
throw (backenduno::MalformedDataException, lang::WrappedTargetException,
uno::RuntimeException)
{
@@ -327,7 +325,7 @@ namespace configmgr
}
// -----------------------------------------------------------------------------
- void SAL_CALL LayerWriter::addPropertyWithValue( const OUString& aName, sal_Int16 aAttributes, const uno::Any& aValue )
+ void SAL_CALL LayerWriter::addPropertyWithValue( const rtl::OUString& aName, sal_Int16 aAttributes, const uno::Any& aValue )
throw (backenduno::MalformedDataException, lang::WrappedTargetException,
uno::RuntimeException)
{
@@ -352,7 +350,7 @@ namespace configmgr
}
// -----------------------------------------------------------------------------
- void SAL_CALL LayerWriter::overrideProperty( const OUString& aName, sal_Int16 aAttributes, const uno::Type& aType, sal_Bool bClear )
+ void SAL_CALL LayerWriter::overrideProperty( const rtl::OUString& aName, sal_Int16 aAttributes, const uno::Type& aType, sal_Bool bClear )
throw (backenduno::MalformedDataException, lang::WrappedTargetException,
uno::RuntimeException)
{
@@ -407,7 +405,7 @@ namespace configmgr
}
// -----------------------------------------------------------------------------
- void SAL_CALL LayerWriter::setPropertyValueForLocale( const uno::Any& aValue, const OUString& aLocale )
+ void SAL_CALL LayerWriter::setPropertyValueForLocale( const uno::Any& aValue, const rtl::OUString& aLocale )
throw (backenduno::MalformedDataException, lang::WrappedTargetException,
uno::RuntimeException)
{
@@ -426,7 +424,7 @@ namespace configmgr
void LayerWriter::raiseMalformedDataException(sal_Char const * pMsg)
{
OSL_ASSERT(pMsg);
- OUString sMsg = OUString::createFromAscii(pMsg);
+ rtl::OUString sMsg = rtl::OUString::createFromAscii(pMsg);
throw backenduno::MalformedDataException( sMsg, *this, uno::Any() );
}
@@ -435,7 +433,7 @@ namespace configmgr
void LayerWriter::raiseIllegalTypeException(sal_Char const * pMsg)
{
OSL_ASSERT(pMsg);
- OUString sMsg = OUString::createFromAscii(pMsg);
+ rtl::OUString sMsg = rtl::OUString::createFromAscii(pMsg);
com::sun::star::beans::IllegalTypeException e( sMsg, *this );
throw backenduno::MalformedDataException( sMsg, *this, uno::makeAny(e) );
@@ -470,9 +468,9 @@ namespace configmgr
void LayerWriter::startNode()
{
- OUString sTag = m_aFormatter.getElementTag();
+ rtl::OUString sTag = m_aFormatter.getElementTag();
getWriteHandler()->startElement(sTag,m_aFormatter.getElementAttributes());
- getWriteHandler()->ignorableWhitespace(OUString());
+ getWriteHandler()->ignorableWhitespace(rtl::OUString());
m_aTagStack.push(sTag);
}
// -----------------------------------------------------------------------------
@@ -496,7 +494,7 @@ namespace configmgr
OSL_ASSERT(!m_aTagStack.empty()); // checks done elsewhere
getWriteHandler()->endElement(m_aTagStack.top());
- getWriteHandler()->ignorableWhitespace(OUString());
+ getWriteHandler()->ignorableWhitespace(rtl::OUString());
m_aTagStack.pop();
m_bInProperty = false;
@@ -510,7 +508,7 @@ namespace configmgr
}
// -----------------------------------------------------------------------------
- void LayerWriter::writeValue(uno::Any const & _aValue, OUString const & _aLocale)
+ void LayerWriter::writeValue(uno::Any const & _aValue, rtl::OUString const & _aLocale)
{
m_aFormatter.prepareSimpleElement( ElementType::value );
m_aFormatter.addLanguage(_aLocale);
@@ -524,16 +522,16 @@ namespace configmgr
aValueFormatter.addValueAttributes(m_aFormatter);
- OUString sTag = m_aFormatter.getElementTag();
- OUString sContent = aValueFormatter.getContent( this->m_xTCV );
+ rtl::OUString sTag = m_aFormatter.getElementTag();
+ rtl::OUString sContent = aValueFormatter.getContent( this->m_xTCV );
- SaxHandler xOut = getWriteHandler();
+ uno::Reference< sax::XDocumentHandler > xOut = getWriteHandler();
xOut->startElement(sTag, m_aFormatter.getElementAttributes());
if (sContent.getLength()) xOut->characters(sContent);
xOut->endElement(sTag);
- xOut->ignorableWhitespace(OUString());
+ xOut->ignorableWhitespace(rtl::OUString());
}
// -----------------------------------------------------------------------------
diff --git a/configmgr/source/xml/layerwriter.hxx b/configmgr/source/xml/layerwriter.hxx
index 10e801911f..f05c004146 100644
--- a/configmgr/source/xml/layerwriter.hxx
+++ b/configmgr/source/xml/layerwriter.hxx
@@ -55,11 +55,11 @@ namespace configmgr
// -----------------------------------------------------------------------------
- class LayerWriter : public LayerWriterService_Base
+ class LayerWriter : public WriterService< ::com::sun::star::configuration::backend::XLayerHandler >
{
public:
explicit
- LayerWriter(CreationArg _xContext);
+ LayerWriter(uno::Reference< uno::XComponentContext > const & _xContext);
virtual ~LayerWriter();
// XLayerHandler
@@ -75,17 +75,17 @@ namespace configmgr
uno::RuntimeException);
virtual void SAL_CALL
- overrideNode( const OUString& aName, sal_Int16 aAttributes, sal_Bool bClear )
+ overrideNode( const rtl::OUString& aName, sal_Int16 aAttributes, sal_Bool bClear )
throw (backenduno::MalformedDataException, lang::WrappedTargetException,
uno::RuntimeException);
virtual void SAL_CALL
- addOrReplaceNode( const OUString& aName, sal_Int16 aAttributes )
+ addOrReplaceNode( const rtl::OUString& aName, sal_Int16 aAttributes )
throw (backenduno::MalformedDataException, lang::WrappedTargetException,
uno::RuntimeException);
virtual void SAL_CALL
- addOrReplaceNodeFromTemplate( const OUString& aName, const backenduno::TemplateIdentifier& aTemplate, sal_Int16 aAttributes )
+ addOrReplaceNodeFromTemplate( const rtl::OUString& aName, const backenduno::TemplateIdentifier& aTemplate, sal_Int16 aAttributes )
throw (backenduno::MalformedDataException, lang::WrappedTargetException,
uno::RuntimeException);
@@ -95,22 +95,22 @@ namespace configmgr
uno::RuntimeException);
virtual void SAL_CALL
- dropNode( const OUString& aName )
+ dropNode( const rtl::OUString& aName )
throw (backenduno::MalformedDataException, lang::WrappedTargetException,
uno::RuntimeException);
virtual void SAL_CALL
- overrideProperty( const OUString& aName, sal_Int16 aAttributes, const uno::Type& aType, sal_Bool bClear )
+ overrideProperty( const rtl::OUString& aName, sal_Int16 aAttributes, const uno::Type& aType, sal_Bool bClear )
throw (backenduno::MalformedDataException, lang::WrappedTargetException,
uno::RuntimeException);
virtual void SAL_CALL
- addProperty( const OUString& aName, sal_Int16 aAttributes, const uno::Type& aType )
+ addProperty( const rtl::OUString& aName, sal_Int16 aAttributes, const uno::Type& aType )
throw (backenduno::MalformedDataException, lang::WrappedTargetException,
uno::RuntimeException);
virtual void SAL_CALL
- addPropertyWithValue( const OUString& aName, sal_Int16 aAttributes, const uno::Any& aValue )
+ addPropertyWithValue( const rtl::OUString& aName, sal_Int16 aAttributes, const uno::Any& aValue )
throw (backenduno::MalformedDataException, lang::WrappedTargetException,
uno::RuntimeException);
@@ -125,7 +125,7 @@ namespace configmgr
uno::RuntimeException);
virtual void SAL_CALL
- setPropertyValueForLocale( const uno::Any& aValue, const OUString& aLocale )
+ setPropertyValueForLocale( const uno::Any& aValue, const rtl::OUString& aLocale )
throw (backenduno::MalformedDataException, lang::WrappedTargetException,
uno::RuntimeException);
@@ -139,7 +139,7 @@ namespace configmgr
void endElement();
void writeValue(uno::Any const & _aValue);
- void writeValue(uno::Any const & _aValue, OUString const & _aLocale);
+ void writeValue(uno::Any const & _aValue, rtl::OUString const & _aLocale);
void outputValue(uno::Any const & _aValue);
@@ -150,9 +150,8 @@ namespace configmgr
rtl::OUString const & name, sal_Int16 attributes);
private:
- typedef Stack< OUString > TagStack;
uno::Reference< com::sun::star::script::XTypeConverter > m_xTCV;
- TagStack m_aTagStack;
+ Stack< rtl::OUString > m_aTagStack;
ElementFormatter m_aFormatter;
uno::Type m_aPropertyType;
bool m_bInProperty;
diff --git a/configmgr/source/xml/matchlocale.cxx b/configmgr/source/xml/matchlocale.cxx
index 0fbdc9def3..1e8f400811 100644
--- a/configmgr/source/xml/matchlocale.cxx
+++ b/configmgr/source/xml/matchlocale.cxx
@@ -43,7 +43,6 @@ namespace configmgr
namespace localehelper
{
// -----------------------------------------------------------------------------
- using ::rtl::OUString;
namespace uno = ::com::sun::star::uno;
namespace lang = ::com::sun::star::lang;
@@ -51,64 +50,63 @@ namespace configmgr
// -----------------------------------------------------------------------------
struct StaticLocale
{
- typedef char const * String;
- String aLanguage;
- String aCountry;
+ char const * aLanguage;
+ char const * aCountry;
};
- StaticLocale::String const c_sAnyLanguage = "*"; // exported !
- StaticLocale::String const c_sDefLanguage = "x-default"; // exported !
+ char const * const c_sAnyLanguage = "*"; // exported !
+ char const * const c_sDefLanguage = "x-default"; // exported !
- StaticLocale::String const c_sNoCountry = "";
+ char const * const c_sNoCountry = "";
- StaticLocale::String const c_sLanguageEnglish = "en";
- StaticLocale::String const c_sCountryUS = "US";
+ char const * const c_sLanguageEnglish = "en";
+ char const * const c_sCountryUS = "US";
StaticLocale const c_aFallbackLocales[] =
{
{ c_sLanguageEnglish, c_sCountryUS }, // english [cannot make 'en' better than 'en-US' :-(]
{ c_sAnyLanguage, c_sNoCountry } // just take the first you find
};
- SequencePos const c_nFallbackLocales = ARRAYSIZE(c_aFallbackLocales);
+ std::vector< com::sun::star::lang::Locale >::size_type const c_nFallbackLocales = ARRAYSIZE(c_aFallbackLocales);
// -----------------------------------------------------------------------------
- bool isAnyLanguage(OUString const & _sLanguage)
+ bool isAnyLanguage(rtl::OUString const & _sLanguage)
{
return !!_sLanguage.equalsAscii(c_sAnyLanguage);
}
// -----------------------------------------------------------------------------
- bool isDefaultLanguage(OUString const & _sLanguage)
+ bool isDefaultLanguage(rtl::OUString const & _sLanguage)
{
return !!_sLanguage.equalsAscii(c_sDefLanguage);
}
// -----------------------------------------------------------------------------
- OUString getAnyLanguage()
+ rtl::OUString getAnyLanguage()
{
- return OUString::createFromAscii( c_sAnyLanguage );
+ return rtl::OUString::createFromAscii( c_sAnyLanguage );
}
// -----------------------------------------------------------------------------
- OUString getDefaultLanguage()
+ rtl::OUString getDefaultLanguage()
{
- return OUString::createFromAscii( c_sDefLanguage );
+ return rtl::OUString::createFromAscii( c_sDefLanguage );
}
// -----------------------------------------------------------------------------
- Locale getAnyLocale()
+ com::sun::star::lang::Locale getAnyLocale()
{
- return Locale( getAnyLanguage(), OUString(), OUString() );
+ return com::sun::star::lang::Locale( getAnyLanguage(), rtl::OUString(), rtl::OUString() );
}
// -----------------------------------------------------------------------------
- Locale getDefaultLocale()
+ com::sun::star::lang::Locale getDefaultLocale()
{
- return Locale( getDefaultLanguage(), OUString(), OUString() );
+ return com::sun::star::lang::Locale( getDefaultLanguage(), rtl::OUString(), rtl::OUString() );
}
// -----------------------------------------------------------------------------
- static inline sal_Int32 countrySeparatorPos(OUString const& aLocaleName_)
+ static inline sal_Int32 countrySeparatorPos(rtl::OUString const& aLocaleName_)
{
sal_Int32 pos = aLocaleName_.indexOf('-');
if (pos == 1) // allow for x-LL or i-LL
@@ -120,7 +118,7 @@ namespace configmgr
return pos;
}
// -------------------------------------------------------------------------
- static inline sal_Int32 countryLength(OUString const& aLocaleName_, sal_Int32 nCountryPos)
+ static inline sal_Int32 countryLength(rtl::OUString const& aLocaleName_, sal_Int32 nCountryPos)
{
sal_Int32 pos1 = aLocaleName_.indexOf('.',nCountryPos);
sal_Int32 pos2 = aLocaleName_.indexOf('_',nCountryPos);
@@ -134,7 +132,7 @@ namespace configmgr
return pos2 - nCountryPos;
}
// -------------------------------------------------------------------------
- static inline void splitLocaleString(OUString const& aLocaleName_, OUString& rLanguage_, OUString& rCountry_)
+ static inline void splitLocaleString(rtl::OUString const& aLocaleName_, rtl::OUString& rLanguage_, rtl::OUString& rCountry_)
{
sal_Int32 nCountryPos = countrySeparatorPos(aLocaleName_);
if (nCountryPos >= 0)
@@ -149,20 +147,20 @@ namespace configmgr
else
{
rLanguage_ = aLocaleName_.toAsciiLowerCase();
- rCountry_ = OUString();
+ rCountry_ = rtl::OUString();
}
}
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
// conversion helpers
-Locale makeLocale(OUString const& sLocaleName_)
+com::sun::star::lang::Locale makeLocale(rtl::OUString const& sLocaleName_)
{
- Locale aResult;
+ com::sun::star::lang::Locale aResult;
splitLocaleString(sLocaleName_, aResult.Language, aResult.Country);
return aResult;
}
-OUString makeIsoLocale(Locale const& aUnoLocale_)
+rtl::OUString makeIsoLocale(com::sun::star::lang::Locale const& aUnoLocale_)
{
rtl::OUStringBuffer aResult(aUnoLocale_.Language.toAsciiLowerCase());
if (aUnoLocale_.Country.getLength())
@@ -172,20 +170,19 @@ OUString makeIsoLocale(Locale const& aUnoLocale_)
return aResult.makeStringAndClear();
}
static
-Locale makeLocale(StaticLocale const& aConstLocale_)
+com::sun::star::lang::Locale makeLocale(StaticLocale const& aConstLocale_)
{
- Locale aResult;
- aResult.Language = OUString::createFromAscii(aConstLocale_.aLanguage);
- aResult.Country = OUString::createFromAscii(aConstLocale_.aCountry);
+ com::sun::star::lang::Locale aResult;
+ aResult.Language = rtl::OUString::createFromAscii(aConstLocale_.aLanguage);
+ aResult.Country = rtl::OUString::createFromAscii(aConstLocale_.aCountry);
return aResult;
}
// -----------------------------------------------------------------------------
template <class T>
inline
-void addLocaleSeq_impl(T const* first, T const* last, LocaleSequence& rSeq)
+void addLocaleSeq_impl(T const* first, T const* last, std::vector< com::sun::star::lang::Locale >& rSeq)
{
- typedef Locale (* const XlateFunc)(T const&);
- XlateFunc xlate = &makeLocale;
+ com::sun::star::lang::Locale (* const xlate)(T const&) = &makeLocale;
std::transform(first, last, std::back_inserter(rSeq), xlate);
}
@@ -193,13 +190,13 @@ void addLocaleSeq_impl(T const* first, T const* last, LocaleSequence& rSeq)
// -----------------------------------------------------------------------------
template <class T>
inline
-LocaleSequence makeLocaleSeq_impl(uno::Sequence< T > const& aLocales_)
+std::vector< com::sun::star::lang::Locale > makeLocaleSeq_impl(uno::Sequence< T > const& aLocales_)
{
sal_Int32 const nLocaleCount = aLocales_.getLength();
T const* pLocaleBegin = aLocales_.getConstArray();
- LocaleSequence aResult;
+ std::vector< com::sun::star::lang::Locale > aResult;
aResult.reserve( nLocaleCount + c_nFallbackLocales ); // make room for fallback stuff as well
addLocaleSeq_impl(pLocaleBegin, pLocaleBegin + nLocaleCount, aResult);
@@ -208,42 +205,42 @@ LocaleSequence makeLocaleSeq_impl(uno::Sequence< T > const& aLocales_)
}
// -----------------------------------------------------------------------------
-void addFallbackLocales(LocaleSequence& aTargetList_)
+void addFallbackLocales(std::vector< com::sun::star::lang::Locale >& aTargetList_)
{
addLocaleSeq_impl(c_aFallbackLocales, c_aFallbackLocales + c_nFallbackLocales, aTargetList_);
}
// -----------------------------------------------------------------------------
-LocaleSequence makeLocaleSequence(uno::Sequence<OUString> const& sLocaleNames_)
+std::vector< com::sun::star::lang::Locale > makeLocaleSequence(uno::Sequence<rtl::OUString> const& sLocaleNames_)
{
return makeLocaleSeq_impl(sLocaleNames_);
}
// -----------------------------------------------------------------------------
-uno::Sequence<OUString> makeIsoSequence(LocaleSequence const& aLocales_)
+uno::Sequence<rtl::OUString> makeIsoSequence(std::vector< com::sun::star::lang::Locale > const& aLocales_)
{
- LocaleSequence::size_type const nLocaleCount = aLocales_.size();
+ std::vector< com::sun::star::lang::Locale >::size_type const nLocaleCount = aLocales_.size();
sal_Int32 const nSeqSize = sal_Int32(nLocaleCount);
OSL_ASSERT( nSeqSize >= 0 && sal_uInt32(nSeqSize) == nLocaleCount );
- uno::Sequence<OUString> aResult(nSeqSize);
+ uno::Sequence<rtl::OUString> aResult(nSeqSize);
std::transform(aLocales_.begin(), aLocales_.end(), aResult.getArray(), &makeIsoLocale);
return aResult;
}
// -----------------------------------------------------------------------------
-bool designatesAllLocales(Locale const& aLocale_)
+bool designatesAllLocales(com::sun::star::lang::Locale const& aLocale_)
{
return aLocale_.Language.equalsAscii(c_sAnyLanguage);
}
-bool designatesAllLocales(LocaleSequence const& aLocales_)
+bool designatesAllLocales(std::vector< com::sun::star::lang::Locale > const& aLocales_)
{
return aLocales_.size() <= 1 &&
(aLocales_.size() == 0 || designatesAllLocales(aLocales_));
}
// -----------------------------------------------------------------------------
-MatchQuality match(Locale const& aLocale_, Locale const& aTarget_)
+MatchQuality match(com::sun::star::lang::Locale const& aLocale_, com::sun::star::lang::Locale const& aTarget_)
{
// check language
if (!aLocale_.Language.equals(aTarget_.Language))
@@ -271,7 +268,7 @@ MatchQuality match(Locale const& aLocale_, Locale const& aTarget_)
// -----------------------------------------------------------------------------
/// check the given position and quality, if they are an improvement
-bool MatchResult::improve(SequencePos nPos_, MatchQuality eQuality_)
+bool MatchResult::improve(std::vector< com::sun::star::lang::Locale >::size_type nPos_, MatchQuality eQuality_)
{
// is this a match at all ?
if (eQuality_ == MISMATCH)
@@ -294,11 +291,11 @@ bool MatchResult::improve(SequencePos nPos_, MatchQuality eQuality_)
// -----------------------------------------------------------------------------
-bool isMatch(Locale const& aLocale_, LocaleSequence const& aTarget_, MatchQuality eRequiredQuality_)
+bool isMatch(com::sun::star::lang::Locale const& aLocale_, std::vector< com::sun::star::lang::Locale > const& aTarget_, MatchQuality eRequiredQuality_)
{
- SequencePos const nEnd = aTarget_.size();
+ std::vector< com::sun::star::lang::Locale >::size_type const nEnd = aTarget_.size();
- for (SequencePos nPos = 0; nPos < nEnd; ++nPos)
+ for (std::vector< com::sun::star::lang::Locale >::size_type nPos = 0; nPos < nEnd; ++nPos)
{
MatchQuality eQuality = match(aLocale_, aTarget_[nPos]);
if (eQuality >= eRequiredQuality_)
@@ -312,13 +309,13 @@ bool isMatch(Locale const& aLocale_, LocaleSequence const& aTarget_, MatchQualit
static
inline
-SequencePos getSearchLimitPosition(MatchResult const& aPrevMatch_,LocaleSequence const& aTarget_)
+std::vector< com::sun::star::lang::Locale >::size_type getSearchLimitPosition(MatchResult const& aPrevMatch_,std::vector< com::sun::star::lang::Locale > const& aTarget_)
{
- SequencePos nSize = aTarget_.size();
+ std::vector< com::sun::star::lang::Locale >::size_type nSize = aTarget_.size();
if (aPrevMatch_.isMatch())
{
- SequencePos nMatchPos = aPrevMatch_.position();
+ std::vector< com::sun::star::lang::Locale >::size_type nMatchPos = aPrevMatch_.position();
OSL_ENSURE(nMatchPos < nSize,"localehelper::getSearchLimitPosition: ERROR - previous position is out-of-bounds");
@@ -331,11 +328,11 @@ SequencePos getSearchLimitPosition(MatchResult const& aPrevMatch_,LocaleSequence
}
// -----------------------------------------------------------------------------
-bool improveMatch(MatchResult& rMatch_, Locale const& aLocale_, LocaleSequence const& aTarget_)
+bool improveMatch(MatchResult& rMatch_, com::sun::star::lang::Locale const& aLocale_, std::vector< com::sun::star::lang::Locale > const& aTarget_)
{
- SequencePos const nEnd = getSearchLimitPosition(rMatch_,aTarget_);
+ std::vector< com::sun::star::lang::Locale >::size_type const nEnd = getSearchLimitPosition(rMatch_,aTarget_);
- for (SequencePos nPos = 0; nPos < nEnd; ++nPos)
+ for (std::vector< com::sun::star::lang::Locale >::size_type nPos = 0; nPos < nEnd; ++nPos)
{
if (rMatch_.improve(nPos, match(aLocale_, aTarget_[nPos])))
{
@@ -352,21 +349,21 @@ bool improveMatch(MatchResult& rMatch_, Locale const& aLocale_, LocaleSequence c
// -----------------------------------------------------------------------------
inline
-void FindBestLocale::implSetTarget(LocaleSequence const& aTarget_)
+void FindBestLocale::implSetTarget(std::vector< com::sun::star::lang::Locale > const& aTarget_)
{
m_aTarget = aTarget_;
addFallbackLocales(m_aTarget);
}
// -----------------------------------------------------------------------------
-FindBestLocale::FindBestLocale(Locale const& aTarget_)
+FindBestLocale::FindBestLocale(com::sun::star::lang::Locale const& aTarget_)
{
- LocaleSequence aSeq(1,aTarget_);
+ std::vector< com::sun::star::lang::Locale > aSeq(1,aTarget_);
implSetTarget( aSeq );
}
// -----------------------------------------------------------------------------
-bool FindBestLocale::accept(Locale const& aLocale_)
+bool FindBestLocale::accept(com::sun::star::lang::Locale const& aLocale_)
{
return improveMatch(m_aResult, aLocale_, m_aTarget);
}
diff --git a/configmgr/source/xml/parsersvc.cxx b/configmgr/source/xml/parsersvc.cxx
index 7d4e0cf92c..9337d1700c 100644
--- a/configmgr/source/xml/parsersvc.cxx
+++ b/configmgr/source/xml/parsersvc.cxx
@@ -64,17 +64,17 @@ namespace configmgr
template <class BackendInterface>
struct ParserServiceTraits;
// -----------------------------------------------------------------------------
-static inline void clear(OUString & _rs) { _rs = OUString(); }
+static inline void clear(rtl::OUString & _rs) { _rs = rtl::OUString(); }
// -----------------------------------------------------------------------------
template <class BackendInterface>
-ParserService<BackendInterface>::ParserService(CreationArg _xContext)
+ParserService<BackendInterface>::ParserService(uno::Reference< uno::XComponentContext > const & _xContext)
: m_xContext(_xContext)
, m_aInputSource()
{
if (!m_xContext.is())
{
- OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Configuration Parser: NULL Context"));
+ rtl::OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Configuration Parser: NULL Context"));
throw uno::RuntimeException(sMessage,NULL);
}
}
@@ -99,13 +99,13 @@ void SAL_CALL
break;
{
- OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Cannot use argument to initialize a Configuration Parser"
+ rtl::OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Cannot use argument to initialize a Configuration Parser"
"- InputSource or XInputStream expected"));
throw lang::IllegalArgumentException(sMessage,*this,1);
}
default:
{
- OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Too many arguments to initialize a Configuration Parser"));
+ rtl::OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Too many arguments to initialize a Configuration Parser"));
throw lang::IllegalArgumentException(sMessage,*this,0);
}
}
@@ -175,17 +175,15 @@ void ParserService<BackendInterface>::parse(uno::Reference< sax::XDocumentHandle
{
OSL_PRECOND( _xHandler.is(), "ParserService: No SAX handler to parse to");
- typedef uno::Reference< sax::XParser > SaxParser;
-
rtl::OUString const k_sSaxParserService( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.xml.sax.Parser"));
uno::Reference< lang::XMultiComponentFactory > xServiceFactory = m_xContext->getServiceManager();
- SaxParser xParser = SaxParser::query( xServiceFactory->createInstanceWithContext(k_sSaxParserService,m_xContext) );
+ uno::Reference< sax::XParser > xParser = uno::Reference< sax::XParser >::query( xServiceFactory->createInstanceWithContext(k_sSaxParserService,m_xContext) );
if (!xParser.is())
{
- OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Configuration Parser: Cannot create SAX Parser"));
+ rtl::OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Configuration Parser: Cannot create SAX Parser"));
throw uno::RuntimeException(sMessage,*this);
}
@@ -201,7 +199,7 @@ void ParserService<BackendInterface>::parse(uno::Reference< sax::XDocumentHandle
catch (sax::SAXException & e)
{
uno::Any aWrapped = e.WrappedException.hasValue() ? e.WrappedException : uno::makeAny( e );
- OUString sSAXMessage = e.Message;
+ rtl::OUString sSAXMessage = e.Message;
// Expatwrap SAX service doubly wraps its errors ??
sax::SAXException eInner;
@@ -235,7 +233,7 @@ void ParserService<BackendInterface>::parse(uno::Reference< sax::XDocumentHandle
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
-AsciiServiceName const aSchemaParserServices[] =
+sal_Char const * const aSchemaParserServices[] =
{
"com.sun.star.configuration.backend.xml.SchemaParser",
0
@@ -247,7 +245,7 @@ const ServiceImplementationInfo aSchemaParserSI =
0
};
// -----------------------------------------------------------------------------
-AsciiServiceName const aLayerParserServices[] =
+sal_Char const * const aLayerParserServices[] =
{
"com.sun.star.configuration.backend.xml.LayerParser",
0
@@ -263,8 +261,6 @@ const ServiceImplementationInfo aLayerParserSI =
template <>
struct ParserServiceTraits< backenduno::XSchema >
{
- typedef backenduno::XSchemaHandler Handler;
-
static ServiceImplementationInfo const * getServiceInfo()
{ return & aSchemaParserSI; }
};
@@ -272,64 +268,54 @@ struct ParserServiceTraits< backenduno::XSchema >
template <>
struct ParserServiceTraits< backenduno::XLayer >
{
- typedef backenduno::XLayerHandler Handler;
-
static ServiceImplementationInfo const * getServiceInfo()
{ return & aLayerParserSI; }
};
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
-typedef ParserService< backenduno::XSchema > SchemaParserService_Base;
-
-class SchemaParserService : public SchemaParserService_Base
+class SchemaParserService : public ParserService< backenduno::XSchema >
{
public:
- typedef SchemaParser::HandlerRef HandlerArg;
-
- SchemaParserService(CreationArg _xContext)
- : SchemaParserService_Base(_xContext)
+ SchemaParserService(uno::Reference< uno::XComponentContext > const & _xContext)
+ : ParserService< backenduno::XSchema >(_xContext)
{
}
- virtual void SAL_CALL readSchema( HandlerArg const & aHandler )
+ virtual void SAL_CALL readSchema( uno::Reference< backenduno::XSchemaHandler > const & aHandler )
throw (backenduno::MalformedDataException, lang::WrappedTargetException,
lang::NullPointerException, uno::RuntimeException);
- virtual void SAL_CALL readComponent( HandlerArg const & aHandler )
+ virtual void SAL_CALL readComponent( uno::Reference< backenduno::XSchemaHandler > const & aHandler )
throw (backenduno::MalformedDataException, lang::WrappedTargetException,
lang::NullPointerException, uno::RuntimeException);
- virtual void SAL_CALL readTemplates( HandlerArg const & aHandler )
+ virtual void SAL_CALL readTemplates( uno::Reference< backenduno::XSchemaHandler > const & aHandler )
throw (backenduno::MalformedDataException, lang::WrappedTargetException,
lang::NullPointerException, uno::RuntimeException);
};
// -----------------------------------------------------------------------------
-typedef ParserService< backenduno::XLayer > LayerParserService_Base;
-
-class LayerParserService : public LayerParserService_Base
+class LayerParserService : public ParserService< backenduno::XLayer >
{
public:
- typedef LayerParser::HandlerRef HandlerArg;
-
- LayerParserService(CreationArg _xContext)
- : LayerParserService_Base(_xContext)
+ LayerParserService(uno::Reference< uno::XComponentContext > const & _xContext)
+ : ParserService< backenduno::XLayer >(_xContext)
{
}
- virtual void SAL_CALL readData( HandlerArg const & aHandler )
+ virtual void SAL_CALL readData( uno::Reference< backenduno::XLayerHandler > const & aHandler )
throw (backenduno::MalformedDataException, lang::WrappedTargetException,
lang::NullPointerException, uno::RuntimeException);
};
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
-uno::Reference< uno::XInterface > SAL_CALL instantiateSchemaParser( CreationContext const& xContext )
+uno::Reference< uno::XInterface > SAL_CALL instantiateSchemaParser( uno::Reference< uno::XComponentContext > const& xContext )
{
return * new SchemaParserService(xContext);
}
-uno::Reference< uno::XInterface > SAL_CALL instantiateLayerParser( CreationContext const& xContext )
+uno::Reference< uno::XInterface > SAL_CALL instantiateLayerParser( uno::Reference< uno::XComponentContext > const& xContext )
{
return * new LayerParserService(xContext);
}
@@ -340,11 +326,11 @@ const ServiceRegistrationInfo* getLayerParserServiceInfo()
{ return getRegistrationInfo(& aLayerParserSI); }
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
-static OUString nullHandlerMessage(char const * where)
+static rtl::OUString nullHandlerMessage(char const * where)
{
OSL_ASSERT(where);
- OUString msg = OUString::createFromAscii(where);
- return msg.concat(OUString::createFromAscii(": Error - NULL handler passed."));
+ rtl::OUString msg = rtl::OUString::createFromAscii(where);
+ return msg.concat(rtl::OUString::createFromAscii(": Error - NULL handler passed."));
}
// -----------------------------------------------------------------------------
void SAL_CALL SchemaParserService::readSchema( uno::Reference< backenduno::XSchemaHandler > const & aHandler )
@@ -354,7 +340,7 @@ void SAL_CALL SchemaParserService::readSchema( uno::Reference< backenduno::XSche
if (!aHandler.is())
throw lang::NullPointerException(nullHandlerMessage("SchemaParserService::readSchema"),*this);
- SaxHandler xHandler = new SchemaParser(this->getContext(),aHandler, SchemaParser::selectAll);
+ uno::Reference< sax::XDocumentHandler > xHandler = new SchemaParser(this->getContext(),aHandler, SchemaParser::selectAll);
this->parse( xHandler );
}
// -----------------------------------------------------------------------------
@@ -365,7 +351,7 @@ void SAL_CALL SchemaParserService::readComponent( uno::Reference< backenduno::XS
if (!aHandler.is())
throw lang::NullPointerException(nullHandlerMessage("SchemaParserService::readComponent"),*this);
- SaxHandler xHandler = new SchemaParser(this->getContext(),aHandler, SchemaParser::selectComponent);
+ uno::Reference< sax::XDocumentHandler > xHandler = new SchemaParser(this->getContext(),aHandler, SchemaParser::selectComponent);
this->parse( xHandler );
}
// -----------------------------------------------------------------------------
@@ -376,7 +362,7 @@ void SAL_CALL SchemaParserService::readTemplates( uno::Reference< backenduno::XS
if (!aHandler.is())
throw lang::NullPointerException(nullHandlerMessage("SchemaParserService::readTemplates"),*this);
- SaxHandler xHandler = new SchemaParser(this->getContext(),aHandler, SchemaParser::selectTemplates);
+ uno::Reference< sax::XDocumentHandler > xHandler = new SchemaParser(this->getContext(),aHandler, SchemaParser::selectTemplates);
this->parse( xHandler );
}
// -----------------------------------------------------------------------------
@@ -387,7 +373,7 @@ void SAL_CALL LayerParserService::readData( uno::Reference< backenduno::XLayerHa
if (!aHandler.is())
throw lang::NullPointerException(nullHandlerMessage("LayerParserService::readData"),*this);
- SaxHandler xHandler = new LayerParser(this->getContext(),aHandler);
+ uno::Reference< sax::XDocumentHandler > xHandler = new LayerParser(this->getContext(),aHandler);
this->parse( xHandler );
}
// -----------------------------------------------------------------------------
diff --git a/configmgr/source/xml/parsersvc.hxx b/configmgr/source/xml/parsersvc.hxx
index 82b60acd4f..99afeae76f 100644
--- a/configmgr/source/xml/parsersvc.hxx
+++ b/configmgr/source/xml/parsersvc.hxx
@@ -46,7 +46,6 @@ namespace configmgr
namespace xml
{
// -----------------------------------------------------------------------------
- using rtl::OUString;
namespace uno = ::com::sun::star::uno;
namespace lang = ::com::sun::star::lang;
namespace io = ::com::sun::star::io;
@@ -62,10 +61,8 @@ namespace configmgr
>
{
public:
- typedef uno::Reference< uno::XComponentContext > const & CreationArg;
-
explicit
- ParserService(CreationArg _xContext);
+ ParserService(uno::Reference< uno::XComponentContext > const & _xContext);
// XInitialization
virtual void SAL_CALL
@@ -95,17 +92,14 @@ namespace configmgr
throw (uno::RuntimeException);
protected:
- typedef uno::Reference< sax::XDocumentHandler > SaxHandler;
- typedef uno::Reference< uno::XComponentContext > Context;
-
- Context getContext() const
+ uno::Reference< uno::XComponentContext > getContext() const
{ return m_xContext; }
- void parse(SaxHandler const & _xHandler);
+ void parse(uno::Reference< sax::XDocumentHandler > const & _xHandler);
// throw (backenduno::MalformedDataException, lang::WrappedTargetException, uno::RuntimeException);
private:
- Context m_xContext;
+ uno::Reference< uno::XComponentContext > m_xContext;
sax::InputSource m_aInputSource;
static ServiceInfoHelper getServiceInfo();
diff --git a/configmgr/source/xml/schemaparser.cxx b/configmgr/source/xml/schemaparser.cxx
index 6c9db72475..83d7efa766 100644
--- a/configmgr/source/xml/schemaparser.cxx
+++ b/configmgr/source/xml/schemaparser.cxx
@@ -60,7 +60,7 @@ namespace configmgr
namespace sax = ::com::sun::star::xml::sax;
// -----------------------------------------------------------------------------
-SchemaParser::SchemaParser(Context const & _xContext, uno::Reference< backenduno::XSchemaHandler > const & _xHandler, Select _selector)
+SchemaParser::SchemaParser(uno::Reference< uno::XComponentContext > const & _xContext, uno::Reference< backenduno::XSchemaHandler > const & _xHandler, Select _selector)
: BasicParser(_xContext)
, m_xHandler(_xHandler)
, m_sComponent()
@@ -69,7 +69,7 @@ SchemaParser::SchemaParser(Context const & _xContext, uno::Reference< backenduno
{
if (!m_xHandler.is())
{
- OUString sMessage(RTL_CONSTASCII_USTRINGPARAM("Cannot create SchemaParser: Unexpected NULL Handler"));
+ rtl::OUString sMessage(RTL_CONSTASCII_USTRINGPARAM("Cannot create SchemaParser: Unexpected NULL Handler"));
throw uno::RuntimeException(sMessage, *this);
}
OSL_ENSURE(m_selector != selectNone, "Warning: Schema handler will handle no part of the schema");
@@ -88,7 +88,7 @@ void SAL_CALL SchemaParser::startDocument( )
OSL_ENSURE(isEmptyNode(), "BasicParser does not mark new document as empty");
- m_sComponent = OUString();
+ m_sComponent = rtl::OUString();
m_selected = selectNone;
}
// -----------------------------------------------------------------------------
@@ -104,7 +104,7 @@ void SAL_CALL SchemaParser::endDocument( ) throw (sax::SAXException, uno::Runti
}
// -----------------------------------------------------------------------------
-void SAL_CALL SchemaParser::startElement( const OUString& aName, const uno::Reference< sax::XAttributeList >& xAttribs )
+void SAL_CALL SchemaParser::startElement( const rtl::OUString& aName, const uno::Reference< sax::XAttributeList >& xAttribs )
throw (sax::SAXException, uno::RuntimeException)
{
if ( this->isSkipping() )
@@ -187,7 +187,7 @@ void SAL_CALL SchemaParser::startElement( const OUString& aName, const uno::Refe
}
// -----------------------------------------------------------------------------
-void SAL_CALL SchemaParser::endElement( const OUString& aName )
+void SAL_CALL SchemaParser::endElement( const rtl::OUString& aName )
throw (sax::SAXException, uno::RuntimeException)
{
if ( this->wasSkipping(aName) )
@@ -225,7 +225,7 @@ void SchemaParser::startSchema( ElementInfo const & aInfo, const uno::Reference<
void SchemaParser::endSchema( )
{
m_xHandler->endSchema();
- m_sComponent = OUString();
+ m_sComponent = rtl::OUString();
}
// -----------------------------------------------------------------------------
@@ -266,7 +266,7 @@ void SchemaParser::endSection( )
void SchemaParser::handleImport( ElementInfo const & /*aInfo*/, const uno::Reference< sax::XAttributeList >& xAttribs )
{
- OUString aComponent;
+ rtl::OUString aComponent;
if (getDataParser().getImportComponent(xAttribs,aComponent))
m_xHandler->importComponent(aComponent);
@@ -305,25 +305,23 @@ void SchemaParser::startNode( ElementInfo const & aInfo, const uno::Reference< s
OSL_ASSERT(aInfo.type == ElementType::set || aInfo.type == ElementType::group);
- using backenduno::TemplateIdentifier;
-
if (aInfo.type == ElementType::group)
{
if (bStartTemplate)
- m_xHandler->startGroupTemplate( TemplateIdentifier(aInfo.name,m_sComponent), aInfo.flags );
+ m_xHandler->startGroupTemplate( backenduno::TemplateIdentifier(aInfo.name,m_sComponent), aInfo.flags );
else
m_xHandler->startGroup( aInfo.name, aInfo.flags );
}
else
{
- TemplateIdentifier aItemType;
+ backenduno::TemplateIdentifier aItemType;
if (!getDataParser().getSetElementType(xAttribs, aItemType.Name, aItemType.Component))
raiseParseException("Schema XML parser - Invalid data: Missing item-type information for set node.\n");
if (bStartTemplate)
- m_xHandler->startSetTemplate( TemplateIdentifier(aInfo.name,m_sComponent), aInfo.flags, aItemType );
+ m_xHandler->startSetTemplate( backenduno::TemplateIdentifier(aInfo.name,m_sComponent), aInfo.flags, aItemType );
else
m_xHandler->startSet( aInfo.name, aInfo.flags, aItemType );
diff --git a/configmgr/source/xml/schemaparser.hxx b/configmgr/source/xml/schemaparser.hxx
index cd3235e6f1..0c6e1ec999 100644
--- a/configmgr/source/xml/schemaparser.hxx
+++ b/configmgr/source/xml/schemaparser.hxx
@@ -53,7 +53,6 @@ namespace configmgr
class SchemaParser : public BasicParser
{
public:
- typedef uno::Reference< backenduno::XSchemaHandler > HandlerRef;
enum Select {
selectNone = 0,
selectComponent = 0x01,
@@ -62,7 +61,7 @@ namespace configmgr
};
public:
- SchemaParser(Context const & _xContext, HandlerRef const & _xHandler, Select _selector);
+ SchemaParser(uno::Reference< uno::XComponentContext > const & _xContext, uno::Reference< backenduno::XSchemaHandler > const & _xHandler, Select _selector);
virtual ~SchemaParser();
// XDocumentHandler
@@ -75,11 +74,11 @@ namespace configmgr
endDocument( ) throw (sax::SAXException, uno::RuntimeException);
virtual void SAL_CALL
- startElement( const OUString& aName, const uno::Reference< sax::XAttributeList >& xAttribs )
+ startElement( const rtl::OUString& aName, const uno::Reference< sax::XAttributeList >& xAttribs )
throw (sax::SAXException, uno::RuntimeException);
virtual void SAL_CALL
- endElement( const OUString& aName )
+ endElement( const rtl::OUString& aName )
throw (sax::SAXException, uno::RuntimeException);
private:
@@ -119,8 +118,8 @@ namespace configmgr
bool isSelected() const { return m_selected != selectNone; }
bool select(Select _select);
private:
- HandlerRef m_xHandler;
- OUString m_sComponent;
+ uno::Reference< backenduno::XSchemaHandler > m_xHandler;
+ rtl::OUString m_sComponent;
Select m_selector;
Select m_selected;
};
diff --git a/configmgr/source/xml/typeconverter.cxx b/configmgr/source/xml/typeconverter.cxx
index 7a17a7800d..a422073a0d 100644
--- a/configmgr/source/xml/typeconverter.cxx
+++ b/configmgr/source/xml/typeconverter.cxx
@@ -52,7 +52,7 @@ namespace configmgr
//--------------------------------------------------------------------------------------------------
rtl::OUString toString(const uno::Reference< script::XTypeConverter >& xTypeConverter, const uno::Any& rValue)
- CFG_UNO_THROW1( script::CannotConvertException )
+ SAL_THROW((script::CannotConvertException , com::sun::star::uno::RuntimeException))
{
rtl::OUString aRes;
uno::TypeClass aDestinationClass = rValue.getValueType().getTypeClass();
@@ -96,7 +96,7 @@ namespace configmgr
}
uno::Any toAny(const uno::Reference< script::XTypeConverter >& xTypeConverter, const ::rtl::OUString& _rValue,const uno::TypeClass& _rTypeClass)
- CFG_UNO_THROW1( script::CannotConvertException )
+ SAL_THROW((script::CannotConvertException , com::sun::star::uno::RuntimeException))
{
uno::Any aRes;
diff --git a/configmgr/source/xml/valueconverter.cxx b/configmgr/source/xml/valueconverter.cxx
index 80333ac754..7143dd6260 100644
--- a/configmgr/source/xml/valueconverter.cxx
+++ b/configmgr/source/xml/valueconverter.cxx
@@ -41,19 +41,14 @@ inline sal_Bool rtl_ascii_isWhitespace( sal_Unicode ch )
namespace configmgr
{
- using rtl::OUString;
- using namespace com::sun::star::uno;
- using namespace std;
-// -----------------------------------------------------------------------------
- typedef ValueConverter::StringList StringList;
// -----------------------------------------------------------------------------
static
-void throwConversionError(sal_Char const* pErrorMsg) CFG_THROW1( script::CannotConvertException )
+void throwConversionError(sal_Char const* pErrorMsg) SAL_THROW((script::CannotConvertException))
{
OSL_ENSURE(false, pErrorMsg);
script::CannotConvertException error;
- error.Message = OUString::createFromAscii(pErrorMsg);
+ error.Message = rtl::OUString::createFromAscii(pErrorMsg);
throw error;
}
// -----------------------------------------------------------------------------
@@ -67,7 +62,7 @@ bool charInRange(Char ch, char from, char to) throw()
// -----------------------------------------------------------------------------
static
inline
-unsigned makeHexNibble(unsigned char ch) CFG_THROW1 ( script::CannotConvertException)
+unsigned makeHexNibble(unsigned char ch) SAL_THROW((script::CannotConvertException))
{
unsigned nRet = 0;
@@ -85,7 +80,7 @@ unsigned makeHexNibble(unsigned char ch) CFG_THROW1 ( script::CannotConvertExcep
// -----------------------------------------------------------------------------
static
inline
-unsigned readHexNibble(sal_Unicode ch) CFG_THROW1 ( script::CannotConvertException)
+unsigned readHexNibble(sal_Unicode ch) SAL_THROW((script::CannotConvertException))
{
if (!charInRange(ch, 0, 127)) throwConversionError("Non-Ascii Character in binary value");
@@ -95,7 +90,7 @@ unsigned readHexNibble(sal_Unicode ch) CFG_THROW1 ( script::CannotConvertExcepti
// -----------------------------------------------------------------------------
static
inline
-unsigned int readHexByte(sal_Unicode const*& pStr) CFG_THROW1 ( script::CannotConvertException)
+unsigned int readHexByte(sal_Unicode const*& pStr) SAL_THROW((script::CannotConvertException))
{
register unsigned int nHigh = readHexNibble(*pStr++);
register unsigned int nLow = readHexNibble(*pStr++);
@@ -104,8 +99,8 @@ unsigned int readHexByte(sal_Unicode const*& pStr) CFG_THROW1 ( script::CannotCo
// -----------------------------------------------------------------------------
static
-void parseHexBinary(OUString const& aHexString_, uno::Sequence<sal_Int8>& rBinarySeq_)
- CFG_UNO_THROW1 ( script::CannotConvertException )
+void parseHexBinary(rtl::OUString const& aHexString_, uno::Sequence<sal_Int8>& rBinarySeq_)
+ SAL_THROW((script::CannotConvertException , com::sun::star::uno::RuntimeException))
{
// PRE: aBinaryString with HexCode
// POST: rBinarySeq with the to Hex converted String
@@ -127,8 +122,8 @@ void parseHexBinary(OUString const& aHexString_, uno::Sequence<sal_Int8>& rBinar
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
-uno::Sequence<sal_Int8> ValueConverter::parseBinary(OUString const& aBinaryString_) const
- CFG_UNO_THROW1 ( script::CannotConvertException)
+uno::Sequence<sal_Int8> ValueConverter::parseBinary(rtl::OUString const& aBinaryString_) const
+ SAL_THROW((script::CannotConvertException, com::sun::star::uno::RuntimeException))
{
uno::Sequence<sal_Int8> aResultSeq;
@@ -153,8 +148,8 @@ bool ValueConverter::isList() const
}
// -----------------------------------------------------------------------------
-uno::Any ValueConverter::convertToAny(OUString const& aContent) const
- CFG_UNO_THROW1( script::CannotConvertException)
+uno::Any ValueConverter::convertToAny(rtl::OUString const& aContent) const
+ SAL_THROW((script::CannotConvertException, com::sun::star::uno::RuntimeException))
{
uno::Any aValue;
@@ -166,7 +161,7 @@ uno::Any ValueConverter::convertToAny(OUString const& aContent) const
else if (this->isList())
{
- StringList aContentList;
+ std::vector< rtl::OUString > aContentList;
splitListData(aContent, aContentList);
convertListToAny(aContentList, aValue);
}
@@ -180,8 +175,8 @@ uno::Any ValueConverter::convertToAny(OUString const& aContent) const
}
// -----------------------------------------------------------------------------
-bool ValueConverter::convertScalarToAny(OUString const& aContent, uno::Any& rValue) const
- CFG_UNO_THROW1 ( script::CannotConvertException )
+bool ValueConverter::convertScalarToAny(rtl::OUString const& aContent, uno::Any& rValue) const
+ SAL_THROW((script::CannotConvertException , com::sun::star::uno::RuntimeException))
{
OSL_PRECOND(!this->isNull(),"ValueConverter::convertScalarToAny - check for NULL before calling");
OSL_ENSURE(m_aType.getTypeClass() != uno::TypeClass_ANY,"'Any' values must be NULL");
@@ -189,7 +184,7 @@ bool ValueConverter::convertScalarToAny(OUString const& aContent, uno::Any& rVal
// check for Binary
if (m_aType == getBinaryType())
{
- Sequence<sal_Int8> aBinarySeq = parseBinary(aContent);
+ com::sun::star::uno::Sequence<sal_Int8> aBinarySeq = parseBinary(aContent);
rValue <<= aBinarySeq;
}
@@ -203,8 +198,8 @@ bool ValueConverter::convertScalarToAny(OUString const& aContent, uno::Any& rVal
// -----------------------------------------------------------------------------
template <class T>
-bool convertListToSequence(StringList const& aStringList, uno::Sequence< T >& rSequence, uno::TypeClass aElementTypeClass, ValueConverter const& rConverter)
- CFG_UNO_THROW1 ( script::CannotConvertException )
+bool convertListToSequence(std::vector< rtl::OUString > const& aStringList, uno::Sequence< T >& rSequence, uno::TypeClass aElementTypeClass, ValueConverter const& rConverter)
+ SAL_THROW((script::CannotConvertException , com::sun::star::uno::RuntimeException))
{
OSL_ASSERT(aElementTypeClass == ::getCppuType(static_cast<T const*>(0)).getTypeClass());
@@ -212,7 +207,7 @@ bool convertListToSequence(StringList const& aStringList, uno::Sequence< T >& rS
sal_uInt32 nPos = 0;
- for(StringList::const_iterator it = aStringList.begin();
+ for(std::vector< rtl::OUString >::const_iterator it = aStringList.begin();
it != aStringList.end();
++it)
{
@@ -243,7 +238,7 @@ bool convertListToSequence(StringList const& aStringList, uno::Sequence< T >& rS
static
inline
-void stringListToSequence(uno::Sequence< OUString > & rSequence, StringList const & aStringList)
+void stringListToSequence(uno::Sequence< rtl::OUString > & rSequence, std::vector< rtl::OUString > const & aStringList)
{
rSequence .realloc( aStringList.size() );
@@ -253,32 +248,32 @@ void stringListToSequence(uno::Sequence< OUString > & rSequence, StringList cons
static
inline
-StringList sequenceToStringList(uno::Sequence< OUString > const & aSequence)
+std::vector< rtl::OUString > sequenceToStringList(uno::Sequence< rtl::OUString > const & aSequence)
{
- OUString const * const pBegin = aSequence.getConstArray();
- OUString const * const pEnd = pBegin + aSequence.getLength();
+ rtl::OUString const * const pBegin = aSequence.getConstArray();
+ rtl::OUString const * const pEnd = pBegin + aSequence.getLength();
- return StringList(pBegin,pEnd);
+ return std::vector< rtl::OUString >(pBegin,pEnd);
}
// -----------------------------------------------------------------------------
-uno::Sequence< OUString > ValueConverter::splitStringList(OUString const& aContent) const
+uno::Sequence< rtl::OUString > ValueConverter::splitStringList(rtl::OUString const& aContent) const
{
- StringList aList;
+ std::vector< rtl::OUString > aList;
splitListData(aContent, aList);
- uno::Sequence< OUString > aResult;
+ uno::Sequence< rtl::OUString > aResult;
stringListToSequence(aResult,aList);
return aResult;
}
// -----------------------------------------------------------------------------
-uno::Any ValueConverter::convertListToAny(uno::Sequence< OUString > const& aContentList) const
- CFG_UNO_THROW1( script::CannotConvertException )
+uno::Any ValueConverter::convertListToAny(uno::Sequence< rtl::OUString > const& aContentList) const
+ SAL_THROW((script::CannotConvertException , com::sun::star::uno::RuntimeException))
{
uno::Any aResult;
- StringList const aStringList = sequenceToStringList(aContentList);
+ std::vector< rtl::OUString > const aStringList = sequenceToStringList(aContentList);
convertListToAny(aStringList,aResult);
return aResult;
}
@@ -286,8 +281,8 @@ uno::Any ValueConverter::convertListToAny(uno::Sequence< OUString > const& aCont
// special overload for binary sequence
// template<> // use an explicit specialization
-bool convertListToSequence(StringList const& aStringList, uno::Sequence< uno::Sequence<sal_Int8> >& rSequence, uno::TypeClass aElementTypeClass, ValueConverter const& rParser )
- CFG_UNO_THROW1 ( script::CannotConvertException )
+bool convertListToSequence(std::vector< rtl::OUString > const& aStringList, uno::Sequence< uno::Sequence<sal_Int8> >& rSequence, uno::TypeClass aElementTypeClass, ValueConverter const& rParser )
+ SAL_THROW((script::CannotConvertException , com::sun::star::uno::RuntimeException))
{
{ (void)aElementTypeClass; }
OSL_ASSERT(aElementTypeClass == uno::TypeClass_SEQUENCE);
@@ -296,7 +291,7 @@ bool convertListToSequence(StringList const& aStringList, uno::Sequence< uno::Se
sal_uInt32 nPos = 0;
- for(StringList::const_iterator it = aStringList.begin();
+ for(std::vector< rtl::OUString >::const_iterator it = aStringList.begin();
it != aStringList.end();
++it)
{
@@ -309,8 +304,8 @@ bool convertListToSequence(StringList const& aStringList, uno::Sequence< uno::Se
// special overload for string sequence
// template<> // use an explicit specialization
-bool convertListToSequence(StringList const& aStringList, uno::Sequence< OUString >& rSequence, uno::TypeClass aElementTypeClass, ValueConverter const& /*rParser*/ )
- CFG_UNO_THROW1 ( script::CannotConvertException )
+bool convertListToSequence(std::vector< rtl::OUString > const& aStringList, uno::Sequence< rtl::OUString >& rSequence, uno::TypeClass aElementTypeClass, ValueConverter const& /*rParser*/ )
+ SAL_THROW((script::CannotConvertException , com::sun::star::uno::RuntimeException))
{
{ (void)aElementTypeClass; }
OSL_ASSERT(aElementTypeClass == uno::TypeClass_STRING);
@@ -325,13 +320,13 @@ bool convertListToSequence(StringList const& aStringList, uno::Sequence< OUStrin
#define MAYBE_EXTRACT_SEQUENCE( type ) \
if (aElementType == ::getCppuType( (type const *)0)) \
{ \
- Sequence< type > aSequence; \
+ com::sun::star::uno::Sequence< type > aSequence; \
convertListToSequence(aContentList,aSequence,aElementTypeClass, *this); \
rValue <<= aSequence; \
}
-bool ValueConverter::convertListToAny(StringList const& aContentList, uno::Any& rValue) const
- CFG_UNO_THROW1 ( script::CannotConvertException )
+bool ValueConverter::convertListToAny(std::vector< rtl::OUString > const& aContentList, uno::Any& rValue) const
+ SAL_THROW((script::CannotConvertException , com::sun::star::uno::RuntimeException))
{
OSL_PRECOND(!this->isNull(),"ValueConverter::convertListToAny - check for NULL before calling");
OSL_ENSURE(m_aType.getTypeClass() == uno::TypeClass_SEQUENCE,"'Any' not allowed for lists");
@@ -341,7 +336,7 @@ bool ValueConverter::convertListToAny(StringList const& aContentList, uno::Any&
OSL_ENSURE(aElementTypeClass != uno::TypeClass_ANY,"'Any' not allowed for list elements");
- MAYBE_EXTRACT_SEQUENCE( OUString )
+ MAYBE_EXTRACT_SEQUENCE( rtl::OUString )
else
MAYBE_EXTRACT_SEQUENCE( sal_Bool )
else
@@ -353,7 +348,7 @@ bool ValueConverter::convertListToAny(StringList const& aContentList, uno::Any&
else
MAYBE_EXTRACT_SEQUENCE( double )
else
- MAYBE_EXTRACT_SEQUENCE( Sequence<sal_Int8> )
+ MAYBE_EXTRACT_SEQUENCE( com::sun::star::uno::Sequence<sal_Int8> )
else
{
OSL_ENSURE(false, "Unknown element type in list");
@@ -374,18 +369,18 @@ namespace
static inline bool isWhitespace(sal_Unicode ch)
{
// note: for definition of whitescape see also
- // canUseWhitespace(OUString const&)
+ // canUseWhitespace(rtl::OUString const&)
// in xmlformater.cxx
// -----------------------------------------------------------------------------
return rtl_ascii_isWhitespace(ch) ? true : false;
}
- sal_Int32 findFirstTokenStart(OUString const& sText) const CFG_NOTHROW()
+ sal_Int32 findFirstTokenStart(rtl::OUString const& sText) const SAL_THROW(())
{
return findNextTokenStart(sText,0);
}
- sal_Int32 findNextTokenStart(OUString const& sText, sal_Int32 nPrevTokenEnd) const CFG_NOTHROW()
+ sal_Int32 findNextTokenStart(rtl::OUString const& sText, sal_Int32 nPrevTokenEnd) const SAL_THROW(())
{
sal_Int32 const nEnd = sText.getLength();
sal_Int32 nPos = nPrevTokenEnd;
@@ -404,7 +399,7 @@ namespace
return NO_MORE_TOKENS;
}
- sal_Int32 findTokenEnd(OUString const& sText, sal_Int32 nTokenStart) const CFG_NOTHROW()
+ sal_Int32 findTokenEnd(rtl::OUString const& sText, sal_Int32 nTokenStart) const SAL_THROW(())
{
sal_Int32 const nEnd = sText.getLength();
sal_Int32 nPos = nTokenStart;
@@ -423,18 +418,18 @@ namespace
// -----------------------------------------------------------------------------
struct OTokenizeBySeparator
{
- OUString const sSeparator;
- OTokenizeBySeparator(OUString const& _sSeparator) CFG_NOTHROW()
+ rtl::OUString const sSeparator;
+ OTokenizeBySeparator(rtl::OUString const& _sSeparator) SAL_THROW(())
: sSeparator(_sSeparator)
{
OSL_PRECOND(sSeparator.trim().getLength() > 0, "Invalid empty separator string");
}
- sal_Int32 findFirstTokenStart(OUString const& /*sText*/) const CFG_NOTHROW()
+ sal_Int32 findFirstTokenStart(rtl::OUString const& /*sText*/) const SAL_THROW(())
{
return 0;
}
- sal_Int32 findNextTokenStart(OUString const& sText, sal_Int32 nPrevTokenEnd) const CFG_NOTHROW()
+ sal_Int32 findNextTokenStart(rtl::OUString const& sText, sal_Int32 nPrevTokenEnd) const SAL_THROW(())
{
sal_Int32 const nEnd = sText.getLength();
sal_Int32 nPos = nPrevTokenEnd;
@@ -446,7 +441,7 @@ namespace
else
return NO_MORE_TOKENS;
}
- sal_Int32 findTokenEnd(OUString const& sText, sal_Int32 nTokenStart) const CFG_NOTHROW()
+ sal_Int32 findTokenEnd(rtl::OUString const& sText, sal_Int32 nTokenStart) const SAL_THROW(())
{
sal_Int32 const nEnd = sText.getLength();
OSL_PRECOND( 0 <= nTokenStart && nTokenStart <= nEnd ,
@@ -462,8 +457,8 @@ namespace
};
// -----------------------------------------------------------------------------
template <class Tokenizer>
- void tokenizeListData(Tokenizer const& aTokenizer, OUString const& aContent, StringList& rContentList)
- CFG_NOTHROW( )
+ void tokenizeListData(Tokenizer const& aTokenizer, rtl::OUString const& aContent, std::vector< rtl::OUString >& rContentList)
+ SAL_THROW(())
{
sal_Int32 nTokenPos = aTokenizer.findFirstTokenStart(aContent);
@@ -482,10 +477,10 @@ namespace
// -----------------------------------------------------------------------------
}
// -----------------------------------------------------------------------------
-void ValueConverter::splitListData(OUString const& aContent, StringList& rContentList) const
- CFG_NOTHROW( )
+void ValueConverter::splitListData(rtl::OUString const& aContent, std::vector< rtl::OUString >& rContentList) const
+ SAL_THROW(())
{
- OUString sSeparator = m_sSeparator;
+ rtl::OUString sSeparator = m_sSeparator;
bool bSeparateByWhitespace = (sSeparator.trim().getLength() == 0);
diff --git a/configmgr/source/xml/valueformatter.cxx b/configmgr/source/xml/valueformatter.cxx
index 33d45b3f9a..6ff1a3b10f 100644
--- a/configmgr/source/xml/valueformatter.cxx
+++ b/configmgr/source/xml/valueformatter.cxx
@@ -47,7 +47,6 @@
namespace configmgr
{
namespace uno = com::sun::star::uno;
- using ::rtl::OUString;
namespace xml
{
@@ -71,7 +70,7 @@ bool isWhitespaceCharacter( sal_Unicode ch )
static
inline
-bool isWhitespaceString(OUString const & aStr)
+bool isWhitespaceString(rtl::OUString const & aStr)
{
sal_Unicode const * const pBegin = aStr.getStr();
sal_Unicode const * const pEnd = pBegin + aStr.getLength();
@@ -87,13 +86,13 @@ bool isWhitespaceString(OUString const & aStr)
// -----------------------------------------------------------------------------
static
-bool hasWhitespaceString( uno::Sequence< OUString > const & aSeq)
+bool hasWhitespaceString( uno::Sequence< rtl::OUString > const & aSeq)
{
// BACK: true, if whitespace Separator is ok, (no whitespace in Strings, no empty strings)
- OUString const * const pBegin = aSeq.getConstArray();
- OUString const * const pEnd = pBegin + aSeq.getLength();
+ rtl::OUString const * const pBegin = aSeq.getConstArray();
+ rtl::OUString const * const pEnd = pBegin + aSeq.getLength();
- OUString const * const pSpace = std::find_if(pBegin,pEnd,isWhitespaceString);
+ rtl::OUString const * const pSpace = std::find_if(pBegin,pEnd,isWhitespaceString);
return pSpace != pEnd;
}
@@ -101,24 +100,24 @@ bool hasWhitespaceString( uno::Sequence< OUString > const & aSeq)
struct HasSubString
{
- HasSubString(OUString const & _aSubStr)
+ HasSubString(rtl::OUString const & _aSubStr)
: m_aSubStr(_aSubStr)
{}
- bool operator()(OUString const & _aStr)
+ bool operator()(rtl::OUString const & _aStr)
{ return _aStr.indexOf(m_aSubStr) >= 0; }
- OUString const m_aSubStr;
+ rtl::OUString const m_aSubStr;
};
// -----------------------------------------------------------------------------
static
-bool hasStringWithSubstring(const uno::Sequence< OUString > &aSeq, OUString const & _aSubStr)
+bool hasStringWithSubstring(const uno::Sequence< rtl::OUString > &aSeq, rtl::OUString const & _aSubStr)
{
- OUString const * const pBegin = aSeq.getConstArray();
- OUString const * const pEnd = pBegin + aSeq.getLength();
+ rtl::OUString const * const pBegin = aSeq.getConstArray();
+ rtl::OUString const * const pEnd = pBegin + aSeq.getLength();
- OUString const * const pSpace = std::find_if(pBegin,pEnd,HasSubString(_aSubStr));
+ rtl::OUString const * const pSpace = std::find_if(pBegin,pEnd,HasSubString(_aSubStr));
return pSpace != pEnd;
}
@@ -149,14 +148,14 @@ bool hasEmptySequence(uno::Sequence< uno::Sequence<Element_> > const & aSeqSeq)
// -----------------------------------------------------------------------------
inline
-bool canUseSeparator(uno::Sequence< OUString > const & aSeq, OUString const & aSeparator)
+bool canUseSeparator(uno::Sequence< rtl::OUString > const & aSeq, rtl::OUString const & aSeparator)
{
return ! hasStringWithSubstring(aSeq,aSeparator);
}
// -----------------------------------------------------------------------------
inline
-bool canUseWhitespaceSeparator(uno::Sequence< OUString > const & aSeq)
+bool canUseWhitespaceSeparator(uno::Sequence< rtl::OUString > const & aSeq)
{
return ! hasWhitespaceString(aSeq);
}
@@ -172,14 +171,14 @@ bool canUseWhitespaceSeparator(const uno::Sequence< uno::Sequence<Element_> > &a
class Separator
{
- OUString m_sValue;
+ rtl::OUString m_sValue;
public:
// -----------------------------------------------------------------------------
Separator() : m_sValue() {}
// -----------------------------------------------------------------------------
bool isDefault() const { return m_sValue.getLength() == 0; }
// -----------------------------------------------------------------------------
- OUString value() const { return isDefault() ? static_cast<OUString>(SEPARATOR_WHITESPACE) : m_sValue; }
+ rtl::OUString value() const { return isDefault() ? static_cast<rtl::OUString>(SEPARATOR_WHITESPACE) : m_sValue; }
// -----------------------------------------------------------------------------
bool check(const uno::Sequence<rtl::OUString> &aSeq) const
@@ -205,7 +204,7 @@ public:
// -----------------------------------------------------------------------------
};
// -----------------------------------------------------------------------------
-#define ASCII( STRING_LIT_ ) ( OUString( RTL_CONSTASCII_USTRINGPARAM( STRING_LIT_ ) ) )
+#define ASCII( STRING_LIT_ ) ( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( STRING_LIT_ ) ) )
// -----------------------------------------------------------------------------
static
Separator createSeparator(const uno::Any& aAny)
@@ -219,7 +218,7 @@ Separator createSeparator(const uno::Any& aAny)
if (aElementType.getTypeClass() == uno::TypeClass_STRING)
{
// only in strings we need to search a separator
- uno::Sequence<OUString> aSeq;
+ uno::Sequence<rtl::OUString> aSeq;
OSL_VERIFY (aAny >>= aSeq);
@@ -284,7 +283,7 @@ void appendHex(rtl::OUStringBuffer& rBuff, sal_uInt8 _nByte)
// -----------------------------------------------------------------------------
static
-OUString binaryToHex(const uno::Sequence<sal_Int8>& _aBinarySeq)
+rtl::OUString binaryToHex(const uno::Sequence<sal_Int8>& _aBinarySeq)
{
sal_Int32 const nLength = _aBinarySeq.getLength();
@@ -299,11 +298,9 @@ OUString binaryToHex(const uno::Sequence<sal_Int8>& _aBinarySeq)
return sHex.makeStringAndClear();;
}
// -----------------------------------------------------------------------------
-typedef ValueFormatter::TypeConverter TypeConverter;
-// -----------------------------------------------------------------------------
-OUString formatSimpleValue(uno::Any const & _aValue, TypeConverter const & _xTCV)
+rtl::OUString formatSimpleValue(uno::Any const & _aValue, uno::Reference< script::XTypeConverter > const & _xTCV)
{
- OUString sResult;
+ rtl::OUString sResult;
if (_aValue.hasValue())
{
@@ -328,7 +325,7 @@ OUString formatSimpleValue(uno::Any const & _aValue, TypeConverter const & _xTCV
// -----------------------------------------------------------------------------
template <class Element_>
-OUString formatSequence(uno::Sequence< Element_ > const& aSequence, OUString const& sSeparator, TypeConverter const & _xTCV)
+rtl::OUString formatSequence(uno::Sequence< Element_ > const& aSequence, rtl::OUString const& sSeparator, uno::Reference< script::XTypeConverter > const & _xTCV)
{
rtl::OUStringBuffer aResult;
@@ -349,13 +346,13 @@ OUString formatSequence(uno::Sequence< Element_ > const& aSequence, OUString con
}
// -----------------------------------------------------------------------------
// template <> // optimized overload for String
-OUString formatSequence(uno::Sequence< OUString > const& aSequence, OUString const& sSeparator, TypeConverter const & )
+rtl::OUString formatSequence(uno::Sequence< rtl::OUString > const& aSequence, rtl::OUString const& sSeparator, uno::Reference< script::XTypeConverter > const & )
{
rtl::OUStringBuffer aResult;
if (sal_Int32 const nLength = aSequence.getLength())
{
- OUString const * pSeq = aSequence.getConstArray();
+ rtl::OUString const * pSeq = aSequence.getConstArray();
aResult = pSeq[0];
@@ -380,9 +377,9 @@ OUString formatSequence(uno::Sequence< OUString > const& aSequence, OUString con
aResult = formatSequence(aData,sSeparator,xTCV); \
} break \
-OUString formatSequenceValue(uno::Any const& _aValue, OUString const& sSeparator, TypeConverter const & xTCV)
+rtl::OUString formatSequenceValue(uno::Any const& _aValue, rtl::OUString const& sSeparator, uno::Reference< script::XTypeConverter > const & xTCV)
{
- OUString aResult;
+ rtl::OUString aResult;
uno::Type aElementType = getSequenceElementType( _aValue.getValueType() );
@@ -398,7 +395,7 @@ OUString formatSequenceValue(uno::Any const& _aValue, OUString const& sSeparator
CASE_WRITE_SEQUENCE( uno::TypeClass_DOUBLE, double );
- CASE_WRITE_SEQUENCE( uno::TypeClass_STRING, OUString );
+ CASE_WRITE_SEQUENCE( uno::TypeClass_STRING, rtl::OUString );
CASE_WRITE_SEQUENCE( uno::TypeClass_SEQUENCE, uno::Sequence<sal_Int8> );
@@ -439,7 +436,7 @@ void ValueFormatter::makeSeparator()
}
else
{
- m_sSeparator = OUString();
+ m_sSeparator = rtl::OUString();
m_bUseSeparator = false;
OSL_POSTCOND( !this->isList(), "ValueFormatter: Could not mark as non-list");
@@ -447,9 +444,9 @@ void ValueFormatter::makeSeparator()
}
// -----------------------------------------------------------------------------
-OUString ValueFormatter::getContent(TypeConverter const & _xTCV) const
+rtl::OUString ValueFormatter::getContent(uno::Reference< script::XTypeConverter > const & _xTCV) const
{
- OUString aResult;
+ rtl::OUString aResult;
try
{
if (this->isList())
@@ -463,7 +460,7 @@ OUString ValueFormatter::getContent(TypeConverter const & _xTCV) const
}
catch (script::CannotConvertException& cce)
{
- OUString const sMessage(RTL_CONSTASCII_USTRINGPARAM("Configuration: Could not convert value to XML representation: "));
+ rtl::OUString const sMessage(RTL_CONSTASCII_USTRINGPARAM("Configuration: Could not convert value to XML representation: "));
throw uno::RuntimeException(sMessage + cce.Message, cce.Context);
}
diff --git a/configmgr/source/xml/valueformatter.hxx b/configmgr/source/xml/valueformatter.hxx
index 899b021a1f..9ca61bf815 100644
--- a/configmgr/source/xml/valueformatter.hxx
+++ b/configmgr/source/xml/valueformatter.hxx
@@ -42,8 +42,6 @@ namespace configmgr
namespace uno = ::com::sun::star::uno;
namespace lang = ::com::sun::star::lang;
namespace script= ::com::sun::star::script;
-
- using rtl::OUString;
// -----------------------------------------------------------------------------
class ElementFormatter;
// -----------------------------------------------------------------------------
@@ -52,9 +50,6 @@ namespace configmgr
class ValueFormatter
{
public:
- typedef uno::Reference< script::XTypeConverter > TypeConverter;
-
- public:
explicit
ValueFormatter(uno::Any const & _aValue)
: m_aValue(_aValue)
@@ -69,14 +64,14 @@ namespace configmgr
bool hasContent() const;
- OUString getContent(TypeConverter const & _xTCV) const;
+ rtl::OUString getContent(uno::Reference< script::XTypeConverter > const & _xTCV) const;
private:
bool isList() const { return m_sSeparator.getLength() != 0; }
void makeSeparator();
uno::Any m_aValue;
- OUString m_sSeparator;
+ rtl::OUString m_sSeparator;
bool m_bUseSeparator;
};
// -----------------------------------------------------------------------------
diff --git a/configmgr/source/xml/writersvc.cxx b/configmgr/source/xml/writersvc.cxx
index 9a952b2b8c..c68334c2e1 100644
--- a/configmgr/source/xml/writersvc.cxx
+++ b/configmgr/source/xml/writersvc.cxx
@@ -59,17 +59,17 @@ namespace configmgr
template <class BackendInterface>
struct WriterServiceTraits;
// -----------------------------------------------------------------------------
-static inline void clear(OUString & _rs) { _rs = OUString(); }
+static inline void clear(rtl::OUString & _rs) { _rs = rtl::OUString(); }
// -----------------------------------------------------------------------------
template <class BackendInterface>
-WriterService<BackendInterface>::WriterService(CreationArg _xContext)
+WriterService<BackendInterface>::WriterService(uno::Reference< uno::XComponentContext > const & _xContext)
: m_xServiceFactory(_xContext->getServiceManager(), uno::UNO_QUERY)
, m_xWriter()
{
if (!m_xServiceFactory.is())
{
- OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Configuration XML Writer: Context has no service manager"));
+ rtl::OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Configuration XML Writer: Context has no service manager"));
throw uno::RuntimeException(sMessage,NULL);
}
}
@@ -101,13 +101,13 @@ void SAL_CALL
break;
}
- OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Cannot use argument to initialize a Configuration XML Writer"
+ rtl::OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Cannot use argument to initialize a Configuration XML Writer"
"- SAX XDocumentHandler or XOutputStream expected"));
throw lang::IllegalArgumentException(sMessage,*this,1);
}
default:
{
- OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Too many arguments to initialize a Configuration Parser"));
+ rtl::OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Too many arguments to initialize a Configuration Parser"));
throw lang::IllegalArgumentException(sMessage,*this,0);
}
}
@@ -163,12 +163,12 @@ void SAL_CALL
}
else
{
- SaxHandler xNewHandler = this->createHandler();
+ uno::Reference< sax::XDocumentHandler > xNewHandler = this->createHandler();
xDS.set( xNewHandler, uno::UNO_QUERY );
if (!xDS.is())
{
- OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Configuration XML Writer: Cannot set output stream to sax.Writer - missing interface XActiveDataSource."));
+ rtl::OUString sMessage( RTL_CONSTASCII_USTRINGPARAM("Configuration XML Writer: Cannot set output stream to sax.Writer - missing interface XActiveDataSource."));
throw uno::RuntimeException(sMessage,*this);
}
xDS->setOutputStream(aStream);
@@ -209,7 +209,7 @@ uno::Reference< sax::XDocumentHandler > WriterService<BackendInterface>::createH
{
static rtl::OUString const k_sSaxWriterSvc( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.xml.sax.Writer") );
- return SaxHandler::query( getServiceFactory()->createInstance(k_sSaxWriterSvc) );
+ return uno::Reference< sax::XDocumentHandler >::query( getServiceFactory()->createInstance(k_sSaxWriterSvc) );
}
catch (uno::RuntimeException& ) { throw; }
catch (uno::Exception& e)
@@ -221,7 +221,7 @@ uno::Reference< sax::XDocumentHandler > WriterService<BackendInterface>::createH
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
-AsciiServiceName const aLayerWriterServices[] =
+sal_Char const * const aLayerWriterServices[] =
{
"com.sun.star.configuration.backend.xml.LayerWriter",
0
@@ -238,8 +238,6 @@ const ServiceImplementationInfo aLayerWriterSI =
template <>
struct WriterServiceTraits< backenduno::XLayerHandler >
{
- typedef backenduno::XLayerHandler Handler;
-
static ServiceImplementationInfo const * getServiceInfo()
{ return & aLayerWriterSI; }
};
diff --git a/configmgr/source/xml/writersvc.hxx b/configmgr/source/xml/writersvc.hxx
index a21042b27c..f42fe0f21b 100644
--- a/configmgr/source/xml/writersvc.hxx
+++ b/configmgr/source/xml/writersvc.hxx
@@ -53,7 +53,6 @@ namespace configmgr
namespace xml
{
// -----------------------------------------------------------------------------
- using rtl::OUString;
namespace uno = ::com::sun::star::uno;
namespace lang = ::com::sun::star::lang;
namespace io = ::com::sun::star::io;
@@ -69,11 +68,8 @@ namespace configmgr
>
{
public:
- typedef uno::Reference< uno::XComponentContext > const & CreationArg;
- typedef uno::Reference< lang::XMultiServiceFactory > ServiceFactory;
-
explicit
- WriterService(CreationArg _xContext);
+ WriterService(uno::Reference< uno::XComponentContext > const & _xContext);
// XInitialization
virtual void SAL_CALL
@@ -103,25 +99,20 @@ namespace configmgr
throw (uno::RuntimeException);
protected:
- typedef uno::Reference< sax::XDocumentHandler > SaxHandler;
-
- ServiceFactory getServiceFactory() const
+ uno::Reference< lang::XMultiServiceFactory > getServiceFactory() const
{ return m_xServiceFactory; }
- SaxHandler getWriteHandler() throw (uno::RuntimeException);
+ uno::Reference< sax::XDocumentHandler > getWriteHandler() throw (uno::RuntimeException);
private:
- ServiceFactory m_xServiceFactory;
- SaxHandler m_xWriter;
+ uno::Reference< lang::XMultiServiceFactory > m_xServiceFactory;
+ uno::Reference< sax::XDocumentHandler > m_xWriter;
- SaxHandler createHandler() const throw (uno::RuntimeException);
+ uno::Reference< sax::XDocumentHandler > createHandler() const throw (uno::RuntimeException);
static ServiceInfoHelper getServiceInfo();
};
// -----------------------------------------------------------------------------
- typedef WriterService< ::com::sun::star::configuration::backend::XLayerHandler >
- LayerWriterService_Base;
-// -----------------------------------------------------------------------------
} // namespace xml
// -----------------------------------------------------------------------------